Optimizing Draw Calls

I’ve been working on a project and recently the lag in the project has been getting really frustrating.

I’ve decided to turn on stat units and realized that my draw calls and game stat are quite high. I’ve been getting around 30ms to 50ms for draw calls and 10ms to 50ms game stat.

My scene has a lot of static meshes and unique materials which would be a total of 1400 static meshes in one large room and around 4000 static meshes in total and 1300 unique materials (without roughness, specular, metallic and etc. Just low-resolution textures). and around unique 20 materials with roughness, specular and etc.

I’m guessing this is the issue however I’m not sure how to check to really confirm that this is the cause of it.

Anyone reading this knows how I can check what is slowing down the draw stat and if this was the issue (having way too many static meshes and unique materials), anyone knows how to fix it without decreasing the number of static meshes?

Hi Sepehr,

One easy way to check if your meshes are what’s causing the slowdown:

try the console command showflag.staticmeshes 0 to hide all of the meshes and see how much your performance increases.

Another important tidbit: You’ll have a drawcall for each Material Channel on a mesh. So reducing the number of channels and/or combining groups of meshes into 1 mesh are good places to start.

2 Likes

there is just so much that could be said about optimization.
maybe you could start by using unreal insights which is quite cool.
also have a read about hierarchical instanced static meshes
a quick online search gave me this:

https://yewtu.be/watch?v=HX7QFPg9sOc

1 Like

Hi Astrotronic,

Thanks a lot for the tips.

The command is what I really needed.

The only issue is that most of my meshes are small supermarket products with only a texture (with different resolutions but mostly less than 500 x 500 with a jpeg format) only and no roughness, specular, normal map, metallic and etc. I have some ideas which are to squeeze every like 20 textures into a 4k image in photoshop (and I’m not sure but I think this is texture atlasing?) however this is going to take so long since I have to organize 35000 objects again (1400 static meshes which are instanced).

I was wondering if you know any way that unreal engine automatically merges materials or something like that?

Again though thanks a lot for the help, I really needed the command for debugging the draw calls.

For multiples of the same object (like in a supermarket), there is supposed to be some automatic draw-call batching. (This vid is the deepest of dives on that topic)

Maybe you’re seeing slowdowns because all of those objects are casting dynamic shadows.

Press CTRL + SHIFT + COMMA while running in editor to get a view of where GPU resources are going.

2 Likes

Shouldn’t the draw calls go down when the meshes are hidden though?

Because I hid the meshes and I’m still having the same fps and draw calls for some reason.

Hiding the lights does give me like 7 fps as well but for some reason, there are still 2000 draw calls when everything is hidden in the scene.

1 Like