Custom lights scene?

Hi,

There appears to be a Directional light that can be added to the scene. What is the best way to add the light? The below snippet errors out on the last line with “Uncaught TypeError: viewer.scene.addLight(light) is not a function”

const light = new Cesium.DirectionalLight({
    direction: Cesium.Cartesian3.normalize(new Cesium.Cartesian3(1, -1, -1), new Cesium.Cartesian3()),
    color: Cesium.Color.WHITE,
    intensity: 100
  });

viewer.scene.globe.enableLighting = true;
viewer.scene.addLight(light);

I thought it may be because Im using an older version of Cesium but Im sourcing the 1.83 build straight from my html file.

Thanks in advance

1 Like