Download

Question about draw calls

After I had created a fence panel for my game, a few thoughts hit me about the possibility of selling the asset So I thought about how to take it further and really optimize the asset for a deeper level of customization while keeping the draw calls low.

So I created the model, laid out the Uvs, then created texture sets and returned to the model and decided to break it down in to separate meshes of its core components This made the mesh go from 1 piece to 5 different pieces but still all using the same Material.
But after the custom fence panel has been built in UE4 I could merge all the parts to a single draw call so the mesh and the material would only still be 2 draw calls right?.

still need to clarify these nagging questions I have
does 5 meshes all using the same material = 6 draw calls.

Have I got all this right?

Each separate object is a draw call for the mesh and a draw call for the material whether the material is reused or not. So if you have 5 objects using the same material, that’s 10 draw calls. If you combine them, then it would be 2.

Thanks for answering DarthViper.
I would have thought that the material was only being called once in to memory and used for all meshes that were using it.
But with instancing its different and instance of a mesh & a mat is still 2 draw calls ?

A draw call is a command to render on an object, so one is to render the geometry, another is to render the material, it doesn’t matter what material it is. If you have multiple materials then it’s another draw call for each material, if you have layered materials it’s a draw call for each of those too.

The default way the engine works if you reuse a mesh/texture then it will only be loaded into memory once. But in Blueprints if you use the Instanced Static Mesh feature then you can batch objects that use the same material which will reduce the draw calls down to 2, but that’s something you have to specifically set up.

Thanks again!
I understand now :slight_smile:

I found myself into a similar situation recently. I had ~8 different objects sharing the same material (I simply mapped them to different UV islands in the single UV layout) and tested to see if I would get 1 draw call when all of them are rendered on the screen together or 8-9+. Unfortunately it was the latter.

When multiple objects share the same material and many of them are rendered at the same time ie in a single frame, it should be possible to use one draw call for the material. Maybe another optimization could be done here.
But I’m afraid, that we actually require hardware support for that first. Something that parallels gpu instancing, but likely more complicated, since this time the mesh changes but the material is identical, whereas with instancing both the mesh and the material/shader are identical (except the mesh’s transform). Supposedly it could be done in the near future though.

The only way that would work is if you joined all the objects together as a single actor. Otherwise each mesh on screen is a different draw call.
Even then, I think you would be going out of your way to get it to run like that.
Maher do a quick test by throwing the meshes into the foliage tool and using that to paint them, its wort a shot.