How to reduce my draw calls greatly?

Hi there,

I’m currently building up a large construction project inside the engine, and I’m coming across issues with my draw calls. The models themselves come from Autodesk Inventor as individual pieces, I then created my game models bake etc. and into engine just fine, with all my LODs working fine the total rendering tris is always sub 100k, but as this is a huuuuge structure , there’s over 16000 meshs!

I’ve broken down the structure into modular chunks, compiling section inside blueprints, then placing those around, but it still seems that even those models inside are still counting as 1 drawcalls? is there a method to combine all those meshes maybe to drastically reduce my calls!?

Any help would be greatly appreciated! I’ll add some pics shortly too!

http://postimg.org/image/mjkdv1sa7/

http://postimg.org/image/nn4i70cxb/

http://postimg.org/image/y2fqd1gfj/

Pics are attached, those LODs are for the lowest level mind but I just made them all appear really close because of the fps atm!

Hi Bailey -

I want to understand exactly what your have; you have constructed modular pieces through a Blueprint, but each mesh is still separate? Also what do your materials look like, how many materials are on each mesh and how many textures in each material.

I think I can help you reduce but I want a complete picture of how you’ve constructed them before I answer.

Thanks

Eric Ketchum

In total there is 11 different meshes in the entire scene. They each have there own material (which is instanced from 1 master material). The master material only contains 3 texture maps, then differences in the instances are normal map changes.

The modular sections are compiled inside blueprints, 1 blueprint contains a variety of the 11 different meshes I mentioned above. Does that help?

Hi Bailey -

Yes that helps, can you also add a screenshot of the Primative and Texture Stats from the Statistics page (Window >> Statistics)

Eric Ketchum

Morning!

http://postimg.org/image/g0rtwndpb/

http://postimg.org/image/3nezpqo0v/

(Normal Maps are yet to be shrunk) But I don’t think that’s an issue currently!

Thanks for looking into this for me :slight_smile:

Hey Bailey -

Have you tried instancing your static meshes in the blueprints? How are your components set up in Blueprint?

-Eric Ketchum

Hi Eric, Bailey,

I have been following this post with interest.

I too would like to know how to reduce draw calls, but primarily for Mobile.

Eric, I have implemented static mesh instancing as you describe and it works great for the desktop, but it doesn’t work on mobile!

My question, and I hope I’m not hijacking this thread, is if we’re to use constructor scripts for building levels with static meshes, that results in a lot of draw calls if targeting mobile. Which is kind of ironic, as mobile is way more sensitive to draw calls than desktop.

Thanks!

hey guys, thanks for the replies, back in office today!

So you talk about instancing… yet I don’t actually see the ability inside my editor to do so? What am I missing here!? I assume that just alt dragging is creating a copy. /headache!

Thanks again for helping :slight_smile:

So ‘Duplicate’ actually means Instance it would seem, but without any actually indication / information about it! I’ll rebuild the blueprints and retry.

Hmmm you can only duplicate inside the blueprint (Not Copy) so i would have originally did this, bringing in 1 of each component initially, and duplicating / placing it together within the blueprint.

Hi Bailey, you need to use something like this.

That script will place 1000 instances of the “bot” static mesh, in a single draw call.

Works perfectly for me on the desktop, but what I want to know is how do we handle something like this on Mobile?

Hope that helps!

Hey Bailey -

So I finally have been able to create a significant draw call difference for you to try, It is using instancing, but you will not have to code anything in blueprint just work in the component section. Create a new blueprint actor-based as you have been doing. Instead of adding your static meshes directly into the blueprint, go to the Components Window pull down and add Instanced Static Mesh. In the content browser, select the mesh you want to instance then place it in the Static Mesh area of the details panel for the newly created instanced static mesh. You can now from the Instances area of the details panel add as many of that particular type and it will be treated as one draw call. Important note here, all instances of that mesh will have to have the same material, but it looks like you have that anyway. Each Instance can be located unique anywhere through the Instances area of the details panel Location, Rotation, Scale sections. So for the image you originally shared with me, the draw call would go from many down to just 5.

Here are some images to demonstrate what I am talking about:

Let me know how this turns out I would love to see the new draw call information when you get it all put together.

Eric Ketchum

Hi reefG -

Mobile development is all about making smart decisions and cheating where ever possible. For Bailey’s project above, if he were developing for mobile deployment. I would tell him to go back to the modeling program and combine some (read a lot) of those meshes into a single mesh, and probably in all honesty the whole structure should be a single mesh with LODs which could take it down to a single plane.

Constructor scripts are not the way to go in mobile unless you do a lot of work on developing LODs, and limiting the number of instances. It is truly about being smart with your game design and making something actual very small seem much larger than it actual is.

I don’t want to hijack Bailey’s question here so if you have a further question, feel free to post it in AnswerHub and I will keep an eye out for it.

Thanks

Eric Ketchum

The pic which you referred to in your answer is actually displaying the LOD meshs, which yes, do all share 1 material, but the non LOD mesh which is swaps back does contain different materials (Albeit just a normal map change, its still not the same) I will give this a shot though and defiantly report back!

Thanks!

Hey Bailey -

I am a bit confused about what you said about LOD meshes. You should be setting up LODs in the Static mesh editor in the LOD panel not directly through blueprint. That way one mesh is brought into the blueprint and it already has a self established LOD settings through its inherient properties.

Let me know if I am misunderstanding your setup here or if I need to explain further.

Eric Ketchum

Yeah they are set inside the static mesh editor, all seems to be working fine, just the initial build inside the blueprint is taking longer to compile, as its harder to clone pieces to move around, nor does it show you what element to duplicate i the list when you click it! When i finish building the section (Currently gotta finish up another project real quick) I’ll post some more scene rendering screenshots to analyze the impact your method has made for all to see.

Hi Eric,

I cane across this page trying to optimize my own project. Lots of good info, I would just like to clear some things up for myself if you don’t mind.

So if I have 1 static mesh with 2 materials on it, instanced in a BP 20 times, it would count as 2 draw calls right? And the way I understand it, no matter where those meshes are in the world, if one is being rendered all of the instances have to be rendered with the same LOD. Is this right? So if I can only see one of them at the moment in game, it would still have to render 20 times the necessary polygons and just 2 draw calls, right?

Thanks,
Joe

HI Joe1029 -

Yes you are correct there would be 2 draw calls for those 20 instances and the LODs would be based on the “original” settings of the one mesh. Usually the hit to performance comes from the draw calls and not the rendering of the vertices.

Thanks

Eric Ketchum

That’s what I thought. Thanks Eric.