files/en-us/web/api/xrlightprobe/index.md
{{APIRef("WebXR Device API")}} {{secureContext_header}}{{SeeCompatTable}}
The XRLightProbe interface of the WebXR Device API contains lighting information at a given point in the user's environment. You can get an XRLighting object using the {{domxref("XRSession.requestLightProbe()")}} method.
This object doesn't itself contain lighting values, but it is used to collect lighting states for each {{domxref("XRFrame")}}. See {{domxref("XRLightEstimate")}} for the estimated lighting values for an XRLightProbe.
{{InheritanceDiagram}}
XRLightProbe.onreflectionchange
None.
XRLightProbe object for a sessionUse the {{domxref("XRSession.requestLightProbe()")}} method to get a light probe.
const lightProbe = await xrSession.requestLightProbe();
XRFramePass the light probe's probeSpace to {{domxref("XRFrame.getPose()")}} to get a light probe for a pose.
const probePose = xrFrame.getPose(lightProbe.probeSpace, xrReferenceSpace);
reflectionchange eventPass XRLightProbe to get a reflection cube map whenever the {{domxref("XRLightProbe.reflectionchange_event", "reflectionchange")}} event fires. See also {{domxref("XRWebGLBinding.getReflectionCubeMap()")}}.
const glBinding = new XRWebGLBinding(xrSession, gl);
const lightProbe = await xrSession.requestLightProbe();
let glCubeMap = glBinding.getReflectionCubeMap(lightProbe);
lightProbe.addEventListener("reflectionchange", () => {
glCubeMap = glBinding.getReflectionCubeMap(lightProbe);
});
{{Specifications}}
{{Compat}}