DirectionalLight

NodeLight

Description

class DirectionalLight extends ShadowLight

Constructor

new DirectionalLight(name, direction, scene)

Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).

The directional light is emitted from everywhere in the given direction.

It can cast shawdows.

Documentation : http://doc.babylonjs.com/tutorials/lights

Parameters

Name Type Description
name string
direction Vector3
scene Scene

Members

shadowFrustumSize : number

Fix frustum size for the shadow generation. This is disabled if the value is 0.

Specifies a fix frustum size for the shadow generation.

shadowOrthoScale : number

autoUpdateExtends : boolean

Methods

getClassName() string

Returns the string "DirectionalLight".

getTypeID() number

Returns the integer 1.

transferToEffect(effect, lightIndex) DirectionalLight

Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.

Returns the DirectionalLight.

Parameters

Name Type Description
effect Effect
lightIndex string

getDepthMinZ(activeCamera) number

Gets the minZ used for shadow according to both the scene and the light.

     * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being

-1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.

Parameters

Name Type Description
activeCamera Camera

getDepthMaxZ(activeCamera) number

Gets the maxZ used for shadow according to both the scene and the light.

     * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being

-1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.

Parameters

Name Type Description
activeCamera Camera