I’m trying to implement a systems using a render target to generate footsteps in snow or other surfaces. Multiple Actors can draw onto this RT and then it is used as a Mask inside my Landscape Material.
However since I need bigger Landscapes now I want to use this mask only in an area around the player. So I move the mask RT according to the current camera position. Then I need the actual content of the RT to move in the opposite direction so it stays stationary on the landscape.
This basically means. I need to have a RT on which the actors can draw the footsteps, then use that RT as an input in a material which I use to shift the UV content and draw that material onto another RT or ideally on to itself again. As far as I figured out using a RT as an input in a material and then drawing that material on to itself isn’t supported and results in empty RTs (not even black, just empty).
I tried to use 3 RTs for this next. 2 RTs are used to draw the footsteps and store the shifted version of itself. I alternate between these two on a per frame basis and a third one is used in the landscape shader. However this also doesn’t work and results in empty RTs. I think I still don’t really understand the problem itself or something.
Here are the most important functions:
This is how the actors draw their footsteps to one of the two RTs:
The “GetCaptureRenderTarget” function outputs one of the two RTs depending on the current frame.
This is the material in which the content of the RT is being shifted:
And this happens every Tick and this is where all the drawing of the RTs happens other than the footstep generation:
Basically the first Branch alternates every Tick. It changes the input texture of the material and then stores the data on the RT that has been used the frame before to draw the footsteps and vice versa. The third draw to draws everything on a third RT which is used in the landscape material.