Verify geometric shadowing function in PBR shader
As noticed in https://github.com/CesiumGS/cesium/pull/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.
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.
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:
glTF Sample Viewer:
The Sample Viewer function gives a slightly broader and brighter specular reflection.