Skeletal Mesh has over 80 Draw Calls

My Skeletal Mesh has about 80 Drawcalls according to stat scenerendering in a completely empty scene with only my pawn.

The Skeletal Mesh however has only 14 Materials and only 14 Sections.
It has 3 LODs (0-2) and a few Facial Morph Targets (where the face is a single section with it’s own Material)

What causes the Draw Calls? I thought it was NumMeshes*NumMaterialsPerMesh?

each material will adding draw calls, and those morph data etc, its kinda heavy with 14 material though

Uhm, each mesh in the Skeletal Mesh has ONE Material applied.

My Skeletal Mesh consists of 14 separate Meshes, where each Mesh has only one Material

This means 14*1 = 14 and not 80.

if you turn off all dynamic shadows, does that change?

By default your mesh sections will be rendered once for the depth pre-pass, possibly once per shadow casting light (or up to six times per point light), once in the base g-buffer pass, and once for the velocity buffer for temporal antialiasing and motion blur if the mesh is movable. If a material has custom depth buffer draw enabled such as for outline rendering, thats another render pass.

So in an empty scene, a 14 material character will create a bare minimum of 42 draw calls. Then a fair number of draw calls are needed even if the scene is absolutely empty, such as to run through the post processing pipeline, and the debug text that you read the number of draw calls from also needs a set of draw calls in order to get to your screen.

You can reduce these numbers by disabling the depth pre-pass, and disabling temporal antialiasing and motion blur. But disabling the prepass is likely to make your overall performance worse.

Is there another method for reducing the DrawCalls?
My Model has different Shading Models (Mostly Cloth and Subsurface for skin, also Hair both Opaque and masked)
I already batched some Meshes together. Do you recommend batching the whole Cloth Section together(resulting in 2 4k textures),batching the Skin Sections together (resulting in 1 2k texture)?

the shadow pass will produce another 14 drawcalls. if your light is using cascaded shadow maps that will mean 14 drawcalls in each cascade where it’s visible.
that’s why 's question is relevant

My scene is completely empty. No Light, No Skybox, nothing.
I tried to batch some meshes together, and now I’m at about 40-50.

With static meshes different elements does not cause multiple draw calls for shadows. Why this is case for skeletal meshes?

if you use baked lighting on your static meshes then it’s obvious why :slight_smile:
dynamic lighting will produce more drawcalls on staticmeshes just the same as with skeletal meshes

@Raildex_ then it’s probably what the others suggested

I don’t mean that. Dynamic shadows from directional light draws static mesh with multiple elements and different materials using just one draw call. Some materials can break this batching like alpha testing, tesselation or world position offsets.

Edit: Seems that all elements need to use same material to this batching to happen. Need to investigate.

well I wasn’t aware of this optimization, although it makes sense.
however as you say I don’t think it’s doable if the elements use different materials. the merging would only be allowed if anything that modifies the depth (i.e. Masked Alpha, WorldPositionOffset or PixelDepthOffset) would be ignored, or match 100%. ignoring them would cause unwanted results, and determining if they match 100% would probably be highly inefficient.

in any case if different elements in the same mesh use the same material I would almost expect them to get batched, not only in the depth or shadow pass, but in any pass. I actually don’t know if it’s the case but I suspect it isn’t.

what would be super nice would be to be able to opt-in into this, at least for the shadow pass (which would force ignoring all depth-related modifications in the material, but this would be fine in artist-controlled cases or even in general for LODs). this would optimize drawcalls on the shadow pass for multi-material cases. but well, sadly multi-material setups aren’t exactly popular because of their added cost

Well, Multiplayer with about 5 players the Drawcalls will explode already… :confused:

Just make more tests for this. If all elements use same material base pass does not batch draw calls. Shadow pass can batch even different materials if those does not connect to WPO, displacement or alpha testing.

not bad, that’s better than I expected :slight_smile:

thanks for the info

One material per mesh per lighting model/blend mode is generally good practice, unless you actually need to swap out parts or turn parts on and off, or it is common for parts to be outside of the camera view like for large architecture.

Basically only use separate materials on a single object when you have a specific need to do so, not just to make the art workflow easier.