Water Depth Effect

Hello!

I am reaching the dev-forums on help with my skinned mesh ocean system.

Today I have a pretty long post on a “Depth Effect” wich is actually the effect where the higher portions of a water body appear darker than the lower portions is often referred to as depth shading or depth-based coloring. This phenomenon typically occurs because of how light interacts with water surfaces. In real-world water bodies, deeper areas appear darker due to less light penetration, while shallower areas reflect more light and appear lighter.

Now I have done alot of research and I have no clue on how to do this.
I have tried color-maps and normal maps and everything. I am ultimatly going for something
like the following video at 0:36 and I still dont know how he did it. There is almost no documentation on this wich is suprising as it looks like something that is easy to do but who am
I do say if i cant figure it out :sweat_smile:

1 Like

What i would do is have the water mesh extend all the way under to all the areas where there is water, Then have a render stepped connection that uses getpartsboundinradius on the camera to get if the camera is touching a water part, If so then get the distance from the surface using the basic bounding box of the object, so

(box.Position.Y + box.Size.Y/2) - Cameraposition

Then clamp that number from 0-math.huge so that its always 0 or more, Then square that number for a exponential light dissipation. Then set that number as the lighting.brightness, or just anything to do with brightness, Then so you can see the darker areas, use an inverted sphere around the camera, make that sphere have a gradient that is darker at the bottom and lighter at the top. Make that gradient change transparency depending on the depth and have it set to the cameras pos using RunService.RenderStepped. And thats about it, Tell me if you have any questions about my method

1 Like