Update specular BRDF for image-based lighting #12083
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Merge #12082 first!
Description
This PR updates the specular calculations for image-based lighting.
Key changes
Use perceptual roughness
The raw "perceptual" roughness as encoded in the glTF is now retained in
MaterialStageFS
. Where the squared "alpha" roughness is needed (e.g. for direct lighting), it is squared when used, and more consistently named "alphaRoughness" for clarity.This change to un-squared roughness is significant for the rendering result in two places:
Update self-shadowing function in BRDF look-up texture
Image-based lighting uses a pre-computed texture from which BRDF parameters are read. The calculation of these parameters includes a self-shadowing function. This PR updates the self-shadowing function to be consistent with the one used for direct lighting, as implemented in #12063.
Fix clamping errors
MaterialStageFS
was clamping roughness to a minimum of0.04
. This has been removed, to allow sharper reflections on materials like the Clearcoat Car Paint test model.Also, in
ImageBasedLightingStageFS
, the calculation ofNdotV
for specular IBL calculation applied anabs
for negative values. This has been updated to aclamp(NdotV, 0.0, 1.0)
.Rendering comparisons
Clearcoat Wicker, before
Clearcoat Wicker, after
Note the brighter and broader specular reflection.
Barn Lamp, before
Barn Lamp, after
Note the more natural appearance of the brushed metal.
Clearcoat Test, before
Clearcoat Test, after
Note the improved clarity of the "Roughness variations", now that we are using perceptual roughness. Also note the changed appearance of the "Partial coating" after fixing the clamp of
NdotV
.Issue number and link
Addresses part of #12028.
Testing plan
Load the "glTF PBR Extensions" and "Image Based Lighting" Sandcastles, and compare the rendering to the
main
branch.Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change[ ] I have added or updated unit tests to ensure consistent code coverageSee Add screenshot testing for subtle lighting changes #12065