When a tile goes out of view, there’s really no guarantee it’s going to stay loaded. It’s not visible after all. In Cesium3dTileset, there’s a Maximum Cache Bytes
property that helps control this. The larger it is, the more memory you use, but the more chance that the higher LOD will stick around when it’s not in use
I want to control whether a tile will be loaded or unloaded. We don’t want to unload the tile; it can be culled to save rendering resources, but it should not be unloaded. It might not even need to be culled. This decision will depend on the performance we achieve, as we are targeting Quest2 devices with limited resources.
I aim to create an experience where a user sees a city loaded, and as they pan or move their head, they should not experience the loading and unloading of tiles if they are standing still and just moving their head.
To achieve this, I am considering clamping the maximum and minimum LOD (Level of Detail) for tiles within a spherical area.
Min LOD: The minimum LOD or highest quality for tiles. Currently, quality is distance-based, with closer meshes being of higher quality. However, I want to clamp that quality because, on mobile devices, the highest quality might not be necessary.
Distance: This defines how far meshes will be loaded from the camera. Beyond this distance, I don’t want anything to render. For now, this means not loading the minimum LOD. I am using FarCullDistance from Unreal Engine to cull everything beyond this distance, saving some draw calls and primitives from rendering.
Max LOD: This will be the LOD used for tiles within the defined distance. For example, inside the radius, all tiles should load from Min to Max LOD.
This approach will help maintain a consistent visual experience where distant objects are still visible but at a LOD that I determine to be best. This is because the Screen Space Error (SSE) is degrading the quality of meshes too much at a distance, and when I decrease SSE, the highest quality is too demanding for the device.
Is this solely based on trying to improve performance? Cesium-native doesn’t do this, but it has been considered. Typically tiles that are far away occupy very few pixels, thus need a low level of detail, and don’t really impact performance as much as you might think.
Far Culling Distance might not save much, but on mobile devices, it does provide some benefits, so it would be helpful to have this feature.
Currently, I am using Unreal Engine’s Far Culling Distance. The only problem I have is calculating the height. I use the camera’s world position, convert it to longitude, latitude, and height, and then use that height for the Far Culling Distance.
I have another question related to fog culling. I can’t tell if it’s working. How can I debug this?
Additionally, how can I stop tiles from unloading when they are out of view? I’m checking performance and the overall feel of moving in the world.
What kind of instability are you seeing? Do you see you pawn jitter in some way?
Issues with the pawn position moving away from the origin of the world:
- Gravity does not work correctly because Unreal uses Z-Gravity, so after a certain distance, things look weird. We allow people to fly around the whole world.
- The Niagara component stops working correctly as the world coordinates become very large (this can be fixed using relative space, maybe).
- Similar issues occur with some calculations around IK (this can also be fixed using relative space, maybe).
When I use Origin Shift, it makes the pawn jitter, and I don’t know why this is happening.
Ideally, when flying out of a certain radius from the origin, everything should shift towards the origin. By “everything,” I mean:
- The current pawn position should become the new GeoCentre, bringing the pawn closer to the origin.
- Simulated proxies should also shift by the same distance so that they stay at the same position (longitude and latitude) as they are on the server.
More questions:
We would like to apply the custom implementation ourselves. Please let us know where to find the code for the following:
- Deciding the quality of each tile. We understand you are using SSE, and we will make the necessary changes ourselves.
- Describing the flow to run cesium-native with the Cesium Unreal Plugin so we can debug everything in real-time. Currently, we need to build libraries each time we make any changes to the cesium-native code.
If possible, we would like to do this without CesiumUnreal, but still be able to see the results, debug the code using breakpoints, and visualize the tiles.