CesiumGS / cesium-unreal

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

Weird occlusion culling problem #1288

Open kring opened 1 year ago

kring commented 1 year ago

Originally reported on the community forum: https://community.cesium.com/t/tiles-constantly-glitching-in-certain-zones/27648

In this one particular spot, near latitude 49.9889 longitude -113.410537, there's a very strange flickery visual glitch in Cesium World Terrain when you move the camera in close to the surface. The problem goes away when the Cesium3DTileset Actor is selected. It also goes away when you turn off Unreal's Occlusion Culling (Edit->Project Settings->Engine->Rendering->Culling).

I believe what is happening is that Unreal is changing its mind every other frame about whether or not these tiles are occluded. So one frame they're rendered, the next they're not, and so on. If you do r.VisualizeOccludedPrimitives 1 in the console, Unreal highlights these flickery tiles in green, indicating that they are occluded (at least some of the time):

image

This is with "Suspend Update" enabled, so I don't think there's any possibility that we're accidentally toggling the tile's visibility on and off.

I have no idea what's causing this occlusion ping-pong, though. Seems like it kind of has to be an Unreal Engine bug, but hard to say for sure. I tested with UE 5.1.1.

occlusion-culling-artifact

j9liu commented 6 months ago

I can't actually seem to reproduce this on 5.2, 5.3 or 5.4. I made sure that Occlusion Culling was turned on, and I zoomed around the area for a while, but could never see that flickering. Toggling Suspend Update didn't make a difference.

If someone else wants to gut check for me whether or not they can see it, definitely feel free. But it may have just been resolved with newer versions of Unreal.

j9liu commented 6 months ago

I wonder if this is the same / similar problem to https://github.com/CesiumGS/cesium-unreal/issues/914?

Though, people on that thread have reported having the problem in 5.2 and 5.3. I downloaded one of the users' datasets but I still can't reproduce the problems myself. 🤔

kring commented 6 months ago

It's probably worth seeing if we can still reproduce this in 5.1, because if we can, and then we can't in 5.2, that would drastically increase my confidence that it was fixed in 5.2. I still have 5.1 installed, so I'll try it before I uninstall it.

kring commented 6 months ago

I can still reproduce this in UE 5.1.1. It took me a little bit of flying around to get it to happen, though. I'll try 5.2 next.

kring commented 6 months ago

It still happens in UE 5.4.1, too. image

j9liu commented 6 months ago

Hm I still can't reproduce this error on my machine, regardless of engine version. And I tried this too on our office desktop, on 5.1 No dice.

I'm going to the specified long / lat and am flying around, trying to find flickering tiles. Is this what you're doing, too? Is there a particular place that is more problematic than others?

Maybe this is a hardware issue? I know you have an AMD GPU, but both my laptop + our office desktop use NVidia GPUs.

kring commented 6 months ago

Maybe this is a hardware issue? I know you have an AMD GPU, but both my laptop + our office desktop use NVidia GPUs.

I have an Intel Arc A750. I'll see if I can reproduce it on my laptop with a NVidia GTX 1650.

kring commented 6 months ago

It's not as obvious on the GTX 1650, but there's still some flickering weirdness going on at that location. Even without moving the camera, tiles near the edges and occassionally right in the middle flicker on and off. Just like on my other system, turning off Occlusion Culling or selecting the Cesium3DTileset in the outliner makes the problem go away.

https://github.com/CesiumGS/cesium-unreal/assets/924374/89a36bc8-4416-462f-9e1d-f2bea626132b