Material Depth Occlusion

Hey!

I have an underwater post process material. Here, it is adding light using the SkyAtmosphereLightDirection, but the problem is, that doesn’t take into account whether it is occluded by other objects. This leads to some effects shown below where I am still getting a sun glow, even when it is occluded by objects.

I’ve tried sampling the scene depth, and have got it working with the big halo ring (when not using the SkyAtmosphereLightDirection node), but don’t know how to get it to work with the output from the add node in the picture.


How do I occlude the output of the add node if it is occluded by an object? Any help is appreciated :slight_smile: Thanks!

You’re on the right track there with the scene depth. Instead of trying to add it though, treat it as a mask.


The only problem with this method is that it won’t allow any bloom to spill onto the mesh like would naturally happen. The only way to add this effect in would be to blur the scene depth using HLSL, which is outside of my skillset.

1 Like