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 shadows. Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
Gets a list of Animations associated with the node
Automatically compute the shadowMinZ and shadowMaxZ for the projection matrix to best fit (including all the casters) on each frame. autoUpdateExtends must be set to true for this to work
Automatically compute the projection matrix to best fit (including all the casters) on each frame.
Callback defining a custom Projection Matrix Builder. This can be used to override the default projection matrix computation.
Diffuse gives the basic color to an object.
Defines the falloff type for this light. This lets overriding how punctual light are falling off base on range or angle. This can be set to any values in Light.FALLOFF_x.
Note: This is only useful for PBR Materials at the moment. This could be extended if required to other types of materials.
Gets or sets the id of the node
List of inspectable custom properties (used by the Inspector)
https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
Strength of the light. Note: By default it is define in the framework own unit. Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.
Gets or sets an object used to store user defined information for the node
Gets or sets the name of the node
An event triggered when the mesh is disposed
Callback raised when the node is ready to be used
Defines the rendering priority of the lights. It can help in case of fallback or number of lights exceeding the number allowed of the materials.
For internal use only. Please do not use.
Specular produces a highlight color on an object. Note: This is not affecting PBR materials.
Gets or sets a string used to store user defined state for the node
The transformed direction. Direction of the light in world space taking parenting in account.
The transformed position. Position of the light in world space taking parenting in account.
Gets or sets the unique id of the node
Static
Readonly
FALLOFF_Falloff Default: light is falling off following the material specification: standard material is using standard falloff whereas pbr material can request special falloff per materials.
Static
Readonly
FALLOFF_Falloff gltf: light is falling off as described in the gltf moving to PBR document to enhance interoperability with other engines.
Static
Readonly
FALLOFF_Falloff Physical: light is falling off following the inverse squared distance law.
Static
Readonly
FALLOFF_Falloff Standard: light is falling off like in the standard material to enhance interoperability with other materials.
Static
Readonly
INTENSITYMODE_Each light type uses the default quantity according to its type: point/spot lights use luminous intensity directional lights use illuminance
Static
Readonly
INTENSITYMODE_lux (lm/m^2)
Static
Readonly
INTENSITYMODE_nit (cd/m^2)
Static
Readonly
INTENSITYMODE_candela (lm/sr)
Static
Readonly
INTENSITYMODE_lumen (lm)
Static
Readonly
LIGHTMAP_If every light affecting the material is in this lightmapMode, material.lightmapTexture adds or multiplies (depends on material.useLightmapAsShadowmap) after every other light calculations.
Static
Readonly
LIGHTMAP_material.lightmapTexture as only lighting no light calculation from this light only adds dynamic shadows from this light
Static
Readonly
LIGHTMAP_material.lightmapTexture as only diffuse lighting from this light adds only specular lighting from this light adds dynamic shadows
Static
Readonly
LIGHTTYPEID_Light type const id of the directional light.
Static
Readonly
LIGHTTYPEID_Light type const id of the hemispheric light.
Static
Readonly
LIGHTTYPEID_Light type const id of the point light.
Static
Readonly
LIGHTTYPEID_Light type const id of the spot light.
Gets or sets the accessibility tag to describe the node for accessibility purpose.
Gets or sets the animation properties override
Gets the list of attached behaviors
https://doc.babylonjs.com/features/featuresDeepDive/behaviors
In 2d mode (needCube being false), gets the direction used to cast the shadow. Also use as the light direction on spot and directional lights.
In 2d mode (needCube being false), sets the direction used to cast the shadow. Also use as the light direction on spot and directional lights.
Gets or sets a boolean used to define if the node must be serialized
Gets the layer id use to find what meshes are not impacted by the light. Inactive if 0
Sets the layer id use to find what meshes are not impacted by the light. Inactive if 0
Gets the meshes not impacted by this light.
Sets the meshes not impacted by this light.
Gets the layer id use to find what meshes are impacted by the light. Inactive if 0
Sets the layer id use to find what meshes are impacted by the light. Inactive if 0
Gets the only meshes impacted by this light.
Sets the only meshes impacted by this light.
Gets the photometric scale used to interpret the intensity. This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
Sets the photometric scale used to interpret the intensity. This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)
Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)
Sets a callback that will be raised when the node will be disposed
An event triggered when the enabled state of the node changes
Gets or sets the orthoBottom property used to build the light frustum
Gets or sets the orthoLeft property used to build the light frustum
Gets or sets the orthoRight property used to build the light frustum
Gets or sets the orthoTop property used to build the light frustum
Gets or sets the parent of the node (without keeping the current position in the scene)
https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent
Sets the position the shadow will be casted from. Also use as the light position for both point and spot lights.
Sets the position the shadow will be casted from. Also use as the light position for both point and spot lights.
Gets the light radius used by PBR Materials to simulate soft area lights.
sets the light radius used by PBR Materials to simulate soft area lights.
Defines how far from the source the light is impacting in scene units. Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.
Defines how far from the source the light is impacting in scene units. Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.
Gets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching the current shadow generator.
Sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching the current shadow generator.
Fix frustum size for the shadow generation. This is disabled if the value is 0.
Specifies a fix frustum size for the shadow generation.
Sets the shadow projection clipping maximum z value.
Gets the shadow projection clipping maximum z value.
Gets the shadow projection clipping minimum z value.
Sets the shadow projection clipping minimum z value.
Gets the shadow projection scale against the optimal computed one. 0.1 by default which means that the projection window is increase by 10% from the optimal size. This does not impact in fixed frustum size (shadowFrustumSize being set)
Sets the shadow projection scale against the optimal computed one. 0.1 by default which means that the projection window is increase by 10% from the optimal size. This does not impact in fixed frustum size (shadowFrustumSize being set)
Returns directly the latest state of the mesh World matrix. A Matrix is returned.
Binds the lights information from the scene to the effect for the given mesh.
Light index
The scene where the light belongs to
The effect we are binding the data to
Defines if specular is supported
Optional
receiveShadows: booleanDefines if the effect (mesh) we bind the light for receives shadows
Attach a behavior to the node
https://doc.babylonjs.com/features/featuresDeepDive/behaviors
the current Node
defines the behavior to attach
Optional
attachImmediately: booleandefines that the behavior must be attached even if the scene is still loading
Will start the animation sequence
the object created for this animation. If range does not exist, it will return null
defines the range frames for animation sequence
Optional
loop: booleandefines if the animation should loop (false by default)
Optional
speedRatio: numberdefines the speed factor in which to run the animation (1 by default)
Optional
onAnimationEnd: (() => void)defines a function to be executed when the animation ended (undefined by default)
Specifies if the light will affect the passed mesh.
true the mesh is affected otherwise, false.
The mesh to test against the light
Returns a new Light object, named "name", from the current one.
the new created light
The name of the cloned light
Optional
newParent: Nullable<Node>The parent of this light, if it has one
Releases resources associated with this node.
Optional
doNotRecurse: booleanSet to true to not recurse into each children (recurse into each children by default)
Optional
disposeMaterialAndTextures: booleanSet to true to also dispose referenced materials and textures (false by default)
Get an animation by name
null if not found else the requested animation
defines the name of the animation to look for
Gets an attached behavior by name
https://doc.babylonjs.com/features/featuresDeepDive/behaviors
null if behavior was not found else the requested behavior
defines the name of the behavior to look for
Get all child-meshes of this node
an array of AbstractMesh
Optional
directDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)
Optional
predicate: ((node: Node) => node is T)defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Get all child-meshes of this node
an array of AbstractMesh
Optional
directDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)
Optional
predicate: ((node: Node) => boolean)defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Get all direct children of this node
an array of Node
Optional
predicate: ((node: Node) => node is T)defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Optional
directDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)
Get all direct children of this node
an array of Node
Optional
predicate: ((node: Node) => boolean)defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Optional
directDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)
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. (when not using reverse depth buffer / NDC half Z range)
the depth max z
The camera we are returning the max for
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. (when not using reverse depth buffer / NDC half Z range)
the depth min z
The camera we are returning the min for
Will return all nodes that have this node as ascendant
all children nodes of all types
Optional
directDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
Optional
predicate: ((node: Node) => node is T)defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Will return all nodes that have this node as ascendant
all children nodes of all types
Optional
directDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
Optional
predicate: ((node: Node) => boolean)defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Return the minimum and maximum world vectors of the entire hierarchy under current node
the new bounding vectors
Optional
includeDescendants: booleanInclude bounding info from descendants as well (true by default)
Optional
predicate: Nullable<((abstractMesh: AbstractMesh) => boolean)>defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.
The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true
Optional
faceIndex: numberThe index of the face we are computed the direction to generate shadow
Returns the Light associated shadow generator if any.
the associated shadow generator.
Optional
camera: Nullable<Camera>Camera for which the shadow generator should be retrieved (default: null). If null, retrieves the default shadow generator
Is this node a descendant of the given node? The function will iterate up the hierarchy until the ancestor was found or no more parents defined
a boolean indicating if this node is a descendant of the given node
defines the parent node to inspect
Is this node enabled? If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true
whether this node (and its parent) is enabled
Optional
checkAncestors: booleanindicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors
Remove an attached behavior
https://doc.babylonjs.com/features/featuresDeepDive/behaviors
the current Node
defines the behavior to attach
Sets the shadow projection matrix in parameter to the generated projection matrix.
The current light
The matrix to updated with the projection information
The transform matrix of the light
The list of mesh to render in the map
Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
The directional light
The effect to update
The index of the light in the effect to update
Static
AddStatic
ConstructReturns a node constructor based on type name
the new constructor or null
defines the type name
defines the new node name
defines the hosting scene
Optional
options: anydefines optional options to transmit to constructors
Static
GetCreates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3. This new light is named "name" and added to the passed scene.
the constructor function
Type according to the types available in Light.LIGHTTYPEID_x
The friendly name of the light
The scene the new light will belong to
Static
ParseParses the passed "parsedLight" and returns a new instanced Light from this parsing.
the created light after parsing
The JSON representation of the light
The scene to create the parsed light in
Static
ParseGenerated using TypeDoc
A directional light is defined by a direction (what a surprise!). The light is emitted from everywhere in the specified direction, and has an infinite range. An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object. Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction