cesium-unity icon indicating copy to clipboard operation
cesium-unity copied to clipboard

Cesium Moon Terrain: Rendering issue related to Smooth normals calculation (Unity 6.1, Standard Rendering Pipeline)

Open petriw opened this issue 6 months ago • 4 comments

I have an issue where the tiles are having a strange diffuse light issues when the angle between the tile and the sun is steep.

My game is a Space Flight Simulator where I use Cesium Moon Terrain to render the lunar surface. When I am on the "day" side of the Moon, everything looks great. However, when I approach the dark side of the Moon, I see the tile squares and broken normal calculations (my assumption).

I am using the latest Cesium version, the Standard Rendering Pipeline, and the latest Unity 6.1 version. However, I had the same issue with the Cesium release from last summer and Unity 2022 (Standard Rendering Pipeline).

I have a short video of the issue here: https://www.youtube.com/watch?v=sLOnm7En9S4

If I toggle off the Generate Smooth Normals, everything looks good but it does not take the position of the sun into the account of course, leaving a fully lit Moon.

If I set the LOD: Maximum Screen Space Error to 1 or 2, the issue goes away for the fully downloaded tiles, while visible on the rest with a lower LOD. Anything larger and the issue is always visible.

This is another video where use the Inspector in the editor to tweak the various Cesium parameters during the "evening" side of the Moon: https://www.youtube.com/watch?v=QrM_iw8s9NI

Note: At 2:43 in this video where the Moon becomes bright and the issue disappears, I use the in-game console to move the sun to display that it works well in full daylight.

petriw avatar Jul 14 '25 12:07 petriw

Thanks for writing up this detailed report, @petriw ! This may or may not be related to #587, we'll see if addressing that issue also fixes this one.

j9liu avatar Jul 28 '25 19:07 j9liu

Ok, thank you - let's see if it helps, let me know when I can give it a try.

petriw avatar Jul 31 '25 12:07 petriw

Hi! What is the latest update on this issue? :) @j9liu

petriw avatar Sep 03 '25 07:09 petriw

Hi @petriw,

We're currently refactoring our normal-generation code to produce more accurate normals, both flat and smooth. (#596 is a start.) But there have been more complications than we expected. We think some of the inaccuracy may be a result of not generating tangents for the models, and that requires adding extra functionality that we didn't anticipate. But we'll keep this issue updated with our progress once we figure it all out.

j9liu avatar Sep 03 '25 13:09 j9liu

I believe this is solved by using the "Ignore KHR_materials_unlit" setting instead (introduced with #595). If this is a still an issue, though, please reopen later!

j9liu avatar Dec 01 '25 21:12 j9liu