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

Properly scale SSR reflection based on metallic value for dielectric materials #65594

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

clayjohn
Copy link
Member

Fixes: #61930

The issue here was caused by scaling the impact of SSR by the metallic value alone. Dielectric materials (materials with a metallic value of 0.0) still exhibit specular reflections, even when their roughness is 1.0. This PR replaces the simple multiplication by the metallic value with a proper fresnel-schlick calculation. This scales the impact of SSR based on viewing angle (more reflection with a flatter viewing angle) and metallic.

In this PR I also remove the metallic_mask which was used to select the channel to read from to read the metallic texture. Since metallic is always in the .w channel, it is more efficient to just read from the .w channel directly.

While this is technically the correct way to account for metallic, The results look off to me. I think there are issues in other parts of the SSR pipeline. I will continue investigating.

Old:

Screenshot from 2022-09-09 15-55-10

New:

Screenshot from 2022-09-09 15-53-37

More comparisons With high roughness: Old:

Screenshot from 2022-09-09 15-54-59

New:

Screenshot from 2022-09-09 15-53-24

@clayjohn clayjohn added this to the 4.0 milestone Sep 10, 2022
@clayjohn clayjohn requested a review from a team as a code owner September 10, 2022 01:45
@akien-mga akien-mga merged commit f211869 into godotengine:master Sep 12, 2022
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Vulkan: Screen Space Reflections don't appear on non-metallic materials
4 participants