XRLightEstimate: primaryLightIntensity property
The read-only primaryLightIntensity property of the XRLightEstimate interface returns a DOMPointReadOnly representing the intensity of the primary light source from the probeSpace of an XRLightProbe.
Value
A DOMPointReadOnly object where an RGB value is mapped to the x, y, and z values. The w value is always 1.0. If no estimated values from the user's environment are available, the point will be {x: 0.0, y: 0.0, z: 0.0, w: 1.0}, representing no illumination.
Examples
Within an XRFrame loop, you can use the primaryLightDirection and primaryLightIntensity properties to render shadows based on the most prominent light source, for example.
const lightProbe = await xrSession.requestLightProbe();
function onXRFrame(time, xrFrame) {
let lightEstimate = xrFrame.getLightEstimate(lightProbe);
lightEstimate.primaryLightDirection;
lightEstimate.primaryLightIntensity;
}
Specifications
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 |
primaryLightIntensity |
90 |
90 |
No |
No |
76 |
No |
No |
90 |
No |
64 |
No |
15.0 |
See also