Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add underwater sun occlusion #704

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daleeidd
Copy link
Collaborator

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.

@huwb
Copy link
Contributor

huwb commented Dec 2, 2020

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

@huwb
Copy link
Contributor

huwb commented Dec 2, 2020

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

@daleeidd
Copy link
Collaborator Author

daleeidd commented Dec 4, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I would like subsurface scattering to be occluded by opaque geometry
2 participants