- Home /
Meshes with multpile texture maps--is it possible?
So I have been building this environment in maya ( see picture ) and the main room mesh reads from several different texture maps. I read the manual and it said to only have one texture to one mesh whenever possible. But how do you apply multple textures to a mesh in unity? I guess my main question is what would be the best workflow for importing this into the unity engine.
Answer by Cyb3rManiak · Sep 14, 2010 at 12:53 AM
as JTBentley already said, it's a balancing act. You can bake an entire room into a single material and texture, or have every polygon in the scene have a separate material and texture.
It really varies depending on what you have in your scene. I think an example would explain it better. If you take the screenshot you posted as an example - the doors have metal handles. If you want them to be reflective you can't have one material for both the door and the handle, since the shaders should be different. However - if all you want is to use a simple diffuse texture - combine the two meshes into one and use only one material.
How? UV Mapping done well, or a simple automatic bake in your favorite 3D modeling package. Search google for "UVUnwrap", "UV Map tutorial", "Atlas textures" and "Baking textures" to get started. Maybe in Unity3 you can use the awesome new light bake to somehow achieve this also, but not sure.
Now, this is not the end of it... The door, wall and floor textures look like they're tilable and not very detailed. Maybe you can create one texture with all of them side by side. The floor UV will be set so it rests on the part of the image that contains the floor texture, door UV on door texture and wall on wall texture. This way you can have the same material on the floor, doors and walls. Their individual UVs will make sure to "take" the part of the image they need.
On the other hand, if your doors would have been decorated with a hugely detailed non-tilable wallpaper - there's probably no point in trying to combine it with another texture. You would be loosing detail since you'll have to pack both textures into one. And increasing it in size to allow this is not always the best solution. Maybe another draw call will be fine, compared to an increase in texture size that will bloat the memory.
Many tips tricks and hacks are used. Which ones is really project-dependant. Try and use many materials in an iPhone game and watch the draw calls choke your game. Do it on a PC with a high end GPU and it will handle thoulsands of draw calls without a problem - and then is it worth the time and effort to optimize the hell out of it?
There's a middle ground, and you'll find it only with experience and common sence.
Answer by jtbentley · Sep 13, 2010 at 11:16 PM
You can have multiple materials on a mesh, but its obviously less efficient.
If you're exporting as FBX, and you already have different materials applied, your material editing inside Unity will have several slots to reflect this.
Alternatively, you could pack'n'bake that entire scene down into a single texture.
Answer by Mitsuomi · Sep 13, 2010 at 11:24 PM
Like JT already said, its possible ... I would like to mention, that a single texture is rendert faster then severesl textures. Even if the absolut pixel amount i the same (1testure at 1024 or 4 textures at 512). So try to use as less textures as possible.
Is there a tutorial in maya or 3dsmax that you can point me too for merging meshes into one and then merging textures? So in my case I have a tavern that looks very similar. I first want to combine some of the objects into a single meshes then create a single texture. I would appreciate a link to any tutorials on this especially for maya or 3dsmax. Thanks,Dan