Download

How to avoid hardcoded texture scaling ?

Hi,

I’m playing with post process effect to recreate a fog of war as seen in most RTS.

I’m using a fixed grayscale texture to test the rendering before using a dynamic texture. I’ve finally came accross something that is most likely to be the final visual result but I’m not sure I took the right path.

Indeed, as you can see in the picture, I’ve hardcoded the scaling so my texture perfectly match my level, if I change the level dimension, the fog of war will be ****ed up.

My level is a square of 6300 world units. So I add that value to offset the level (because it ranges from -3150 to 3150) et and I divide by 12600 so I have a value between 0 and 1 to match my UV mapping.

I was wondering if I could avoid those hardcoded value and also why I have to double the values in my blueprint (as you can see, I divide by 12600 whereas my level has a size of 6300).

I’m quite unfamiliar with post processing and texture mapping in general so a detailed explanation would be more helpful and meaningful to me !

Screenshot link: https://ibb.co/dJKvMp
ps: Click on open in a new tab to zoom in/out

Thanks a lot :slight_smile:

Hey, little bump here, I still did not find a solution to that issue :frowning: