CesiumGS / cesium-unreal

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

Dynamic Activate and Deactivate of CesiumRasterOverlay layers can cause tiles fail to be properly removed during the rendering frame tick. #1448

Open DevElves opened 3 months ago

DevElves commented 3 months ago

To achieve dynamic switching of raster layers, we call the Activate/Deactivate CesiumRasterOverlay layer function at runtime to show or hide specified layers in real-time. This feature worked perfectly in version v1.23. However, after we recently upgraded the Cesium for Unreal version to the latest (v2.5.0), we found that when switching the raster layers while moving the camera, some tiles fail to be properly removed during the rendering frame, causing them to overlap with newly loaded tiles. image

https://github.com/CesiumGS/cesium-unreal/assets/57782609/59a8af15-6b18-4c95-9f74-add39f4125eb

The test level blueprint is shown below: image

Upon a preliminary examination of the source code, we discovered that in Cesium3DTileset.cpp, the calls to this->_pTileset->updateView and pResult->tilesToRenderThisFrame during the Tick are interfered by the dynamic switching of layers. Tracing to Tileset.cpp, the following code where traversalDetails.allAreRenderable=false when dynamically enabling/disabling layers, which kicks all child nodes, resulting in pResult->tilesToRenderThisFrame.size()=1. This causes confusion in the hideTiles() function during the Tick in Cesium3DTileset.cpp. image

Although we have roughly identified the cause, we are unsure how to fix this issue, so we would appreciate your help in reviewing it. Thank you very much. (Please see the attached video for the bug test recording.)

j9liu commented 6 days ago

Hi @DevElves,

I apologize that no one responded to this ticket. Do you still see this issue on the latest release of Cesium for Unreal?