getShIrradianceAt
Efficiently calculates the soft, low-frequency, indirect diffuse light (irradiance) from the environment for a specific surface orientation using Spherical Harmonics (SH) coefficients.
Core Advantages
Achieves realistic ambient lighting with extreme performance (pure math, no texture sampling) by completely encapsulating complex Spherical Harmonics theory, allowing developers to easily obtain high-quality indirect light.
Common Uses
Calculating the indirect diffuse component of Image-Based Lighting (IBL) from an environment map in PBR materials.
Decoding localized, baked ambient light from Light Probes.
Reconstructing pre-computed global illumination from lightmaps.
Providing objects with soft, directional ambient light to ground them in the scene.
How to adjust
Its effect is adjusted by changing its inputs. Modifying the `normal` input (e.g., by plugging in a normal map) makes the ambient light react to fine surface details; swapping the `shCoefficients` input (e.g., from a 'blue sky' to a 'sunset' environment) completely changes the scene's overall lighting mood and color.
Code Examples
1// Calculate indirect diffuse light from the environment
2// using the surface normal and pre-computed SH coefficients.
3const indirectDiffuse = getShIrradianceAt( normalWorld, sh9Coefficients );