Light sources are important to give your scene an realistic apperance 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 instanciated). 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.

  • Node

    • ShadowLight (abstract)

      • PointLight

      • DirectionalLight

      • SpotLight

ShadowLight (abstract)

{
    "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
    }
}
JSON

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

PointLight

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

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

DirectionalLight

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

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

SpotLight

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

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