x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to go from World Position to Texture Coordinates ?

Hello everyone !

For a prototype I'm working on, I created a dynamic texture to obtain a fog of war effect. This texture is updated with a timer to display a brighter circle, origin being the position of my pawn. I display this texture with a post process material using an Absolute World Position node.

alt text

My problem is : How do I convert the Actor Position of my Pawn to the coordinates of the texture ? Actually, I found empirically that dividing by 9.3 the Actor Position X and Y allow me to find the right point in the texture. But I can't be happy with such an approximative solution :)

Thank you for your help !

Product Version: UE 4.15
Tags:
fow.jpg (61.0 kB)
more ▼

asked Mar 25 '17 at 11:54 AM in C++ Programming

avatar image

Glitch Bliss
21 3 6 6

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

First You need to bind UV space to World space. Your case is just a coincidence that You able to do that by just multiplication.

There's many ways to do so, but main is by using Absolute World Position for UV.

Then You need to feed Your Actor's position to the material. This can be done by using Material Instance Dynamic parameters controlled by blueprint.

more ▼

answered Apr 10 '17 at 08:38 PM

avatar image

S-ed
1.3k 27 23 43

avatar image Glitch Bliss Apr 11 '17 at 06:48 PM

Hello, thank you for your answer !

Actually, I found no ways of doing the "erasing" operation in a material. The texture is updateded each time the character moves, and redrawn. The blendable material only owns the redrawn texture. It is at the redrawing moment done in C++ code that I would need the World position to UV operation.

Is there any way of doing it outside of material edition ?

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question