Question about texture maps and optimization

Hi, I’m just looking for some clarification regarding texture maps.

I keep seeing that it is best to keep a single texture map for each gameobject. Now, below you will see my character, who is composed of multiple pieces, and each of these pieces has it’s own texture map. So this is bad, right? But all of these pieces go together in one 2k UV layout, these don’t each have their own 2k layout. But I think I am still doing this wrong, but I’m not sure how to fix it.

Do I need to combine this guy as one object in Maya, then export him? Would that put all the maps together? I don’t think so because then how do I assign the maps to the appropriate part? SOrry if this is a stupid question, but this stuff really confuses me and I can’t find simple answers anywhere.

I can help a little but you will need to translate 3D Max terminology into Maya term…
It is more effecient (optimal) to have less testure maps - but higher production games do not follow these rules much any more, as they used to.
Heck - even as far back as Unreal Tourney 2004, maybe even earlier, Epic was using one texture for the body and one additional texture for the head.

As far as the issue you are hitting, you do not need to combine all the separate mesh components together for them to share one UV layout and one texture.
Instead select all the individual mesh pieces at the same time and apply a UV modifier. This will allow all the pieces to share one UV layout but each mesh will occupy a different area (shell) within the layout. No overlapping UVs. It sounds like you have already done this successfully, so the only other part you are missing is to combine the separate maps into one texture overlaying the combined UV layout.
You might need to combine theUV shells into one template/guide so you can place the textures for each separate mesh where they need to be - but this is a simple process.

Here are a couple drawbacks for having only one texture/map for one character made up of all different pieces.
Even though they share the same texture each separate mesh equals one extra draw call (I think).
The entire rig has to be calculated multiplied by the number of separate mesh elements (I think).
Different shaders to reflect different material types (metal, skin, cloth) will need to be isolated based off of a mask for each mesh element, which will also add at least one additional draw call per shader/mask (I think). Because each mesh element has a unique UV shell it will need its own mask to identify what part is metalic or not, which part is shiny or not, and which part is emmisive or not.
If one part of the mesh gets hidden or disabled, the entire 2k texture will still be rendered. This is a good reason to consider making smaller textures for less important items, like maybe the boots, belts, straps and pack could be contained in a 512x512 texture and the main texture could be reduced to a 1k texture.
Plus this would eleminate the requirement to set up a mask for those elements to have a different shader. A different shader would still be required, but the mask/channel would not be needed = more optimal.

Standard res is 2k or above but showing that you understand a 1k and 512 texture is more optimal over one 2k texture is solid knowledge to pass along.

1 Like

I’ll need to come back go through this again when I’m not so tired, but let me make sure I understand this part correctly:

So, regardless of whether or not my characters texture maps are combined into one image or not, so long as it is composed of multiple meshes there will always be a need to have a draw call for each mesh? So the draw call is based on the mesh, and whatever size texture map is associated with each mesh is just going to effect performance based on how much resolution it is calling for?

So, like you said, I could make an entirely separate texture map for little things like the belt buckles because you can’t hardly see those anyhow. And then I’d get a little more space in the texture map for the bigger stuff. And this is not more taxing than just say, making all those meshes fit into one texture map with the less important pieces shrunken down because you are making a draw call for each separate mesh regardless of how many texture maps exist for it?

This is my understanding, but I might have checked the documentstion first before posting. The way you put it - makes me think I was incorrect with my understanding - Ill check docs (run a quick test) before posting to confirm.

But - no additional textures will produce additional draw calls - but draw calls are not as important on PC as on other platforms (mobile).
What I was saying was one 1k and one 512 texture is more optimal than one 2k texture. Regardless of what type of mesh (multiple or one solid) they are applied to.
More draw calls but more optimal for gpu. If all other factors (the shaders) are equal.

1 Like

I meant No, additional textures WILL produce additional draw calls.

I was a almost wrong - but think I am correct. I didn’t consider the built in dynamic batching, but it seems limited per vertex attribute - but I don’t know straight off what a vertex attribute is.

From documentation -
Unity can automatically batch moving GameObjects into the same draw call if they share the same Material and fulfill other criteria. Dynamic batching is done automatically and does not require any additional effort on your side.

Here is the link, but I think running a quick test setup with a cube with multiple meshes using the same texture, vs, one mesh using the same texture, vs, multiple meshes using multiple textures and shaders will provide the information you need. Also remember to make the test with a skinned mesh renderer and a rigged cube(s) to mimic your setup as closely as possible.

Upon a bit more reading - dynamic batching does not factor into this scenario.
From documentation -
Currently, only Mesh Renderers, Trail Renderers, Line Renderers, Particle Systems and Sprite Renderers are batched. This means that skinned Meshes, Cloth, and other types of rendering components are not batched.

With all that said - I think you should just proceed with your setup by combining the UVs of all the objects into one UV layout as you stated, and combine the textures into one texture. Just keep in mind the different ‘materials’ (skin, metal, cloth) will require a different shader to look correct. But that is something you can address on a second,third iterative pass.

A couple other useful links to share related to drawcalls. Older info but still relevant

1 Like

Thanks! A lot of this is still greek to me, but now at least I have an idea of how to proceed and I can pick up more of this technical stuff along the way. I think the programmer I’m working with my be able to help me understand how things are “batched” and how “draw calls” work behind the scenes.