I am using Distance To Nearest Surface for my water plane and within the editor there is no lag, but when I press play and my camera looks towards the water it is extremely laggy. The lag goes away when I look away from the water and the lag goes away when I disable Distance To Nearest Surface.
Below is a close example of how it’s being used:
Does anyone know a fix?
Old stuff but your shader kinda makes no sense.
First you divide which is giving you the distance. everything 2cm from the material.
Then you subtract from that.
Then you clamp it back from 0 to 1
Then you increment it again by a power of 4
then you clamp it again… for every pixel on screen if you are dealing with a water surface.
Going to go out on a limb and say that the reason this was laggy is probably the amount of superfluous mathematics on the shader combined to the size of the mesh plane.