Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. XRLightProbe

XRLightProbe

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

TheXRLightProbe interface of theWebXR Device API contains lighting information at a given point in the user's environment. You can get anXRLighting object using theXRSession.requestLightProbe() method.

This object doesn't itself contain lighting values, but it is used to collect lighting states for eachXRFrame. SeeXRLightEstimate for the estimated lighting values for anXRLightProbe.

EventTarget XRLightProbe

Instance properties

XRLightProbe.onreflectionchange

Event handler property for thereflectionchange event.

XRLightProbe.probeSpaceRead onlyExperimental

AnXRSpace tracking the position and orientation the lighting estimations are relative to.

Instance methods

None.

Events

reflectionchangeExperimental

Fired each time the estimated reflection cube map changes. (This happens when the user moves around and the environment's lighting changes.)

Examples

Getting anXRLightProbe object for a session

Use theXRSession.requestLightProbe() method to get a light probe.

js
const lightProbe = await xrSession.requestLightProbe();

Getting a probe pose within anXRFrame

Pass the light probe'sprobeSpace toXRFrame.getPose() to get a light probe for a pose.

js
const probePose = xrFrame.getPose(lightProbe.probeSpace, xrReferenceSpace);

Using thereflectionchange event

PassXRLightProbe to get a reflection cube map whenever thereflectionchange event fires. See alsoXRWebGLBinding.getReflectionCubeMap().

js
const glBinding = new XRWebGLBinding(xrSession, gl);const lightProbe = await xrSession.requestLightProbe();let glCubeMap = glBinding.getReflectionCubeMap(lightProbe);lightProbe.addEventListener("reflectionchange", () => {  glCubeMap = glBinding.getReflectionCubeMap(lightProbe);});

Specifications

Specification
WebXR Lighting Estimation API Level 1
# xrlightprobe-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp