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?
Well you can try echo effect
Also a ringbuffer in contribs or in the Advanced Shaders there is Compute Texture Queue in examples (witch is a bit complicated but exactly what you want)
What you do is a texture array and then you blend it thru the function…
I’m first rendering a UV texture based on world position blended with the previous output texture via FrameDelay. Then rendering the geometry again using Constant and this UV texture.
It creates a texture of a certain size which is independent from the renderer’s resolution. Not sure if this is the most elegant solution. Happy to hear your thoughts.
I’m not sure i understand exactly what you are after.
Normally mesh has it’s UV coords, witch is 2d plane try looking this:
i guess i need to see an example…
from what i’m guessing you want to reveal mesh by some sort of 3d function with feedback…
in that case you need to raymarch your function against mesh (try look here vvekend vvorkshops - raymarching basics | vvvv)
but it will be density function in your case… whitch is more complicated
I’m sorry if I’m not using the right terminology here and this might be confusing.
But you got me. This is what I was looking for. And it basically does it for me but I think there are some more problems with the UV coordinates as I get different issues or glitches based on the geometry. I’ve made some examples.