Underwater depth light fade to dark!

Hi there,

I have made a ocean with a water plane and a post process volume for the underwater effect. And it all looks nice, but I am haven serious problems trying to make the effect to have the light fade to dark as it gets deeper in the ocean… So not as you go deeper, but can see it getting dark from a distance.

I have tried with Exponential Height Fog and could not work it out. Any help would be great, or a example.

Thanks, Steve

Hey Steve,

For the darker “deep” water effect when looking down from above you will need to add a depth fade node with a scalar parameter to drive a Lerp between deep and shallow colors to your translucent water material. I have an example of this in the ocean project linked in my signature below but it’s a really complex material, so I put together a quick example of how it’s used:

I created the adjustable variables as parameters rather than hard coded values, this way you can create a material instance to get the right settings for your project. To control how deep the water needs to be before you can no longer see the bottom adjust the FadeDistance parameter, and to adjust how smooth the transition is you can increase the FadeSoftness parameter.

That’s pretty much it for this effect when looking down from above, but won’t do anything below the surface.

This is a very basic implementation of it, but should do what you need. Here’s what it looks like with a similar technique in the ocean project:

In this image I’m actually using 2 different depth fades, one for the deep to shallow water, the other for the shallow to very shallow water. I’m in the middle of some big changes to this material so it doesn’t look as good as it should right now, but with with enough adjustment you can get it looking just right.

Hope that helps!

Thanks DotCam, yes I have looked at the Free Community Ocean & Sky Project in the past few months and have the project in my UE4. It’s great, but I am using the new Voxel Plugin and i cant map the ocean to the voxel terrain in the setting only allows ue4 terrains… I tried making a ue4 terrain with a height map which mirrors the voxel terrain to use in the ocean details panel but was very taxing using both voxel and ue4 terrain lol… God i hope that makes sense lol… I am new to this… I only a web developer but did game dev back on the Amiga with Amos back in the day… oh so old days lol… But starting to get into UE4… Need a change, been doing web dev since the late 90’s LOL

I am using the Beach Wave Water from the market for the surface which works nice for my islands and the Ocean Floor Environment also from the market… But the Ocean Floor Environment uses a post processing volume. Is there away to use those nodes with the post processing volume which i am using for the underwater effect? Sorry for being a newbie, but u can see in my screenshot I am learning lol…

If you mean looking from above the surface then you will need to add the DepthFade node hooked up to a Lerp to control the light and dark boundary as shown in my previous post to your ocean material. I do not have access to that asset so I’m not able to give a proper example, but that is the general idea.

If you mean light/visibility level decreasing the lower you go underwater (while viewing underwater) we tried a few different approaches but ended up using a post process material that becomes active once below the surface.

This is an example of that, but I am pretty sure you mean looking from above

The post process volume for underwater effects does not have any affect on the look from above the surface, it is only there for when the camera goes beneath the surface.

Oh yes that is what I want when the player is underwater… Sorry I think I confused things, I should of left out the Beach Wave Water which is only surface… Yes sorry in the post process material is what I am after, I already have a post process volume being used for the existing underwater effect, i just need the “light/visibility level decreasing the lower you go underwater”… Sorry, can you help on this, I’m not sure how to do a post process material… That video is great, I seen the effect in the project I downloaded from “Free Community Ocean & Sky Project”… It’s what got me thinking it was a post process effect, but was not sure how…

Hi there, Yes I did mean light/visibility level decreasing the lower you go underwater in a post process… But I have no idea how to do it… I have tried for a few hours.

I’ll try and put together a quick example for you later this afternoon, have a few things I need to finish up first. It will basically be a stripped down version of the post process material currently in our project, there are a few things specific to our project that aren’t necessary. Will post again later when it’s done.

Just have the level BP track the player character and just have a function that lerps between all of the various settings that you want to change within the post process volume. Set min and max depths. If you go deeper than the max depth, it will have no further effect. Calculate a percentage based on your min/max values and that will be used to drive the lerpfest.

Thank you this would greatly help me and also help me to learn, so next time will not have to ask :slight_smile:

did you solve the problem of reducing the light underwater? To me the request is better expressed as : a way to filter light more and more based on distance from the player, as if water itself acts as a light absorber.