-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 BRDF for image-based lighting #12028
Comments
Material roughness is used in three places for IBL:
We will need to verify which roughness to use in each place. See Assuming we store both perceptual roughness and squared ("alpha") roughness on the
|
A bigger issue for our IBL is the way we handle the diffuse component. We currently expect the user to compute the spherical harmonic from the environment map and set the coefficients manually. Then we sample it and add it directly to the specular component, without any BRDF or Fresnel terms. |
The BRDF and Fresnel terms for the diffuse component in the glTF Sample Viewer are actually part of a multi-scattering approximation. The terms are explained toward the end of this very helpful article. These multi-scattering terms fix energy conservation problems in two main areas:
Despite the name, the approximate "multi-scattering" terms are actually cheap to compute, so we should incorporate them into our code in |
As noted in #12082, once this is complete, some Sandcastles may need updating to ensure the brighter side is facing the camera on initial load. |
Cesium uses the squared roughness to select the LOD of the specular environment map, which appears to be incorrect. The glTF reference implementation uses "perceptual roughness" for environment map LOD selection.
Here are some rough comparisons in Cesium, compared to the reference implementation. Note: for these comparisons, all are using the "Helipad Golden Hour" environment map for the specular component. But Cesium is not using the corresponding coefficients for the diffuse component.
Clearcoat Car Paint model, using squared roughness (current behavior):
Clearcoat Car Paint model, using perceptual roughness (test):
Clearcoat Car Paint model, reference implementation:
At first glance, the squared roughness result in Cesium appears to be noisier. Also the environment map appears to be mirror-flipped relative to the reference?
Barn Lamp model, using squared roughness (this affects both LOD selection and anisotropy calculations):
Barn Lamp model, using perceptual roughness:
Barn Lamp model, reference implementation:
The squared roughness result does not show as much smearing along the brush strokes in the metal, indicating that perceptual roughness should be used for the anisotropy calculations.
We will need to verify the correctness before switching. Cesium's approach has some fundamental differences with the glTF reference implementation which can make comparisons challenging:
textureLod
for mip selection.The text was updated successfully, but these errors were encountered: