I have an InstancedStaticMeshComponent in which I create 10.000 instances of a cube. It renders really fast and so far everything is fine. However changing the transform of the InstancedStaticMeshComponent itself (which subsequently moves the 10.000 cubes of course) is really slow.
I assume that internally it updates the transform of each instance instead of supplying the InstancedStaticMeshComponent-transform along with the instance-transforms to the vertexshader to have quick global movement of all instances.
EDIT: checking the sources my guess seems correct…
It sounds like you might be trying to do a voxel game. You are going to want to extend the landscape class or write your own voxellandscape to see any kind of real performance.
Usually games with voxels only actually render the outermost facing faces of a given “chunk” of voxels, and only render a select field of chunks.
You are correct that updating the transform of 10k meshes is going to be stressful. If it can’t be avoided, why move the entire world? Move the player - they won’t know the difference
No, I need this to draw a graph with thousands of nodes (which I wanted to use the instanced mesh for) and edges (another instanced mesh). However this graph needs to be transformable, and that’s where the problem starts when this parent transform is not done directly in the VS.
And I can not move the player instead as there are other elements in the scene besides the graph.
Use hierarchical instanced static mesh for this kind of stuff. It’s faster and has per object culling and lodding. For transform you can use Material collection and then at material just use worldposition offset.
Disable “Collision > Generate Overlap Events” in (Hierarchical) Instanced Static Mesh component
(it works wonders, really! 130ms to 8ms per frame in my last case )