Can I use the same material (& textures) for multiple, different meshes/objects to reduce draw calls?

I would do this, of course to minimize draw calls. Another reason, why I want to do this, is because having objects separate is vastly more flexible.

For example, imagine I’m building a refinery. I could have 1 8k texture for ~20 individual objects it is comprised of. Examples of flexibility here:

  • I may choose to animate one of these objects (say a mill-like apparatus)
  • I may make destructible meshes out of some of these objects (eg barrel-like objects)
  • I may make actor classes out of some others of these objects and apply animDynamics to them (or similar node) and let them animate independently (imagine wires hanging around the platforms)
  • I may create instanced static meshes or hierarchical instanced static meshes of some other of these objects

I’m not sure If I can do all these with everything being a single mesh. But even if I could, it’s not as intuitive than having them separate. After all, the single most crucial impact in performance is draw call count, ie learning to magage draw calls. The less draw calls per frame we have the greater our performance, since all these objects would be rendered (colored) at once, since there is a single shader/material for them all.

If you’re confused about what I’m asking, don’t be. It’s simple really. Think about selecting and UV mapping 20 different objects in 3ds Max/Maya on a single UV plane (Unwrap UVW modifier) and placed each one’s UVs in separate areas, such that they’re not overlapping.

I don’t know much about Unity, but it seems that if you enable ‘Dynamic Batching’, then objects which share materials can reduce draw calls, as seen here: Does same material on different mesh reduce draw calls ? - Unity Answers

Therefore, is what I’m asking possible in Unreal Engine (v4.23)? And would these objects indeed be rendered in a single draw call? Am I right in my assumptions? Thank you.

To clarify, your question is that, assuming numerous different meshes (animated, destructible… Etc) are all using the same material, is it possible to have them all rendered in a single draw call in order to maximize performance?

Not animated, or destructible, or anything else fancy. Just STATIC meshes. I COULD later make them animated, or destructible or whatever; if that was even possible. But in order to do that in the first place, I have to make sure that all these objects benefit from the single draw call hypothesis. So at first, do not think about anything but STATIC, simply static meshes all sharing the same material/shader. If you’ve worked with 3ds max (or Maya/Blender w/e I only mostly know Max, but I believe you can do this in all these 3d modeling programs) you can have any number of objects, combine them into a single object then apply ‘Unwrap UVW’ modifier (basically to UV map them). After this is done, you can detach any number of “elements/subobjects/we” and make them different objects. Now all those different objects will still share the same uv space, the same texture and the same material. Now export them all as FBX and in UE4 when importing DO NOT tick ‘Combine Meshes’. As such, when imported in ue4 they will still have the same material but be different objects/meshes/assets. I have just done this in UE4 and works good, but I’m doing tests to see whether by placing all these objects in the scene a single or multiple (per object) draw calls are required to render them all (I repeat once again; different objects, same material, same textures, each one is simply mapped on different uv islands/clusters on the same uv layout). I would benefit from opinions of more experienced people to figure this out.

[IFF I make sure that there is indeed a single draw call to render all these STATIC objecs, then I will proceed to make some of them animated, some of them destructible some of them whatever and CHECK whether they still need a single draw call to render them all. If this last sentence confuses you, do not think about it at all. It doesn’t matter.]

So, you said you imported them into Unreal as you mentioned yes/no? Did you debug the draw count and find out i your draw count increased with the number of meshes? I am guessing they would need to atleast be instanced static meshes? I’m curious what you find…

Negative. Unfortunately, there are multiple draw calls, likely on a per-object basis. This is something that can benefit from further optimization, at least if objects that share materials are sufficiently close together, such that they can be seen “at once” from the camera then a request for an identical fetch of a shader (ie an additional draw call) for another object should be unnecessary. On the other hand this optimization may not be possible with the current rendering state of unreal and other modern game engines and actually requires hardware support (sth like gpu intancing).

Hi, as far as I know unreal engine uses some auto instancing since 4.22 4.22 runtime auto instancing question - Rendering - Unreal Engine Forums

And the video where one of the devs talks about that Refactoring the Mesh Drawing Pipeline for Unreal Engine 4.22 | GDC 2019 | Unreal Engine - YouTube

What you’re talking about is a texture atlas, you can sure use that in unreal engine but I never made them by hand only used them in hlod.

But I would not use an 8k texture cause this will stay in your memory for as long as you see one mesh with this texture applied.

To further reduce drawcalls I use either instanced static meshes when I have many meshes of the same type (grass, trees, …) or build hlod when I have many different meshes in close proximity (interior of a house) and don’t wanna use level streaming to stream them out (you might wanna try actor merging instead of hlod but never used that, so I don’t know about it).

Instancing is a single draw call for identical objects (since the objects are identical they share materials). I am talking about different objects that share a single material/texure. 8k texture was an exaggeration, but still I would prefer to have 1 8k texture for say an entire factory composed of 100 different objects than 100 different materials for each object (and trust me you’d prefer to have that too).

TL;DR: No.