You don’t need two effect wrappers as you have a single effect to use.
Also, you use samplers that you never set (textureSampler), so it can’t work.
Try this:
https://playground.babylonjs.com/#ZLB7Z2#3
How it works:
- first frame: rttA is the texture red from (in the shader, sampler
lastFrame
), rttB is the texture written to - second frame: rttB is the texture red from (in the shader, sampler
lastFrame
), rttA is the texture written to - and so on
So, at each frame, the previous output (written) texture is used as the source texture, and the previous source texture becomes the output texture.
For this to work, however, you have to put something in the very first texture red from (rttA)…
In the PG, I make a rendering of the current scene, so it’s a read cube at the center of the screen.
Then, the shader simply samples the source texture and applies a coordinate scaling of 0.998 so that you can actually see some changes: the effect is a kind of a blurring toward the upper right corner of the screen.
Note also that it is working because the source / output textures are never cleared! So, the frames get accumulated one over the other, with a tiny shift each time (because of the 0.998 factor).