Dark models depending on time of day

We discovered that our models appear very dark depending on the time of day. I’ve attached a few screen captures to demonstrate. The difference is not in the specific texture… all of the textures have the same appearance. And all of the aircraft/textures appear normal/bright during the day but very dark at night.

The dark appearance seems to be related to my local time. Right now (2am in Texas) the models appear very dark in the US. But if I look at models in the UK they appear normal/bright.

How can I turn this effect off so that the models are normal/bright all the time?

We have set the following parameters, but still have this affect:
scene.globe.enableLighting = false;
scene.globe.showNight = false;
scene.globe.showDay = false;
scene.globe.affectedByLighting = false;

This image shows the model/texture as it should be:
normal

The following images show the dark appearance:
dark1
dark2

Thanks,
Rob

It’s probably not the case that the models are dark “in general”, but only when viewn from a certain direction (at a respective time). The effect can also be observed in the basic 3D Models Sandcastle at Cesium Sandcastle : When dragging the time-slider at the bottom, one can see that the plane is dark at some times. This is caused by the fact that the default light of the scene defaults to the light from the sun - and … well, at night, things tend to be dark.

(Unless you rotate the view, and see the plane from the bottom - the globe does not really cast a shadow, so to speak).

The proper solution depends on the exact requirements. A very simple, “static” solution would be to just use a fixed directional light (instead of the sunlight) - in the sandcastle, this could be

viewer.scene.light = new Cesium.DirectionalLight({
  direction : new Cesium.Cartesian3(0, 0.7, -0.5)
});

The direction might depend on the location of your model on the globe. If that changes, or there are multiple models, you could consider different options. A “generic” one could be to use the “flashlight” approach that is shown in Cesium Sandcastle : It sets up a directional light and adds a scene.preRender.addEventListener callback that updates the direction of this light, based on the camera direction, in each frame. Applied to the 3DModels example with the plane:

viewer.scene.light = new Cesium.DirectionalLight({
  direction: viewer.scene.camera.directionWC,
});
viewer.scene.preRender.addEventListener(function (scene, time) {
  viewer.scene.light.direction = Cesium.Cartesian3.clone(
    viewer.scene.camera.directionWC,
    viewer.scene.light.direction
  );
});

This way, the light direction will always be along the view direction of the camera, and the model should always appear bright.

3 Likes

Marco13, thank you for the detailed response. We will have to think about what approach would work best for our scenario.

Thanks again for your help!

HI! Rob, Have you solved the problem yet?

You may also find that some models appear dark when the lighting is overhead. I’ve found this happens if the model doesn’t have any normal’s defined and is especially noticeable if it has a white texture. A quick fix I’ve found for this is to open the model in Blender, go to shading, and add a RGB color to the normal of the Principal BSDF texture. For the RGB, set red to 0.5, green to 0.5, and blue to 1. This will give your model a flat normal.