Skip to main content
Skip table of contents

Lights

Light sources are important to give your scene an realistic appearance and make them look nice. Adding lights also allows to create shadows. Currently, we support PointLightDirectionalLight and SpotLight. All of them derive from the ShadowLight which defines the following properties (but can’t be instantiated). To get a better understanding of lights and shadows, have a look at https://doc.babylonjs.com/divingDeeper/lights .

Checkout our lights sample to see this in action.

Lights Sample

  • Node

    • ShadowLight (abstract)

      • PointLight

      • DirectionalLight

      • SpotLight

ShadowLight (abstract)

JSON
{
    "type" : "ShadowLight",
    "diffuse" : [ number, number, number ],
    "specular" : [ number, number, number ],
    "intensity" : number,
    "radius" : number,
    "range" : number,
    "shadowMinZ" : number,
    "shadowMaxZ" : number,
    "shadowGenerator" : {
        "mapSize" : number,
        "shadowCasters" : [ string, ... ],
        "usePoissonSampling" : boolean,
        "useExponentialShadowMap" : boolean,
        "useBlurExponentialShadowMap" : boolean,
        "blurScale" : number,
        "blurBoxOffset" : number,
        "useKernelBlur" : number,
        "blurKernel" : number
    }
}

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.shadowlight https://doc.babylonjs.com/typedoc/classes/babylon.shadowgenerator

PointLight

JSON
{
    "type" : "PointLight",
    "position" : [ number, number, number ]
}

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.pointlight

DirectionalLight

JSON
{
    "type" : "DirectionalLight",
    "position" : [ number, number, number ],
    "direction" : [ number, number, number ]
}

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.directionallight

SpotLight

JSON
{
    "type" : "SpotLight",
    "position" : [ number, number, number ],
    "direction" : [ number, number, number ],
    "angle" : number,
    "exponent" : number
}

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.spotlight

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.