<light> elements in the loaded model. Hook form of <SceneLights> for imperative usage inside your own components.
Signature
Usage
Composing with Custom Lighting
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
intensity | number | 1.0 | Multiplier applied to all MJCF light intensities. |
Light Mapping
MJCF light_type | Three.js Light |
|---|---|
0 (directional) | DirectionalLight |
1 (spot) | SpotLight |
How It Works
- On model load, reads
model.nlightand iterates all MJCF light definitions - Creates
DirectionalLightorSpotLightinstances based onlight_type - Applies position, direction, color, shadow, and attenuation from model data
- Lights are added to the R3F scene and cleaned up on unmount or model change
Notes
- For a declarative JSX API, use
<SceneLights>instead - The component form is a thin wrapper around this hook
- If the MJCF model has no
<light>elements, this hook does nothing