I am using the Google Maps Tileset. I was trying to get a day a night cycle hooked up for my game and noticed the lit shader wouldn’t render the terrain properly at different sun angles. Notice the orange glow of the directional light never hits the Cesium terrain, but it does the other 3d objects like the platform:
It appears the normals on the terrain are not facing up? or something of that sort? Anyways, I then tried the “Generate Smooth Normals” option, which worked, but now I get tiling artifacts, especially during sunset / sunrise. Is there anyway to reduce the tiling artifacts. Perhaps just have the normals face up, instead of “smooth”?
That sounds like expected behavior. CesiumUnlitTilesetShader doesn’t generate normals since we can take advantage of the Unlit rendering mode in Unity. But I think you can use CesiumDefaultTilesetShader to cause normals to be generated for Google Photorealistic 3D Tiles. If you disable Generate Smooth Normals, the resulting normals that get generated should be flat.
(Definitely let us know if this doesn’t work – after switching environments, I don’t have Unity set up yet to try this myself. )
So the CesiumDefaultTilesetShader doesn’t fix the issue because the normals generated by the Google Photorealistic 3D tiles are not correct. I think it depends where you are on earth, that determines what way the normals are facing. So If I generate the terrain at the Hawaii coordinates Lat: 21.3115 Lon: -157.6625 then the normals are not facing up. If I set the time to say 4pm, then the normals don’t recieve any light. If I set the time to 9am they receive full light from the directional light. A good way to test it is to turn off the environmental lighting Intensity Multiplier to 0 to see how the directional light is hitting the terrain. Depending where you are on Earth the lighting is always usually wrong.
Lucky I found a work around that seems to work. I created a shader that has “No Ramp” style applied to the shader using Toony Colors Pro addon. I then turn on the “Generete Smooth Normals” option. The new shader then removes the “shadows / shading” ramp effect on the terrain and there are no tiling artifacts. And tiles have correct normals on them and lighting is correct at all times of day.
My suggestion would be to update the CesiumDefaultTilesetShader to remove “Ramp” shading from it. Also the CesiumDefaultTilesetShader is pretty expensive on mobile and should be more optimized. The shader I generated with Toony Colors pro increase frame rate to double and is same performance as the “Unlit” shader but is “Simple Lit”.
Thanks for letting us know @5DRealities! I’m sorry the initial solution didn’t work, but I’m glad you found a workaround.
My suggestion would be to update the CesiumDefaultTilesetShader to remove “Ramp” shading from it. Also the CesiumDefaultTilesetShader is pretty expensive on mobile and should be more optimized. The shader I generated with Toony Colors pro increase frame rate to double and is same performance as the “Unlit” shader but is “Simple Lit”.
We definitely acknowledge that the default shader is fairly complex – this is true for our Unreal materials too. We try to support a variety of features out-of-the-box so that new users have an easy time doing things like adding multiple raster overlays, or using polygon clipping.
However, you’re welcome to make more performant copies of the material, and we highly encourage users to do so to meet their needs! For instance, when we were testing Cesium for Unity on the Quest, we found that performance removed when we removed unnecessary raster overlay variables from the material. Edits like that may help in your case as well.