[page:Object3D] → [page:Light] →

[name]

A point light that can cast a shadow in one direction within a falloff cone.
Affects objects using [page:MeshLambertMaterial] or [page:MeshPhongMaterial].

Example

View in Examples

Other Examples

[example:webgl_lights_spotlights lights / spotlights ]
[example:webgl_interactive_cubes_gpu interactive / cubes / gpu ]
[example:webgl_interactive_draggablecubes interactive / draggablecubes ]
[example:webgl_materials_bumpmap_skin materials / bumpmap / skin ]
[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]
[example:webgl_morphtargets_md2 morphtargets / md2 ]
[example:webgl_shading_physical shading / physical ]

Code Example

// white spotlight shining from the side, casting shadow var spotLight = new THREE.SpotLight( 0xffffff ); spotLight.position.set( 100, 1000, 100 ); spotLight.castShadow = true; spotLight.shadow.mapSize.width = 1024; spotLight.shadow.mapSize.height = 1024; spotLight.shadow.camera.near = 500; spotLight.shadow.camera.far = 4000; spotLight.shadow.camera.fov = 30; scene.add( spotLight );

Extra Examples

[example:webgl_materials_bumpmap materials / bumpmap]
[example:webgl_shading_physical shading / physical]
[example:webgl_shadowmap shadowmap]
[example:webgl_shadowmap_viewer shadowmap / performance]
[example:webgl_shadowmap_viewer shadowmap / viewer]

Constructor

[name]( [page:Integer color], [page:Float intensity], [page:Float distance], [page:Radians angle], [page:Float penumbra], [page:Float decay] )

[page:Integer color] — Numeric value of the RGB component of the color.
[page:Float intensity] — Numeric value of the light's strength/intensity.
[page:Float distance] -- Maximum distance from origin where light will shine whose intensity is attenuated linearly based on distance from origin.
[page:Radians angle] -- Maximum angle of light dispersion from its direction whose upper bound is Math.PI/2.
[page:Float penumbra] -- Percent of the spotlight cone that is attenuated due to penumbra. Takes values between zero and 1. Default is zero.
[page:Float decay] -- The amount the light dims along the distance of the light.

Properties

See the base [page:Light Light] class for common properties.

[property:Object3D target]

Spotlight focus points at target.position.
Default position — *(0,0,0)*.
*Note*: Currently for target property to work properly, it must be part of the [page:Scene scene], e.g. this will help: scene.add( light.target )

[property:Float power]

Light's power.
In "physically correct" mode, the luminous power of the light measured in lumens.
Default - *4PI*.

[property:Float distance]

If non-zero, light will attenuate linearly from maximum intensity at light *position* down to zero at *distance*.
Default — *0.0*.

[property:Float angle]

Maximum extent of the spotlight, in radians, from its direction. Should be no more than *Math.PI/2*.
Default — *Math.PI/3*.

[property:Float penumbra]

Percent of the spotlight cone that is attenuated due to penumbra. Takes values between zero and 1.
Default — *0.0*.

[property:Float decay]

The amount the light dims along the distance of the light
In "physically correct" mode, decay = 2 leads to physically realistic light falloff.
Default — *1*.

[property:SpotLightShadow shadow]

This property stores all relevant information for rendering the shadow of the light.

[property:Boolean castShadow]

If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and requires tweaking to get shadows looking right.
Default — *false*.

Methods

See the base [page:Light Light] class for common methods.

[method:SpotLight copy]( [page:SpotLight source] )


Copies value of *source* to this SpotLight object.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]