You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebGPURenderer: Implement GGX VNDF importance sampling for PMREM (#32134)
* WebGPURenderer: Implement GGX VNDF importance sampling for PMREM
Port the GGX VNDF (Visible Normal Distribution Function) importance
sampling implementation from WebGLRenderer's PMREM to WebGPURenderer's
TSL-based PMREM generator.
This implementation provides more accurate environment map prefiltering
by using Monte Carlo integration with VNDF importance sampling to
represent the GGX BRDF for physically-based rendering.
Changes to PMREMUtils.js:
- Added GGX VNDF sampling helper functions:
- radicalInverse_VdC: Van der Corput radical inverse
- hammersley: Hammersley sequence for quasi-Monte Carlo sampling
- importanceSampleGGX_VNDF: GGX VNDF importance sampling (Heitz 2018)
- ggxConvolution: Main convolution function using VNDF sampling
- Optimized shader code by removing unnecessary .toVar() calls
Changes to PMREMGenerator.js:
- Added GGX_SAMPLES constant (1024 samples, optimized for performance)
- Removed _axisDirections (no longer needed with GGX filtering)
- Added _ggxMaterial property
- Replaced blur-based _applyPMREM with GGX filtering
- Added _applyGGXFilter method for incremental roughness filtering
- Added _getGGXShader function to create GGX material
- Updated documentation to reflect GGX VNDF usage
Technical notes:
- Uses texture() instead of texture(null) for EmptyTexture default
- Helper functions don't use setLayout (TSL pattern for nested Fn)
- Implements incremental roughness filtering to avoid over-blurring
- Applies blur strength mapping (0.05 + roughness * 0.95) for quality
- Performs two-pass rendering: pingPong target then back to cubeUV
- Reduced sample count to 1024 (vs WebGL's 2048) for better performance
* Clean up.
* Updated screenshots.
* WebGPURenderer: Remove unnecessary .toVar() from s variable
Performance optimization: removed .toVar() from the s variable in
importanceSampleGGX_VNDF as it is never reassigned and only used
for reading on the next line.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Remove `.toVar()`
* Revert "Remove `.toVar()`"
This reverts commit 3bfdc12.
* update screenshots
* update screenshots
* Increase GGX samples from 1024 to 2048
* Reduce GGX samples from 2048 to 1024
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: sunag <[email protected]>
0 commit comments