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

Collision mesh doesn't get culled at low LODs #1395

Closed KieranCoppins closed 2 months ago

KieranCoppins commented 3 months ago

When using the cartographic polygon to cut out a section of the 3d tiles, at low levels of detail (being zoomed out) the collision mesh is still apparent over the cut out area. However, the visual mesh remains to be cut out. I have tried to depict what is happening in the images below:

Visually Cut out section close up: image

Visually Cut out section zoomed out: image

Player collision close up (You can see the grids spilling into the polygon already): image

Player collision zoomed out (the entire area is now filled) image

System Details: Unreal Engine 5.3.2 Cesium For Unreal 2.3 Using Googles's 3d tiles API to stream google 3d tiles

csciguy8 commented 3 months ago

Hi @KieranCoppins , thanks for the screenshots.

From what I'm reading, are you expecting the Cartographic polygon to have an effect on the collision mesh?

Cartographic polygons currently only affect the visual aspect of geometry, not any of the physics geometry.

This tutorial mentions it briefly... image

KieranCoppins commented 2 months ago

Hi @csciguy8, thanks for your response, sorry I took so long to get back to you!

I see, well it appears that the cartographic polygon does cull out the physics mesh but it doesn't do so accurately at high zoom levels. Is there a plan in the future to make the physics mesh match the graphical mesh we are seeing?

Our use case is using google 3d tiles but replacing some buildings with 3d models by cutting out the 3d tiles and placing a static mesh actor in the level.

j9liu commented 2 months ago

Hi @KieranCoppins,

The reason that you see some "culling" of physics meshes is because of the Exclude Selected Tiles setting. When this is enabled, any tiles that fall completely inside the polygon will not even be loaded in the first place. So that's why they seem "culled" -- they don't even load.

The trickier part is when tiles fall both inside and outside the polygon. For that crisp polygon-edge clipping effect, we visually hide the tile portions that are inside the polygon. But we don't do any modifications to the actual geometry, so you'll still get collisions for those tiles.

Unfortunately, geometry clipping is a nontrivial feature, especially when considering runtime streaming and performance. We're definitely aware of the value of geometry clipping for various use cases, so we have an issue open for it at #1300. I can't give you a time estimate for this feature, but we'll post any and all updates on our progress to that issue!

Since this is expected behavior from the plugin, I'm going to close this issue. Feel free to use that other issue to add a +1 or share your needs / use cases. Thank you!