crest icon indicating copy to clipboard operation
crest copied to clipboard

Add underwater sun occlusion

Open daleeidd opened this issue 3 years ago • 3 comments

Occludes the subsurface scattering. Someone asked about this on Discord. I did it a little while ago so I thought I would put it here rather than let it sit.

Screenshot (2) Before

Screenshot (1) After

I don't think it looks correct for objects above water. Not sure whether to exclude them or if refraction needs to be applied.

It uses the depth buffer. The other option could be using the Unity shadow map to occlude. But I think that will be more work across pipelines.

Happy to hear your thoughts.

Testing

Other than the keyword, it has two properties:

Sun Occlusion Distance Strength

Applied to the linear depth to make it more usable.

Sun Occlusion Fall-Off

The same as the SSS fall-off but for occlusion.

daleeidd avatar Nov 28 '20 00:11 daleeidd

Thanks. Could you speak more to what it does and how? I did not understand what it does so far.

huwb avatar Dec 02 '20 08:12 huwb

Could the "distance strength" benefit from a different name. Might just be my understanding is missing, but just recording my initial thought as others may have the same

huwb avatar Dec 02 '20 08:12 huwb

Here are two better images from a greater distance which make the effect more obvious:

Screenshot (20) Before

Screenshot (21) After

Could you speak more to what it does and how? I did not understand what it does so far.

It reduces the SSS colour added when looking towards the sun by using the depth texture. The issue was that there could be something a foot in front of the camera, but this SSS value would be present which looked strange. This solution isn't perfect but it seems to do a good enough job and adds some extra detail to underwater.

Could the "distance strength" benefit from a different name. Might just be my understanding is missing, but just recording my initial thought as others may have the same

Sure. Not sure what a good name would be. The higher the value, the greater the distance from the camera the effect has influence over. All it does is bring the depth value into a more useable range. Maybe Power?

daleeidd avatar Dec 04 '20 17:12 daleeidd