This is a basic game engine performance question. Is it better to spend the time UV mapping an entire object all onto one texture file or break it up into several smaller maps? I figure the former is more efficient or else why would everyone do it… but it is time consuming to arrange everything out just right (even with Maya’s great UV tools).
Thanks All!
PS - Should I put questions like this into another thread? Maybe a general game topic thread?
This thread is fine…
Depends: The goal is to get as much as possible into each mesh. So if you want the objects to move interdependently of each other, you may as well use different textures.
If, on the other hand, you can possibly combine the objects, then stuff everything into one texture combine all polys
So there’s zero performance difference in the number of textures used… it’s all based on the GFX card memory and the size of the files? And there’s no overhead in the amount of UV data stored in a polygonal mesh?
I figured the old adage “better to have 1 1,000 polygon mesh than 1,000 1 polygon meshes” might also apply to the way textures are handled.
Is the reason most game texture artists combine all textures into one UV file is to just organize their content better?
I wouldn’t know about Unity’s precise implementation, but with OpenGL in general, it’s in your interest to invoke as few state changes as possible. It isn’t terribly expensive to change textures, but if you do it a lot, it can add up to quite a lot of overhead.
In fact, it goes back to what you said about one mesh with 1000 polygons versus 1000 meshes with one polygon each. Since the only time you can change textures is between drawing meshes, the more separate textures you have, the more you have to break your meshes into smaller numbers of polygons.
Some scene graphs are clever about this and collect all polygons belonging to a particular texture so they can all be drawn at once without any state changes. I have no idea whether or not Unity does this. If it does, it may only do it per object rather than for the whole scene.
Whether or not any of this is really a problem depends on what you’re doing. If you’re worried about it, put together a test piece and see if it’s slow. For even moderately complex scenes, it should be fine. For very complex scenes, or for slow hardware, it might be a problem.
I suspect the main reason that lots of texture artists put everything into one texture is that the engine they’re using has limitations which force them to do that. I think this was much more of an issue in the days of Quake 1 and the like.