Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface describing all the common properties and methods a shadow light needs to implement. This helps both the shadow generator and materials to generate the corresponding shadow maps as well as binding the different shadow properties to the effects.

Hierarchy

Implemented by

Index

Properties

animations: Animation[]

Gets a list of Animations associated with the node

diffuse: Color3

Diffuse gives the basic color to an object.

direction: Vector3

In 2d mode (needCube being false), the direction used to cast the shadow.

falloffType: number

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.

id: string

The light id in the scene (used in scene.getLightById for instance)

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

see

https://doc.babylonjs.com/how_to/debug_layer#extensibility

intensity: number

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.

metadata: any

Gets or sets an object used to store user defined information for the node

name: string

The friendly name of the light in the scene.

onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onReady: Nullable<(node: Node) => void>

Callback raised when the node is ready to be used

position: Vector3

The position the shadow will be casted from.

renderPriority: number

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.

reservedDataStore: any

For internal use only. Please do not use.

shadowMaxZ: number

Defines the shadow projection clipping maximum z value.

shadowMinZ: number

Defines the shadow projection clipping minimum z value.

specular: Color3

Specular produces a highlight color on an object. Note: This is not affecting PBR materials.

state: string

Gets or sets a string used to store user defined state for the node

transformedDirection: Vector3

The transformed direction. Direction of the light in world space taking parenting in account.

transformedPosition: Vector3

The transformed position. Position of the light in world space taking parenting in account.

uniqueId: number

Gets or sets the unique id of the node

Accessors

  • Gets or sets the animation properties override

    Returns Nullable<AnimationPropertiesOverride>

  • Gets or sets the animation properties override

    Parameters

    Returns void

  • get doNotSerialize(): boolean
  • set doNotSerialize(value: boolean): void
  • Gets or sets a boolean used to define if the node must be serialized

    Returns boolean

  • Gets or sets a boolean used to define if the node must be serialized

    Parameters

    • value: boolean

    Returns void

  • get excludeWithLayerMask(): number
  • set excludeWithLayerMask(value: number): void
  • Gets the layer id use to find what meshes are not impacted by the light. Inactive if 0

    Returns number

  • Sets the layer id use to find what meshes are not impacted by the light. Inactive if 0

    Parameters

    • value: number

    Returns void

  • Gets the meshes not impacted by this light.

    Returns AbstractMesh[]

  • Sets the meshes not impacted by this light.

    Parameters

    Returns void

  • get includeOnlyWithLayerMask(): number
  • set includeOnlyWithLayerMask(value: number): void
  • Gets the layer id use to find what meshes are impacted by the light. Inactive if 0

    Returns number

  • Sets the layer id use to find what meshes are impacted by the light. Inactive if 0

    Parameters

    • value: number

    Returns void

  • Gets the only meshes impacted by this light.

    Returns AbstractMesh[]

  • Sets the only meshes impacted by this light.

    Parameters

    Returns void

  • get intensityMode(): number
  • set intensityMode(value: number): void
  • 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.

    Returns number

  • 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.

    Parameters

    • value: number

    Returns void

  • get lightmapMode(): number
  • set lightmapMode(value: number): void
  • Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)

    Returns number

  • Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)

    Parameters

    • value: number

    Returns void

  • An event triggered when the node is cloned

    Returns Observable<Node>

  • set onDispose(callback: () => void): void
  • Sets a callback that will be raised when the node will be disposed

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns void

  • get onEnabledStateChangedObservable(): Observable<boolean>
  • An event triggered when the enabled state of the node changes

    Returns Observable<boolean>

  • get radius(): number
  • set radius(value: number): void
  • Gets the light radius used by PBR Materials to simulate soft area lights.

    Returns number

  • sets the light radius used by PBR Materials to simulate soft area lights.

    Parameters

    • value: number

    Returns void

  • get range(): number
  • set range(value: number): void
  • 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.

    Returns number

  • 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.

    Parameters

    • value: number

    Returns void

  • get shadowEnabled(): boolean
  • set shadowEnabled(value: boolean): void
  • Gets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching the current shadow generator.

    Returns boolean

  • Sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching the current shadow generator.

    Parameters

    • value: boolean

    Returns void

  • get worldMatrixFromCache(): Matrix
  • Returns directly the latest state of the mesh World matrix. A Matrix is returned.

    Returns Matrix

Methods

  • _bindLight(lightIndex: number, scene: Scene, effect: Effect, useSpecular: boolean, receiveShadows?: boolean): void
  • Binds the lights information from the scene to the effect for the given mesh.

    Parameters

    • lightIndex: number

      Light index

    • scene: Scene

      The scene where the light belongs to

    • effect: Effect

      The effect we are binding the data to

    • useSpecular: boolean

      Defines if specular is supported

    • Optional receiveShadows: boolean

      Defines if the effect (mesh) we bind the light for receives shadows

    Returns void

  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable>
  • Will start the animation sequence

    Parameters

    • name: string

      defines the range frames for animation sequence

    • Optional loop: boolean

      defines if the animation should loop (false by default)

    • Optional speedRatio: number

      defines 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)

        • (): void
        • Returns void

    Returns Nullable<Animatable>

    the object created for this animation. If range does not exist, it will return null

  • Specifies if the light will affect the passed mesh.

    Parameters

    Returns boolean

    true the mesh is affected otherwise, false.

  • Returns a new Light object, named "name", from the current one.

    Parameters

    • name: string

      The name of the cloned light

    • Optional newParent: Nullable<Node>

      The parent of this light, if it has one

    Returns Nullable<Light>

    the new created light

  • computeTransformedInformation(): boolean
  • Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light

    Returns boolean

    true if the information has been computed, false if it does not need to (no parenting)

  • computeWorldMatrix(force?: boolean): Matrix
  • Computes the world matrix of the node

    Parameters

    • Optional force: boolean

      defines if the cache version should be invalidated forcing the world matrix to be created from scratch

    Returns Matrix

    the world matrix

  • createAnimationRange(name: string, from: number, to: number): void
  • Creates an animation range for this node

    Parameters

    • name: string

      defines the name of the range

    • from: number

      defines the starting key

    • to: number

      defines the end key

    Returns void

  • Callback defining a custom Projection Matrix Builder. This can be used to override the default projection matrix computation.

    Parameters

    Returns void

  • deleteAnimationRange(name: string, deleteFrames?: boolean): void
  • Delete a specific animation range

    Parameters

    • name: string

      defines the name of the range to delete

    • Optional deleteFrames: boolean

      defines if animation frames from the range must be deleted as well

    Returns void

  • dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void
  • Releases resources associated with this node.

    Parameters

    • Optional doNotRecurse: boolean

      Set to true to not recurse into each children (recurse into each children by default)

    • Optional disposeMaterialAndTextures: boolean

      Set to true to also dispose referenced materials and textures (false by default)

    Returns void

  • forceProjectionMatrixCompute(): void
  • Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.

    Returns void

  • Returns a Vector3, the absolute light position in the World.

    Returns Vector3

    the world space position of the light

  • Get an animation by name

    Parameters

    • name: string

      defines the name of the animation to look for

    Returns Nullable<Animation>

    null if not found else the requested animation

  • Get an animation range by name

    Parameters

    • name: string

      defines the name of the animation range to look for

    Returns Nullable<AnimationRange>

    null if not found else the requested animation range

  • getChildMeshes<T>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[]
  • getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[]
  • Get all child-meshes of this node

    Type parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines 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

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

    an array of AbstractMesh

  • Get all child-meshes of this node

    Parameters

    • Optional directDescendantsOnly: boolean

      defines 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

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns AbstractMesh[]

    an array of AbstractMesh

  • getChildren<T>(predicate?: (node: Node) => node is T, directDescendantsOnly?: boolean): T[]
  • getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly?: boolean): Node[]
  • Get all direct children of this node

    Type parameters

    Parameters

    • 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

        • (node: Node): node is T
        • Parameters

          Returns node is T

    • Optional directDescendantsOnly: boolean

      defines 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)

    Returns T[]

    an array of Node

  • Get all direct children of this node

    Parameters

    • 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

        • (node: Node): boolean
        • Parameters

          Returns boolean

    • Optional directDescendantsOnly: boolean

      defines 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)

    Returns Node[]

    an array of Node

  • getClassName(): string
  • Returns the string "Light".

    Returns string

    the class name

  • getDepthMaxZ(activeCamera: Camera): number
  • Gets the maxZ used for shadow according to both the scene and the light.

    Parameters

    • activeCamera: Camera

      The camera we are returning the max for

    Returns number

    the depth max z

  • getDepthMinZ(activeCamera: Camera): number
  • Gets the minZ used for shadow according to both the scene and the light.

    Parameters

    • activeCamera: Camera

      The camera we are returning the min for

    Returns number

    the depth min z

  • getDepthScale(): number
  • Gets the current depth scale used in ESM.

    Returns number

    The scale

  • getDescendants<T>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[]
  • getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[]
  • Will return all nodes that have this node as ascendant

    Type parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines 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

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

    all children nodes of all types

  • Will return all nodes that have this node as ascendant

    Parameters

    • Optional directDescendantsOnly: boolean

      defines 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

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns Node[]

    all children nodes of all types

  • Gets the engine of the node

    Returns Engine

    a Engine

  • Return the minimum and maximum world vectors of the entire hierarchy under current node

    Parameters

    • Optional includeDescendants: boolean

      Include 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

    Returns { max: Vector3; min: Vector3 }

    the new bounding vectors

  • getScaledIntensity(): number
  • Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.

    Returns number

    the scaled intensity in intensity mode unit

  • Gets the scene the light belongs to.

    Returns Scene

    The scene

  • getShadowDirection(faceIndex?: number): Vector3
  • Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.

    Parameters

    • Optional faceIndex: number

      The index of the face we are computed the direction to generate shadow

    Returns Vector3

    The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true

  • getTypeID(): number
  • Returns the light type ID (integer).

    Returns number

    The light Type id as a constant defines in Light.LIGHTTYPEID_x

  • Returns the latest update of the World matrix

    Returns Matrix

    a Matrix

  • isDescendantOf(ancestor: Node): boolean
  • 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

    Parameters

    • ancestor: Node

      defines the parent node to inspect

    Returns boolean

    a boolean indicating if this node is a descendant of the given node

  • isDisposed(): boolean
  • Gets a boolean indicating if the node has been disposed

    Returns boolean

    true if the node was disposed

  • isEnabled(checkAncestors?: boolean): boolean
  • 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

    Parameters

    • Optional checkAncestors: boolean

      indicates 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

    Returns boolean

    whether this node (and its parent) is enabled

  • isReady(completeCheck?: boolean): boolean
  • Is this node ready to be used/rendered

    Parameters

    • Optional completeCheck: boolean

      defines if a complete check (including materials and lights) has to be done (false by default)

    Returns boolean

    true if the node is ready

  • markAsDirty(property?: string): Node
  • Flag the node as dirty (Forcing it to update everything)

    Parameters

    • Optional property: string

      helps children apply precise "dirtyfication"

    Returns Node

    this node

  • needCube(): boolean
  • Returns whether or not the shadow generation require a cube texture or a 2d texture.

    Returns boolean

    true if a cube texture needs to be use

  • needProjectionMatrixCompute(): boolean
  • Detects if the projection matrix requires to be recomputed this frame.

    Returns boolean

    true if it requires to be recomputed otherwise, false.

  • prepareLightSpecificDefines(defines: any, lightIndex: number): void
  • Prepares the list of defines specific to the light type.

    Parameters

    • defines: any

      the list of defines

    • lightIndex: number

      defines the index of the light for the effect

    Returns void

  • serialize(): any
  • Serializes the current light into a Serialization object.

    Returns any

    the serialized object.

  • serializeAnimationRanges(): any
  • Serialize animation ranges into a JSON compatible object

    Returns any

    serialization object

  • setEnabled(value: boolean): void
  • Set the enabled state of this node.

    Parameters

    • value: boolean

      the new enabled state

    Returns void

  • Sets the shadow projection matrix in parameter to the generated projection matrix.

    Parameters

    • matrix: Matrix

      The matrix to updated with the projection information

    • viewMatrix: Matrix

      The transform matrix of the light

    • renderList: AbstractMesh[]

      The list of mesh to render in the map

    Returns IShadowLight

    The current light

  • toString(fullDetails?: boolean): string
  • Converts the light information to a readable string for debug purpose.

    Parameters

    • Optional fullDetails: boolean

      Supports for multiple levels of logging within scene loading

    Returns string

    the human readable light info

  • transferTexturesToEffect(effect: Effect, lightIndex: string): Light
  • Sets the passed Effect "effect" with the Light textures.

    Parameters

    • effect: Effect

      The effect to update

    • lightIndex: string

      The index of the light in the effect to update

    Returns Light

    The light

  • transferToEffect(effect: Effect, lightIndex: string): Light
  • Sets the passed Effect "effect" with the Light information.

    Parameters

    • effect: Effect

      The effect to update

    • lightIndex: string

      The index of the light in the effect to update

    Returns Light

    The light

  • transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): Light
  • Sets the passed Effect "effect" with the Light information.

    Parameters

    • effect: Effect

      The effect to update

    • lightDataUniformName: string

      The uniform used to store light data (position or direction)

    Returns Light

    The light

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited constructor
  • Static method

Settings

Theme