Hey guys!
I’m working on a project where I want to render a huge amount (multi-million) of primitives (e.g. quads) in the unreal engine. I started using the InstancedStaticMeshComponent and it looks really promising. But when I add a lot of instances, calling the “AddInstance”-method for every instance really slows down the whole thing. Therefore I was wondering if I could basically allocate/initialize all instances at once (they actually all have the same position, orientation, material, etc.), but they don’t get rendered.
Does anyone know how to achieve this? Any help would be much appreciated!
My current state (not working):
x = new FStaticMeshInstanceData(true, false);
x->AllocateInstances(pointCount, true);
StreamComponent->InitPerInstanceRenderData(false, x);
StreamComponent->PerInstanceRenderData->UpdateFromPreallocatedData(StreamComponent, *x, true);
StreamComponent->PerInstanceRenderData->InitResource();
StreamComponent->MarkRenderStateDirty();