Day–Night Cycle with Night Light Tiles in Cesium for Unreal

Hey guys, I’m working on implementing a day–night cycle for Earth in my Unreal Engine application using Cesium. My goal is to display night light tiles in regions experiencing nighttime.

I noticed that CesiumJS – Earth at Night has a similar feature: when “Dynamic Lighting” is enabled, it displays day tiles in daylight areas and night tiles in nighttime areas.

Is it possible to achieve this same effect in Cesium for Unreal Engine?

Hi,

There’s no built-in feature to do this, but I think it could be done with a custom Material.

First, create two raster overlays, one with your day imagery and the other with the night imagery. Set the Material Layer Key of one of them to Overlay1. At this point that second one will display on top of the first one everywhere on the globe.

Now, find MI_CesiumThreeOverlaysAndClipping material instance included with the Cesium for Unreal plugin, and copy it into your project. You can use the Unreal Content Browser to do this, but you’ll need to make sure “Show Plugin Content” and “Show Engine Content” are enabled (press the gear in the top right corner). Select your new material instance as the “Material” property.

Edit the copy. You’ll see several material layers. You’ll want to edit the “Material Layer Blend” that is associated with the Overlay1 layer. So once again, go find that MLB in the Content Browser, copy it into your project, and then select the copy as the blend for the Overlay1 material layer in your copied material instance.

Finally, the trickiest part. You’ll need to edit the copied MLB to blend between the top and bottom layers according to the time of day. You should be able to use the SkyAtmosphereLightDirection node to get the sun direction and use that to decide where this pixel lies in the day/night transition.

Thanks @Kevin_Ring , For the solution. It helped a lot.