Download

Is it possible to modify displacement based on depth fade?

I am working on an ocean shader and want to modify the Gerstner waves based on how close they are to the shoreline. I will have a more advanced modification eventually, but to test, I simply tried to multiply the displacement by a depth fade node to reduce the strength. This gave me an error and I discovered that the depth fade node is not directly compatible with displacement. Is there a way to work with depth fade’s output to accomplish what I’m trying to do or are there better ways to go about this?

Z

No, you obviously can’t use depth fade displacement because displacement affects pixel depth.
You should be using distance field instead.

Or just 4.26

I looked into doing this with distance fields. To test it, I plugged the output of this section of nodes into the base color so I could see the shoreline it detects. Everything I found on the subject led to roughly the set of nodes shown in the included image, but it always comes up with a very thin outline. I need a much thicker area of effect to use for the shore. Is there a better way to use distance fields for detecting a shoreline?