I’m working on a pixel shader that is revealing an object based on its world position. That part is working fine.
I would now like to add sort of an afterglow or decay effect to it. So the object should lose its colour (fade to black/transparent) slowly instead of instantly. Very much like what you can see here: https://youtu.be/XO4cMHnUs1g?t=222 only instead of a 2-dimensional surface using a 3-dimensional object and basing the colour on its fragments world coordinates.
The problem is that I don’t know how to access the previous value of the pixel shader. I might have to feed it back into the shader somehow. But in what format - a texture or some sort of buffer? How do I do this?
Is there an example that does something similar and I could take a look at?
Thanks a lot in advance!