CesiumGS / cesium-unreal

Bringing the 3D geospatial ecosystem to Unreal Engine
https://cesium.com/platform/cesium-for-unreal/
Apache License 2.0
885 stars 286 forks source link

White pixel flickering artifacts with "DitherFade" material layer #1388

Closed j9liu closed 1 month ago

j9liu commented 3 months ago

This may be related to #1104, but that issue is about seeing temporal dithering artifacts with forward rendering + AA. There are actually dithering artifacts that happen with temporal rendering.

Reported on the forum here. The user sees bright white pixels flickering throughout the tileset, which are especially visible when the lighting is dark. This is with:

To reproduce the view, set the georeference to Latitude: 59.908135 Longitude: 10.721472 Height: 99.238093

image ( Zoom in to see more clearly. From a distance it will look like you have dust on your computer. :') )

The workaround was to delete the "DitherFade" material layer from the default tileset material.

One action item is to test if the plugin version matters, since the user says it worsened with time. Engine version may matter too.

csciguy8 commented 3 months ago

Sounds very much like, https://github.com/CesiumGS/cesium-unreal/issues/1359

j9liu commented 2 months ago

Trying to do some experimentation to resolve this issue. I made some test modifications to our ML_DitherFade Blueprint.

From what I understand, the "Fade Percentage" seems to roughly translate to the intended opacity of the tile, or the amount that the tile has faded in. I noticed that even when the Fade Percentage is 1.0, it still goes through the "Dither Temporal AA" block, which causes the flickering. Indeed when I hardcode the opacity mask to be 1.0, that flickering goes away.

So with that in mind, I tried to catch when the percentage is 1.0. If it is, I hardcode the opacity mask to 1.0

image

This does remove the flickering at the highest level of detail. But unfortunately, it impacts the transitions themselves, making them look a lot less smooth. (Between multiple levels of detail you can see clear "jumps" where that percentage is 1.0).

So I don't know what the fix is 😅 Ideally, that "Dither Temporal AA" block wouldn't apply dithering if the fade percentage was zero. I'll keep digging

j9liu commented 2 months ago

I noticed an interesting comment in "Dither Temporal AA"...

image

So I tried something silly by inverting the fade percentage (using a 1 - x node) ... and it weirdly works? The tilesets no longer flicker at the highest level of detail! This is true regardless of whether Enable LOD Transitions is true.

For the acutal transitions, I can't tell the difference between the previous implementation and mine. But maybe I've been staring at this for too long. :sweat_smile: