Sunset/Sunrise + Night Lighting for Terrains and Models

I’ve been experimenting with loading custom glTF models on top of existing terrain, as well as creating custom terrain, and I’ll eventually be switching to using 3D tiles as well. I’ve enabled shading and shadows, so I can see nice shadows from my models on models and terrain, but I’m looking to adjust the color of the ambient lighting with the time of day (eg, warmer sunsets and sunrises), as well as have darker ambient light at night. From exploring the codebase and this mailing list, it appears that I may need to adjust the shaders used, and/or implement my own. It also appears that some form of this feature may have once existed in Cesium, but was removed for performance reasons, but I’m not sure that the removed functionality was as “simple” as what I’m describing here. Thanks in advance for your help, either with how to enable this with the existing code, or what I’ll need to modify to make this work.

Hey Christopher and Thomas,

If you haven’t already checked out scene.globe.enableLighting, that will show a sunset effect in the atmosphere and will shade the terrain based on the time of day, but only if the terrain has normals like in CeisumTerrainProvider. You can also play around with imagery layer colors like in this demo Imagery Adjustment if you want to change the hue of the terrain.

For models most of the lighting work will have to be done in a custom shader. We don’t have a global ambient color so you will have to determine that in the shader based on the sun direction and the current view position. SkyAtmosphereFS.glsl may give you some ideas for that. Basically there’s no simple answer for models.