How do I use the frame buffer of the current frame as a texture input for the next frame

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pseudonymous_person

Hi all,
I’m trying to do 2D fluid dynamics on the GPU, where it stores new state in the current frame, and iterates on that by using said frame as an input texture for its next frame.

The texture should be initialized to a random noise pattern at the start of the simulation, and then updated each frame by rendering the previous texture to a framebuffer and using it as the input to the shader.

I’ve tried Subviewports but it hasn’t been working like I’d hoped. I have issues updating the subviewport texture with the previous frame.

Thanks for any help!