75k cubes choking my 3080??

Not sure this is the perfect category, but anyway… I need some advice.

I’m playing with some fluid simulation code (just using cubes). I mocked up a prototype in Javascript and WebGL because I’m familiar with it and I can create prototypes quickly. In my JS prototype, I was creating 20,000 cubes and it was running fine… even with the math running on tick. My guess was going to UE5 would be approximately 10-20x faster. But in my mock up in UE5, I’m creating 75,000 cubes, and it’s choking hard… like 2-3 FPS. And I’m not even doing any math yet, simply placed the cubes randomly.

I was anticipating having to mitigate a CPU bottleneck for the tick math, which I can figure out ways to optimize likely… but I was not expecting such terrible performance simply viewing the cubes.

I’m spawning them all in C++. I have a GTX 3080 card btw. I see plenty of videos of people with seemingly millions of polys on screen and UE5 is running smoothly. What the heck am I missing here? Is that just because they are using instanced meshes and those are THAT much faster? I’m under the impression I can’t use instances because I need to be able to control position independently.

I’m a complete UE5 newbie, so I could be missing something.

a) all actors have tick enabled by default, so you would have 75000 ticks running.

b) separate actors account for separate drawcalls so it’s not optimal. Either you need to batch them or instance them.

c) Look into the Hierarchical Instance Static Mesh component (uses LOD) or Instance Static Mesh (doesn’t use LOD but has better culling)

d) Read up on threading (FRunnable) to at least do calculations on a different thread (final transform updates need to be made on Game thread though)

Edit a quick HISM test


running on my old 1050ti, seeing as your 3080 is roughly +539% faster it should handle this without breaking a sweat.
Though the generation time can take a bit perhaps it can be offloaded to a thread (at least building the offset transforms for the instances)

2 Likes

I have disabled each cubes tick and collision already. Glad to see you running 30FPS with 250k cubes, that’s more like what I expected.

Thank you for the advice, I will investigate your suggestions. However, I was under the impression I cannot use static mesh instances, or HISM because I need to manipulate each cube’s location. I didn’t think either of those options can move independently, but perhaps I am wrong, I will research.

I was planning on implementing threading when I start doing math, but have not gotten that far yet since it’s so slow simply rendering.

You can update the transforms of each instance in ism/hism via there index.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.