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

Verify geometric shadowing function in PBR shader #12010

Closed
jjhembd opened this issue May 31, 2024 · 2 comments · Fixed by #12063
Closed

Verify geometric shadowing function in PBR shader #12010

jjhembd opened this issue May 31, 2024 · 2 comments · Fixed by #12063

Comments

@jjhembd
Copy link
Contributor

jjhembd commented May 31, 2024

As noticed in #12006:
In pbrLighting.glsl we use a formula for geometric self-shadowing that is rather different from the glTF reference implementation.

On a quick first look, the closest method I could find to our smithVisibilityGGX function is the Schlick-GGX Approximation. We are, however, using a different k-value which I have not been able to trace. And the way we avoid divide-by-zero errors is somewhat inconsistent for different inputs.

We either need to:

  • Document the source of our formula, and quantify the impact of any differences in rendering between this formula and more common formulations, OR
  • Switch to a more commonly-used formula, and document the source.
@jjhembd
Copy link
Contributor Author

jjhembd commented May 31, 2024

For reference, this paper questions the validity of the "Schlick-Smith Approximation", suggesting that it overestimates the masking effect (which could potentially make our images too dim):
https://jcgt.org/published/0003/02/03/paper.pdf
See Figure 12 and the surrounding discussion.

@jjhembd
Copy link
Contributor Author

jjhembd commented Jun 24, 2024

Here is a quick comparison of the two geometric self-shadowing functions. The effect is subtle, and limited to direct lighting. We use a different code path for IBL.

Current Cesium code:
image

glTF Sample Viewer:
image

The Sample Viewer function gives a slightly broader and brighter specular reflection.

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

Successfully merging a pull request may close this issue.

1 participant