Create a directional light, that is emitted in a single direction without any attenuation. A common use case for this type of light is to simulate the sun.

This light can cast DirectionalShadow.

Example

// assuming 'renderer' is a valid Camera renderer

// this directional light will not cast any shadows
const directionalLight = new DirectionalLight(renderer, {
color: new Vec3(1),
intensity: 1,
position: new Vec3(5, 2, 3),
})

// this directional light will cast shadows
const directionalLightWithShadows = new DirectionalLight(renderer, {
color: new Vec3(1),
intensity: 1,
position: new Vec3(-10, 10, -5),
shadow: {
intensity: 1
},
})

// this directional light will ALSO cast shadows!
const anotherDirectionalLightWithShadows = new DirectionalLight(renderer, {
color: new Vec3(1),
intensity: 2,
position: new Vec3(12, 0.5, 5),
target: new Vec3(3),
shadow: {}, // that's enough to start casting shadows
})

// this directional light will cast shadows as well...
const lastDirectionalLightWithShadows = new DirectionalLight(renderer, {
color: new Vec3(1),
intensity: 1,
position: new Vec3(10),
})

// ... because we're telling it here to start casting shadows
lastDirectionalLightWithShadows.shadow.cast()

Hierarchy (view full)

Constructors

Properties

target: Vec3
#direction: Vec3

The direction of the DirectionalLight is the target minus the actual position.

Options used to create this DirectionalLight.

DirectionalShadow associated with this DirectionalLight.

type: string
uuid: string

The universal unique id of this Light

index: number

Index of this Light, i.e. the number of time a Light of this type has been created.

renderer: CameraRenderer

CameraRenderer used by this Light

color: Vec3

Current color of this Light.

#intensityColor: Vec3

A Vec3 holding the Light color multiplied by its intensity.

rendererBinding: BufferBinding

CameraRenderer corresponding BufferBinding that holds all the bindings to send to the shaders.

transforms: Object3DTransforms
children: Object3D[]

Children Object3D in the scene graph, used to compute their own world matrix

object3DIndex: number

Index (order of creation) of this Object3D. Used in the parent / children relation.

matricesNeedUpdate: boolean

Whether at least one of this Object3D matrix needs an update.

Accessors

Methods