UNPKG

2.39 kBTypeScriptView Raw
1import { SphericalHarmonics3 } from "../math/SphericalHarmonics3.js";
2import { Light } from "./Light.js";
3
4/**
5 * Light probes are an alternative way of adding light to a 3D scene.
6 * @remarks
7 * Unlike classical light sources (e.g
8 * directional, point or spot lights), light probes do not emit light
9 * Instead they store information about light passing through 3D space
10 * During rendering, the light that hits a 3D object is approximated by using the data from the light probe.
11 * Light probes are usually created from (radiance) environment maps
12 * The class {@link THREE.LightProbeGenerator | LightProbeGenerator} can be used to create light probes from
13 * instances of {@link THREE.CubeTexture | CubeTexture} or {@link THREE.WebGLCubeRenderTarget | WebGLCubeRenderTarget}
14 * However, light estimation data could also be provided in other forms e.g
15 * by WebXR
16 * This enables the rendering of augmented reality content that reacts to real world lighting.
17 * The current probe implementation in three.js supports so-called diffuse light probes
18 * This type of light probe is functionally equivalent to an irradiance environment map.
19 * @see Example: {@link https://threejs.org/examples/#webgl_lightprobe | WebGL / light probe }
20 * @see Example: {@link https://threejs.org/examples/#webgl_lightprobe_cubecamera | WebGL / light probe / cube camera }
21 * @see {@link https://threejs.org/docs/index.html#api/en/lights/LightProbe | Official Documentation}
22 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/LightProbe.js | Source}
23 */
24export class LightProbe extends Light {
25 /**
26 * Creates a new LightProbe.
27 * @param sh An instance of {@link THREE.SphericalHarmonics3 | SphericalHarmonics3}. Default `new THREE.SphericalHarmonics3()``.
28 * @param intensity Numeric value of the light probe's intensity. Expects a `Float`. Default `1`.
29 */
30 constructor(sh?: SphericalHarmonics3, intensity?: number);
31
32 /**
33 * Read-only flag to check if a given object is of type {@link DirectionalLight}.
34 * @remarks This is a _constant_ value
35 * @defaultValue `true`
36 */
37 readonly isLightProbe: true;
38
39 /**
40 * A light probe uses spherical harmonics to encode lighting information.
41 * @defaultValue `new THREE.SphericalHarmonics3()`
42 */
43 sh: SphericalHarmonics3;
44
45 /** @internal */
46 fromJSON(json: {}): LightProbe;
47}