Sun Shadows getting too dark, tile material not reacting to sun settings properly

I am working on getting a day/night cycle working along side the Google Tileset and am having a problem with the shadows on the tileset. They appear much too dark as the day turns to dusk and all the tiles are pitchblack when the sun is still up providing light.

Other 3D objects I have in the scene are reacting to the light as expected.

By default it seems there is material in the Opaque Material slot in the hierarcy on teh Cesium3DTileset gameobject. Without one, the tileset doesnt respond to any light changes. When i put in the CesiumDefaultTilesmaterial in that spot, the tiles will react to the sun changes, but again, the shadows just come on strong too early.

I noticed there was a fix of some kind searching the forums but it seemed related to just Unreal ( Shadows are too dark ). Was wondering if there could be a similar solution for the Unity version?

In the attached screenshots the buildings you can see when the shadows are dark black are objects that are not part of the tileset, they are imported 3d objects that are reacting to the sun properly.

Google Photorealistic 3D Tiles are actually supposed to be unlit. They contain the KHR_materials_unlit extension, so by default they are loaded using CesiumUnlitTilesetMaterial. The tileset you dragged in, CesiumDefaultTilesetMaterial, is meant for lit tilesets, so the lighting is probably behaving strangely because of missing or unideal parameters.

In short, you shouldn’t use the CesiumDefaultTilesetMaterial for unlit tilesets. We have an option in Cesium for Unreal to ignore the unlit extension, and to generate normals on the tileset, but we don’t currently have a counterpart for it in Unity. A hack you can try is making a copy of CesiumDefaultTilesetMaterial and its shadergraph, and hardcode a normal value that points up at that point on the Earth. If you’re going to move across the world, this approach won’t work because “up” changes across the curvature of the Earth, but it may work if you stay in relatively the same place.

Do you have any plan to implement that in Unity?
I am facing the same issue.

Hi @Maxdepondt,

I just wrote up an issue for this feature on Github. Unfortunately, I don’t have a time estimate for when the team could address it. We would welcome a community contribution if you or others had the bandwidth :slight_smile:


I would love to do that and share with the community but I am not a really good graphics engineer and I don’t think I’d be able to deliver some clean solution.

Update: In Unity using HDRP with Google Tileset, I actually get some nice looking shadows when I use the unlit material.
Lit material shadows are very dense/black while unlit look more natural
So for now I am using Unlit and am happy with that.
I only need to modify the vector for the normals in the unlit material.
I played a bit with the values, found something that seemed to match my location, but I can’t figure out the math behind it.

Hi @Maxdepondt,

Glad you found a workaround!

For the math behind the normals, you might want to calculate an “up” vector that points from the center to the Earth through the location you’re looking at. In script, you can use CesiumGeoreference. TransformUnityPositionToEarthCenteredEarthFixed or CesiumGeoreference.TransformEarthCenteredEarthFixedPositionToUnity to switch between the Unity and Earth-Centered, Earth-Fixed reference systems. The ECEF center of the Earth is (0, 0, 0), so just convert that to a Unity position to compute your normal.

You can read the comments about these functions here.