Many material slots = Many drawcalls = Low FPS?

Hi there,

I have a model with many material slots from 3DS Max. In total, there are 127 materials applied. I broke this down to several meshes so I don’t hit the limit of 64 materials in UE4.

The triangle count is about 700.000 for all the meshes combined (it’s a extremely detailed car, complete with interior, engine etc.)

As you might guess, the performance isn’t that great now, the combined model with all materials needs about 180 drawcalls.

But I am not sure, what’s actually the main problem here:

  • The polycount of the combined 12 meshes?
  • The cost of direct lighting because of many material (slots) and polys (I light the mesh as a group already)?
  • The sheer number of element slots alone (although many of the slots are occupied by the very same material)?

Does it make a difference to combine the materials in 3DS (which is hell) or is it ok to just use the same material on many slots?

Is there a way to reliable find the bottleneck for a scene? The GPU profiler results differ greatly from frame to frame.

Specs:

  • UE 4.7.6
  • GTX 970
  • Core i5-3450
  • 16 GB RAM

Many thanks,

Every material after the first adds another drawcall, so yes that would be at least 180 drawcalls.
It means that the entire mesh needs to be drawn at least 180 times before the next frame, which will result in being a giant bottleneck.

It makes a huge difference to combine the materials in 3dsmax, if you’d manage to combine them all that would be one drawcall, though depending on the detail you need you could combine all the materials in a few materials.
I cant guess what you need it for, but you could seperate the mesh per grouped material and combine them in a blueprint so not the entire car needs to be redrawn for each material it has.

The polycount isnt your biggest issue, but for games it is on the high side… that said if its a racing game with only a few cars in sight with good LOD-ing it shouldnt be the biggest issue.
Cant give detailed info on the lighting though.

I know it sucks, but I suggest to massively reduce the amount of materials you need.

Hi Luos,

many thanks for your detailed answer. Phew… I really didn’t know that the entire mesh will be drawn for each single material (slot)… That explains the performance issues - especially in VR.

Ok, I’ll try to group some materials together. If only 3DS Max had a less crappy material editor…

But could you please clarify this for me once more: If I had 63 materials slot with the same material applied to every one of them, the mesh still would be drawn 63 times?

yes, material wise it doesnt really need to do a lot more calculating, but is still considers each slot a seperate draw.

what you can do, is create a new uv-channel for your car, and either let some advanced plugin for 3dsmax or an external tool like Ipackthat do it for you or do it manually. then you render that channel to texture. (within the 0-1 space)
After that, replace your first channel with the new channel you unwrapped.
and apply the rendered to texture one. though, you’d need to render2texture the albedo, roughness, normal, metal etc all as well.
(and from experience speaking, if the density of the texture that will be rendered to texture is either to high or too low… artifacts might appear.

Nontheless you have a daunting task ahead of you, and I wish you sanity in that insane task.

  • I wish answerhub wouldnt remove the “accepted answer” whenever someone replies.

Woah, I am not sure that I am even able to do that, I’m not very experienced in 3DS Max. But thanks anyway for your suggestion, guess this is just how things work at the moment…

Can I see a screenshot? I’m curious to see how it turned out!

I know this a really old thread, but I stumbled across it and have some advice for this.

You could double the resolution on both X and Y, and that will give you 3 more quadrants in that 0-1 UV space to work with for 1 material, allowing you to put a total of 4 materials in there. That should cut your material count in 1/4th but it would double the amount of video memory used and double the file size of your textures.

Another option is you can do UV offsets and go outside of the 0-1 space and use an if condition to detect what quadrant the pixel is, essentially putting a bunch of materials into one without overlapping or needing to change resolution. You can learn more about this from this gentleman, which is where I learned it: https://www.youtube.com/watch?v=k-yRzMjzfPM