0
\$\begingroup\$

I'm currently trying to pull a fog of war for an rts game, and planned it like this. (Unity 2020.2.7, URP 10.3.1)

  1. Use units field of view to generate a texture of what is seen (alpha 0).
  2. Create other render texture to generate fog (alpha > 0 && alpha < 1) by not clearing camera buffer.
  3. Use the mask made between the two textures to cut the fog of war (alpha 1).

Now i'm currently stuck at the 2nd step. Please check the image

enter image description here

As you can see, the camera is doing what I want, but the render texture somehow clears the buffer, which just gives me the "Use units field of view to generate a texture of what is seen (alpha 0)." part again.

This whole buffer thing has been hard to understand, i'm not sure if this implementation is right or not. I would be really thankful for any pointers given! :D

Cheers guys!

\$\endgroup\$

1 Answer 1

-1
\$\begingroup\$

Finally I ended up doing something I don't like. I'm reading from the normal render texture of my FoW, fog data that I save to a texture2d in the cpu every X ms. I don't really know how to use compute shaders just yet, but I'm thinking of moving that operation over to the gpu.

Still it would be nice if anyone knows how to make sure that the camera buffer information is passed to the render texture.

Cheers~

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .