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

[name]

This light gets emitted uniformly across the face a rectangular plane. This can be used to simulate things like bright windows or strip lighting.

This light can cast shadows - see the [page:RectAreaLightShadow] page for details.

NOTE: this class is currently under active development and is probably not production ready yet (as of r83). Check back in a month or two! And feel free to try it out in the meantime.

Examples

[example:webgl_lights_arealight WebGL / arealight ]
[example:webgl_lights_rectarealight WebGL / rectarealight ] var width = 2; var height = 10; var rectLight = new THREE.RectAreaLight( 0xffffff, undefined, width, height ); rectLight.matrixAutoUpdate = true; rectLight.intensity = 70.0; rectLight.position.set( 5, 5, 0 ); rectLightHelper = new THREE.RectAreaLightHelper( rectLight ); rectLight.add( rectLightHelper ); scene.add(rectLight)

Constructor

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

[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
[page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

[page:Float width] - (optional) width of the light. Default is 10.
[page:Float height] - (optional) height of the light. Default is 10. Creates a new [name].

Properties

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

[property:Boolean castShadow]

If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and requires tweaking to get shadows looking right. See the [page:RectAreaLightShadow] for details. The default is *false*.

Note: this is not yet implemented for this light type! (r83)

[property:Float decay]

The amount the light dims along the distance of the light.
In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, decay = 2 leads to physically realistic light falloff. The default is *1*.

Note: this is not yet implemented for this light type! (r83)

[property:Float distance]

If non-zero, light will attenuate linearly from maximum intensity at the light's position down to zero at this distance from the light. Default is *0.0*.

Note: this is not yet implemented for this light type! (r83)

[property:Boolean isRectAreaLight]

Used to check whether this or derived classes are spot lights. Default is *true*.

You should not change this, as it used internally for optimisation.

[property:Vector3 position]

This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.

[property:RectAreaLightShadow shadow]

A [page:RectAreaLightShadow] used to calculate shadows for this light.

Note: this is not yet implemented for this light type! (r83)

[property:Object3D target]

The RectAreaLight points from its [page:.position position] to target.position. The default position of the target is *(0, 0, 0)*.
*Note*: For the the target's position to be changed to anything other than the default, it must be added to the [page:Scene scene] using scene.add( light.target ); This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically updated each frame.

It is also possible to set the target to be another object in the scene (anything with a [page:Object3D.position position] property), like so: var targetObject = new THREE.Object3D(); scene.add(targetObject); light.target = targetObject; The RectAreaLight will now track the target object.

Methods

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

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

Copies value of all the properties from the [page:RectAreaLight source] to this RectAreaLight.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]