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

[name]

Affects objects using [page:MeshLambertMaterial] or [page:MeshPhongMaterial].

Example

[example:canvas_morphtargets_horse morphtargets / horse ]
[example:misc_controls_fly controls / fly ]
[example:misc_lights_test lights / test ]
[example:vr_cubes cubes ]
[example:webgl_effects_parallaxbarrier effects / parallaxbarrier ]
[example:webgl_effects_stereo effects / stereo ]
[example:webgl_geometry_extrude_splines geometry / extrude / splines ]
[example:webgl_materials_bumpmap materials / bumpmap ]
[example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection ]
// White directional light at half intensity shining from the top. var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); directionalLight.position.set( 0, 1, 0 ); scene.add( directionalLight );

Constructor

[name]([page:Integer hex], [page:Float intensity])

[page:Integer hex] -- Numeric value of the RGB component of the color.
[page:Float intensity] -- Numeric value of the light's strength/intensity.
Creates a light that shines from a specific direction not from a specific position. This light will behave as though it is infinitely far away and the rays produced from it are all parallel. The best analogy would be a light source that acts like the sun: the sun is so far away that all sunlight hitting objects comes from the same angle.

Properties

[property:Object3D target]

Target used for shadow camera orientation.

[property:Float intensity]

Light's intensity.
Default — *1.0*.

[property:Boolean onlyShadow]

If set to *true* light will only cast shadow but not contribute any lighting (as if *intensity* was 0 but cheaper to compute).
Default — *false*.

[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*.

[property:Float shadowCameraNear]

Orthographic shadow camera frustum parameter.
Default — *50*.

[property:Float shadowCameraFar]

Orthographic shadow camera frustum parameter.
Default — *5000*.

[property:Float shadowCameraLeft]

Orthographic shadow camera frustum parameter.
Default — *-500*.

[property:Float shadowCameraRight]

Orthographic shadow camera frustum parameter.
Default — *500*.

[property:Float shadowCameraTop]

Orthographic shadow camera frustum parameter.
Default — *500*.

[property:Float shadowCameraBottom]

Orthographic shadow camera frustum parameter.
Default — *-500*.

[property:Boolean shadowCameraVisible]

Show debug shadow camera frustum.
Default — *false*.

[property:Float shadowBias]

Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.
Default — *0*.

[property:Float shadowDarkness]

Darkness of shadow casted by this light (from *0* to *1*).
Default — *0.5*.

[property:Integer shadowMapWidth]

Shadow map texture width in pixels.
Default — *512*.

[property:Integer shadowMapHeight]

Shadow map texture height in pixels.
Default — *512*.

[property:Vector2 shadowMapSize]

The shadowMapWidth and shadowMapHeight stored in a [page:Vector2 THREE.Vector2]. Set internally during rendering.

[property:OrthographicCamera shadowCamera]

The shadow's view of the world. Computed internally during rendering from the shadowCamera* settings.

[property:Matrix4 shadowMatrix]

Model to shadow camera space, to compute location and depth in shadow map. Computed internally during rendering.

[property:WebGLRenderTarget shadowMap]

The depth map generated using the shadowCamera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.

Methods

[method:DirectionalLight clone]()

It returns a clone of DirectionalLight.

[method:JSON toJSON]()

Return DirectionalLight data in JSON format.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]