The LightingEffect
applies ambient, point and directional lighting to layers which support material property.
<iframe height="450" width="100%" scrolling="no" title="deck.gl LightingEffect Demo" src="https://codepen.io/vis-gl/embed/ZZwrZz/?height=450&theme-id=light&default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true">
See the Pen deck.gl LightingEffect Demo by vis.gl
(@vis-gl) on CodePen.
</iframe>
new LightingEffect({light0, light1, light2, ...});
Parameters:
lights
(object) - a collection of light sources. Keys can be any arbitrary name and values.
An AmbientLight source which illuminates all the objects equally.
- Default: ambient light source with color =
[255, 255, 255]
and intensity =1.0
Array of DirectionalLight source which emits from a specific directions.
- Default: two directional light sources
Light Source | Color | Intensity | Direction | _shadow |
---|---|---|---|---|
1 | [255, 255, 255] | 1.0 | [-1, -3, -1] | false |
2 | [255, 255, 255] | 0.9 | [1, 8, -2.5] | false |
- For rendering experimental shadow effect,
_shadow
prop of DirectionalLight must be set totrue
. The effect can be toggled on and off for a layer by setting layer'sshadowEnabled
prop.
Array of PointLight source which emits from a point in all directions.
- Default:
[]
- Only one ambient light is supported.
- Point light position uses the same coordinate system as view state.