WebGLRenderer/WebGPURenderer: Simplify multi-scattering compensation for direct lighting #32103
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.
Related issue: #32072 #32089
Description
This PR simplifies the multi-scattering compensation in the GGX BRDF for direct lighting, aligning both WebGL and WebGPU implementations with the standard Fdez-Agüera approximation.
Previously,
BRDF_GGX_Multiscatterused a complex dual-DFG approach that computed separate energy terms for both view and light directions. This has been simplified to use a single DFG lookup based on the view direction only, matching the approach already used incomputeMultiscatteringfor indirect lighting.The simplified implementation:
Changes:
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js- SimplifiedBRDF_GGX_Multiscattersrc/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js- Updated TSL implementation to matchReference: http://www.jcgt.org/published/0008/01/03/
For comparison:
https://raw.githack.com/mrdoob/three.js/multiscattering/examples/index.html