Skip to content

Interface: LightRig ​

Experimental

The lights of scene.lighting for a 3D scene. Add object to the scene, call attach once with the renderer (shadow maps, environment), and setCamera with the scene's camera (lights in camera or clip space follow it). Set the rig on meshes drawn with Plotly's model (MeshPrimitive.setLightRig) so they use the same lights.

Properties ​

PropertyModifierTypeDescription
objectreadonlyGroupExperimental three.js lights (and the ground plane): add to the scene.

Accessors ​

environment ​

Get Signature ​

ts
get environment(): Texture<unknown, TextureEventMap> | null;

Experimental

The scene's environment texture (or null), once available.

Returns ​

Texture<unknown, TextureEventMap> | null


spec ​

Get Signature ​

ts
get spec(): Readonly<LightingSpec>;

Experimental

The current spec.

Returns ​

Readonly<LightingSpec>

Methods ​

attach() ​

ts
attach(
   renderer,
   scene,
   invalidate?
): void;

Experimental

Bind to the renderer and scene: enables shadow maps when a light casts shadows and sets the scene's environment. invalidate is called when an environment image has loaded.

Parameters ​

ParameterType
rendererWebGLRenderer
sceneScene
invalidate?() => void

Returns ​

void


dispose() ​

ts
dispose(): void;

Experimental

Returns ​

void


restore() ​

ts
restore(): void;

Experimental

Draw again what only existed on the GPU, after the WebGL context was lost and restored: the generated environment ('studio', 'city') is a render target, which three.js cannot upload again as it does buffers and textures.

Returns ​

void


setCamera() ​

ts
setCamera(camera): void;

Experimental

The camera that camera- and clip-space lights follow.

Parameters ​

ParameterType
cameraCamera | null

Returns ​

void


update() ​

ts
update(spec): void;

Experimental

Replace the lights.

Parameters ​

ParameterType
specLightingSpec

Returns ​

void

Released under the MIT License.