PointLight

A point light is a light defined by an unique point in world space. The light is emitted in every direction from this point. A good example of a point light is a standard light bulb. Documentation: https://doc.babylonjs.com/babylon101/lights

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Find examples in Playground
  • Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene. A PointLight emits the light in every direction. It can cast shadows. If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :

    var pointLight = new BABYLON.PointLight("pl", camera.position, scene);

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

    Parameters

    • name: string

      The light friendly name

    • position: Vector3

      The position of the point light in the scene

    • scene: Scene

      The scene the lights belongs to

    Returns PointLight

Properties

animationPropertiesOverride

Find examples in Playground
animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animations

Find examples in Playground
animations: Animation[]

Gets a list of Animations associated with the node

behaviors

Find examples in Playground
behaviors: Behavior<Node>[]

Gets the list of attached behaviors

see

http://doc.babylonjs.com/features/behaviour

customProjectionMatrixBuilder

Find examples in Playground
customProjectionMatrixBuilder: function

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

Type declaration

diffuse

Find examples in Playground
diffuse: Color3

Diffuse gives the basic color to an object.

direction

Find examples in Playground
direction: Vector3

In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback

doNotSerialize

Find examples in Playground
doNotSerialize: boolean

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

excludeWithLayerMask

Find examples in Playground
excludeWithLayerMask: number

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

excludedMeshes

Find examples in Playground
excludedMeshes: AbstractMesh[]

Sets the meshes not impacted by this light.

falloffType

Find examples in Playground
falloffType: number

Defines the falloff type for this light. This lets overrriding 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 usefull for PBR Materials at the moment. This could be extended if required to other types of materials.

id

Find examples in Playground
id: string

Gets or sets the id of the node

includeOnlyWithLayerMask

Find examples in Playground
includeOnlyWithLayerMask: number

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

includedOnlyMeshes

Find examples in Playground
includedOnlyMeshes: AbstractMesh[]

Sets the only meshes impacted by this light.

intensity

Find examples in Playground
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.

intensityMode

Find examples in Playground
intensityMode: 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.

lightmapMode

Find examples in Playground
lightmapMode: number

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

metadata

Find examples in Playground
metadata: any

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

name

Find examples in Playground
name: string

Gets or sets the name of the node

onDispose

Find examples in Playground
onDispose: function

Sets a callback that will be raised when the node will be disposed

Type declaration

    • (): void
    • Returns void

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onReady

Find examples in Playground
onReady: function

Callback raised when the node is ready to be used

Type declaration

    • (node: Node): void
    • Parameters

      Returns void

parent

Find examples in Playground
parent: Nullable<Node>

Gets or sets the parent of the node

position

Find examples in Playground
position: Vector3

Sets the position the shadow will be casted from. Also use as the light position for both point and spot lights.

radius

Find examples in Playground
radius: number

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

range

Find examples in Playground
range: 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.

renderPriority

Find examples in Playground
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.

shadowAngle

Find examples in Playground
shadowAngle: number

Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback This specifies what angle the shadow will use to be created.

It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.

shadowEnabled

Find examples in Playground
shadowEnabled: boolean

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

shadowMaxZ

Find examples in Playground
shadowMaxZ: number

Gets the shadow projection clipping maximum z value.

shadowMinZ

Find examples in Playground
shadowMinZ: number

Sets the shadow projection clipping minimum z value.

specular

Find examples in Playground
specular: Color3

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

state

Find examples in Playground
state: string

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

transformedDirection

Find examples in Playground
transformedDirection: Vector3

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

transformedPosition

Find examples in Playground
transformedPosition: Vector3

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

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique id of the node

worldMatrixFromCache

Find examples in Playground
worldMatrixFromCache: Matrix

Returns directly the latest state of the mesh World matrix. A Matrix is returned.

Static FALLOFF_DEFAULT

Find examples in Playground
FALLOFF_DEFAULT: number

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 FALLOFF_GLTF

Find examples in Playground
FALLOFF_GLTF: number

Falloff gltf: light is falling off as described in the gltf moving to PBR document to enhance interoperability with other engines.

Static FALLOFF_PHYSICAL

Find examples in Playground
FALLOFF_PHYSICAL: number

Falloff Physical: light is falling off following the inverse squared distance law.

Static FALLOFF_STANDARD

Find examples in Playground
FALLOFF_STANDARD: number

Falloff Standard: light is falling off like in the standard material to enhance interoperability with other materials.

Static INTENSITYMODE_AUTOMATIC

Find examples in Playground
INTENSITYMODE_AUTOMATIC: number

Each light type uses the default quantity according to its type: point/spot lights use luminous intensity directional lights use illuminance

Static INTENSITYMODE_ILLUMINANCE

Find examples in Playground
INTENSITYMODE_ILLUMINANCE: number

lux (lm/m^2)

Static INTENSITYMODE_LUMINANCE

Find examples in Playground
INTENSITYMODE_LUMINANCE: number

nit (cd/m^2)

Static INTENSITYMODE_LUMINOUSINTENSITY

Find examples in Playground
INTENSITYMODE_LUMINOUSINTENSITY: number

candela (lm/sr)

Static INTENSITYMODE_LUMINOUSPOWER

Find examples in Playground
INTENSITYMODE_LUMINOUSPOWER: number

lumen (lm)

Static LIGHTMAP_DEFAULT

Find examples in Playground
LIGHTMAP_DEFAULT: number

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 LIGHTMAP_SHADOWSONLY

Find examples in Playground
LIGHTMAP_SHADOWSONLY: number

material.lightmapTexture as only lighting no light calculation from this light only adds dynamic shadows from this light

Static LIGHTMAP_SPECULAR

Find examples in Playground
LIGHTMAP_SPECULAR: number

material.lightmapTexture as only diffuse lighting from this light adds only specular lighting from this light adds dynamic shadows

Static LIGHTTYPEID_DIRECTIONALLIGHT

Find examples in Playground
LIGHTTYPEID_DIRECTIONALLIGHT: number

Light type const id of the directional light.

Static LIGHTTYPEID_HEMISPHERICLIGHT

Find examples in Playground
LIGHTTYPEID_HEMISPHERICLIGHT: number

Light type const id of the hemispheric light.

Static LIGHTTYPEID_POINTLIGHT

Find examples in Playground
LIGHTTYPEID_POINTLIGHT: number

Light type const id of the point light.

Static LIGHTTYPEID_SPOTLIGHT

Find examples in Playground
LIGHTTYPEID_SPOTLIGHT: number

Light type const id of the spot light.

Methods

addBehavior

Find examples in Playground

beginAnimation

Find examples in Playground
  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: function): 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: function

      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

canAffectMesh

Find examples in Playground

clone

Find examples in Playground
  • Returns a new Light object, named "name", from the current one.

    Parameters

    • name: string

      The name of the cloned light

    Returns Nullable<Light>

    the new created light

computeTransformedInformation

Find examples in Playground
  • computeTransformedInformation(): boolean

computeWorldMatrix

Find examples in Playground
  • computeWorldMatrix(force?: boolean): Matrix

createAnimationRange

Find examples in Playground
  • createAnimationRange(name: string, from: number, to: number): void

deleteAnimationRange

Find examples in Playground
  • 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

Find examples in Playground
  • 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

Find examples in Playground
  • forceProjectionMatrixCompute(): void

getAbsolutePosition

Find examples in Playground

getAnimationByName

Find examples in Playground

getAnimationRange

Find examples in Playground

getBehaviorByName

Find examples in Playground

getChildMeshes

Find examples in Playground
  • getChildMeshes(directDescendantsOnly?: boolean, predicate?: function): 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

    • Optional predicate: function

      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

getChildTransformNodes

Find examples in Playground
  • getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: function): TransformNode[]
  • Get all child-transformNodes 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

    • Optional predicate: function

      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 TransformNode[]

    an array of TransformNode

getChildren

Find examples in Playground
  • getChildren(predicate?: function): Node[]
  • Get all direct children of this node

    Parameters

    • Optional predicate: function

      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[]

    an array of Node

getClassName

Find examples in Playground
  • getClassName(): string

getDepthMaxZ

Find examples in Playground
  • getDepthMaxZ(activeCamera: Camera): number

getDepthMinZ

Find examples in Playground
  • getDepthMinZ(activeCamera: Camera): number

getDepthScale

Find examples in Playground
  • getDepthScale(): number

getDescendants

Find examples in Playground
  • getDescendants(directDescendantsOnly?: boolean, predicate?: function): Node[]
  • 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: function

      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

getEngine

Find examples in Playground

getRotation

Find examples in Playground

getScaledIntensity

Find examples in Playground
  • getScaledIntensity(): number

getScene

Find examples in Playground

getShadowDirection

Find examples in Playground
  • getShadowDirection(faceIndex?: number): Vector3
  • Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).

    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

getShadowGenerator

Find examples in Playground

getTypeID

Find examples in Playground
  • getTypeID(): number

getWorldMatrix

Find examples in Playground

isDescendantOf

Find examples in Playground
  • 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

Find examples in Playground
  • isDisposed(): boolean

isEnabled

Find examples in Playground
  • 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

Find examples in Playground
  • 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

needCube

Find examples in Playground
  • needCube(): boolean
  • Specifies wether or not the shadowmap should be a cube texture.

    Returns boolean

    true if the shadowmap needs to be a cube texture.

needProjectionMatrixCompute

Find examples in Playground
  • needProjectionMatrixCompute(): boolean

prepareLightSpecificDefines

Find examples in Playground
  • prepareLightSpecificDefines(defines: any, lightIndex: number): void

removeBehavior

Find examples in Playground

serialize

Find examples in Playground
  • serialize(): any

serializeAnimationRanges

Find examples in Playground
  • serializeAnimationRanges(): any

setDirectionToTarget

Find examples in Playground

setEnabled

Find examples in Playground
  • setEnabled(value: boolean): void

setShadowProjectionMatrix

Find examples in Playground

toString

Find examples in Playground
  • 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

transferToEffect

Find examples in Playground
  • Sets the passed Effect "effect" with the PointLight transformed position (or position, if none) and passed name (string).

    Parameters

    • effect: Effect

      The effect to update

    • lightIndex: string

      The index of the light in the effect to update

    Returns PointLight

    The point light

Static AddNodeConstructor

Find examples in Playground

Static CompareLightsPriority

Find examples in Playground
  • CompareLightsPriority(a: Light, b: Light): number
  • Sort function to order lights for rendering.

    Parameters

    • a: Light

      First Light object to compare to second.

    • b: Light

      Second Light object to compare first.

    Returns number

    -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.

Static Construct

Find examples in Playground
  • Construct(type: string, name: string, scene: Scene, options?: any): Nullable<function>
  • Returns a node constructor based on type name

    Parameters

    • type: string

      defines the type name

    • name: string

      defines the new node name

    • scene: Scene

      defines the hosting scene

    • Optional options: any

      defines optional options to transmit to constructors

    Returns Nullable<function>

    the new constructor or null

Static GetConstructorFromName

Find examples in Playground
  • GetConstructorFromName(type: number, name: string, scene: Scene): Nullable<function>
  • Creates 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.

    Parameters

    • type: number

      Type according to the types available in Light.LIGHTTYPEID_x

    • name: string

      The friendly name of the light

    • scene: Scene

      The scene the new light will belong to

    Returns Nullable<function>

    the constructor function

Static Parse

Find examples in Playground
  • Parses the passed "parsedLight" and returns a new instanced Light from this parsing.

    Parameters

    • parsedLight: any

      The JSON representation of the light

    • scene: Scene

      The scene to create the parsed light in

    Returns Nullable<Light>

    the created light after parsing

Static ParseAnimationRanges

Find examples in Playground
  • ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void
  • Parse animation range data from a serialization object and store them into a given node

    Parameters

    • node: Node

      defines where to store the animation ranges

    • parsedNode: any

      defines the serialization object to read data from

    • scene: Scene

      defines the hosting scene

    Returns void

Generated using TypeDoc