Calculate depth of a translucent material

Hi ,

I am creating ocean material using Gerstner Wave equaiton. To modify the shoreline wave behavior , I wanted to add a Depth parameter in the material function , but I am unable to find out how to calculate depth of the water surface from the floor.

Kindly help

Have you tried DepthFade node?

Depth fade just determines the depth and and it can outputs the diffuse and opacity value of the material , like ocean shoreline , but if we want the take the value of depth at position x as input parameter , depth fade doesn’t work. It doesn’t return the height of the ocean floor from the ocean surface

Hey sameek4 -

Within a Material itself you cannot make a call to the height of the mesh from another mesh, however, you can make a blueprint which calls the depth via a line trace which can be inputted into the material from the blueprint as a Vector parameter. This Vector parameter would allow you to do the depth math within the material.

It would be set up in a similar way as to the BP_SkySphere, though obviously with different maths and inputs.

Thank You

Eric Ketchum