Hello,
I’m trying to display up to 50k trees based locations from geojson.
I managed to display the trees on CesiumTerrain with new cesium feature SampleHeightMostDetailed. But It is not optimal at all, because I’m spawning each tree in a for loop with SpawnActor and adding GlobeAnchor and then moving it to location that I get from SampleHeightMostDetailed by MoveToEarthCenteredEarthFixedPosition.
One of the solution could be InstacedStaticMesh. But how to attach a GlobeAnchor to each instance? Or is there any other solution?
I have red that you added support for Instanced 3D Meshes (I3DM) and the glTF EXT_mesh_gpu_instancing extension in the version 2.6.0. But I could not find anything else.
I agree that having 50k objects with globe anchors is not the most optimal, and might affect performance.
InstancedStaticMesh seems like a plausible solution, though I haven’t tried it myself. Perhaps you can convert the globe-relative positions from SampleHeightMostDetailed to positions in Unreal. Then, you can position all of the instances relative to each other in Unreal space. Finally, you could use a single Cesium Globe Anchor on the mesh as a whole, so that the instances stay positioned relative to each other while still accommodating the changes in Unreal space.
For loading I3DMs / glTFs with the EXT_mesh_gpu_instancing extension, the trees would have to be streamed as 3D Tiles. Cesium ion offers a “3D Buildings Tiler” that can convert KML with glTF references to instanced tilesets. If you can convert your GeoJson to such a KML file, then you should be able to produce an instanced tileset with those trees!
Let us know if you have any follow-up questions or concerns
How would you convert the globe-relative positions from SampleHeightMostDetailed to positions in Unreal? Does Cesium have some build in function for that? I was looking for it, but could not find it. I could use some known conversion methods but it could have a large errors in some areas of the globe.