Capítulo 153 de 859

Chapter 153: XREstimatedLight

Core Idea

This class can be used to represent the environmental light of a XR session. It relies on the WebXR Lighting Estimation API.

Key Concepts

  • directionalLight : DirectionalLight: Represents the primary light from the XR environment.
  • environment : Texture: Will be set to a cube map in the SessionLightProbe if environment estimation is available and requested.
  • lightProbe : LightProbe: The light probe that represents the estimated light.

Code Examples

import { XREstimatedLight } from 'three/addons/webxr/XREstimatedLight.js';
  • What it demonstrates: Typical usage of XREstimatedLight.

Reference Tables

Constructor

Signature
new XREstimatedLight( renderer : WebGLRenderer, environmentEstimation : boolean )

Properties

PropertyDescription
.directionalLight : DirectionalLightRepresents the primary light from the XR environment.
.environment : TextureWill be set to a cube map in the SessionLightProbe if environment estimation is available and requested.
.lightProbe : LightProbeThe light probe that represents the estimated light.

Methods

MethodDescription
.dispose()Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.

Key Takeaways

  1. XREstimatedLight extends: EventDispatcher → Object3D → Group
  2. Most relevant properties: directionalLight, environment, lightProbe.
  3. Key methods: dispose.

Connects To