Hello.
I am making a reactive shader for my underwater plants. I want them to move when any object comes close to it.
However, the distancefieldgradient seems to feel very steep and i want to smoothen it out a little so the plants dont snap back imediatly after the object has past trough them.
There is my setup:
And the effect iam trying to make:
Hope iam clear and you can help me out!
You won’t be able to get a fast response for moving out of the way and a slow return to the original shape at the same time with one distance field alone, since it only knows for far away and in what direction the surface is. It does not know what direction the object was moving, so it can’t have a different softness to the effect after the object has moved away.
Usually to get that result, you need to have some kind of memory of where the object has been. Often this is done with render targets, so this memory can be stored in a texture and read by the material.
A similar concept would be to spawn an invisible trail of copies of the mesh that affects distance fields, but then each slowly shrinks away and vanishes. This would effectively act like memory for the distance field by storing the position of the mesh in previous frames.
It may be expensive to do either of these for every object though, which is why most games limit these effects just only specific objects and characters.
1 Like
Thank you for your response.
I was wondering if you maybe have a tutorial for storing these render targets?
I can’t seem to find the right thing. Iam pretty new to this.