WebGLRenderer: Improve ambient occlusion with multi-bounce and better specular occlusion #32073
+31
−9
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.
Description
This PR improves the physical accuracy of the PBR implementation with better energy conservation and ambient occlusion handling.
Changes
1. Multi-bounce ambient occlusion
gtaoMultiBounce()
function to account for inter-reflections based on surface albedo2. Improved specular occlusion for IBL
computeSpecularOcclusion()
with better roughness falloffBenefits
Performance
Minimal impact - multi-bounce AO adds ~3 multiply-adds per pixel. No additional texture lookups.
Compatibility
All changes are backwards compatible and always enabled. Works with existing AO maps, no API changes required.
Technical Details
Based on research by Jorge Jimenez (GTAO) and Sébastien Lagarde (Frostbite). Uses polynomial approximation to accumulate infinite light bounces efficiently.
Comparisons
https://raw.githack.com/mrdoob/three.js/dev/examples/index.html#webgl_animation_keyframes
https://raw.githack.com/mrdoob/three.js/multibounce-ao-specular/examples/index.html#webgl_animation_keyframes
https://raw.githack.com/mrdoob/three.js/dev/examples/index.html?q=gltf#webgl_loader_gltf_compressed
https://raw.githack.com/mrdoob/three.js/multibounce-ao-specular/examples/index.html?q=gltf#webgl_loader_gltf_compressed
https://raw.githack.com/mrdoob/three.js/dev/examples/index.html#webgl_random_uv
https://raw.githack.com/mrdoob/three.js/multibounce-ao-specular/examples/index.html#webgl_random_uv