storing the result of a Cg shader into a texture

Hey everyone,

What I’m trying to do is take a initial depth texture, subtract a another one (which represents one frame of a displacement to that initial depth texture) and store this resulting image back in the first initial depth texture so it runs in a loop.

However, I’m trying to do all of this on the GPU. I have the correct deformations happening in the vertex shader, but I can’t figure out a way to store the result somehow so that it becomes the next frames initial state. If anyone can point me in the right direction that would be awesome. Thanks

This definitely works. We’ve done some water simulation like this. You have to get your render order correct and you have to turn off clears in the correct render target.

GraphicsOutput.setClearActive

for sort its one of the arguments in makeOuput.

Try it with a color before you go to depth.

I think I did something like this in demomaster VTF water demos. I set up the buffers and get it back to merge with the user actions and then feed it to the vtf shader again.