XRLightEstimate.sphericalHarmonicsCoefficients
The read-only sphericalHarmonicsCoefficients
property of the XRLightEstimate
interface returns a Float32Array
containing 9 spherical harmonics coefficients.
Spheral harmonic lighting is a technique that uses spherical functions instead of standard lighting equations. See Wikipedia for more information.
Value
A Float32Array
containing 9 spherical harmonics coefficients. The array contains 27 elements in total, with every 3 elements defining red, green, and blue components for each coefficient.
The first 3 elements must be a valid lighting estimate component; the rest may be 0 due to privacy settings or limitations of the device to provide more data.
Examples
Within an XRFrame
loop, you can use the sphericalHarmonicsCoefficients
property to light the scene.
const lightProbe = await xrSession.requestLightProbe(); // frame loop function onXRFrame(time, xrFrame) { let lightEstimate = xrFrame.getLightEstimate(lightProbe); // Render lights using lightEstimate.sphericalHarmonicsCoefficients ... }
Specifications
Specification |
---|
WebXR Lighting Estimation API Level 1 (WebXR Lighting Estimation API 1) # dom-xrlightestimate-sphericalharmonicscoefficients |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
sphericalHarmonicsCoefficients |
90 |
90 |
No |
No |
76 |
No |
No |
90 |
No |
No |
No |
No |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XRLightEstimate/sphericalHarmonicsCoefficients