Optimising tiny textures and geometry from numerous multiple small objects

I have a game that uses a large number of very simple objects that have their own very small and simple textures, very similar to minecraft. All cube objects obey 16x16x16 pixel pixelart in a 1x1x1 world unit.
Traditionally in games engines (in the past) it was more efficient to put some or all of those textures into a single texture. I think it was to reduce how many objects needed to be pushed over the whatever bus was the flavour of the year at the time.
For my workflow, to do this is would add an incredible amount of work and administration to my pipeline when creating the objects.

My questions are these:

  • Does unity have some internal mechanism that reduces or even removes the need for textures to be grouped into single texture files. Is this still even a “thing” in 2016?
  • If this is a thing, are there any tools that will take multiple objects with their textures, merge the texture file into one and make each separate object project UV’s into that new texture?
  • To combine meshes I’m using Mesh.CombineMeshes, but it’s so basic it’s unbelieveable. AFAIK, It just welds geometry together into a single object and does no optimisations at all on the faces, vertices and also the textures.
  • Currently my objects are created in Blender where geometry is made and UV’s set. Unlike minecraft, many of my objects are not just simple cubes, but they do respect the 16x16x16 pixel art boundaries. Creating such simple objects is surprisingly time consuming in Blender, mostly due to UVs and keeping the texture scale correct so that it aligns with other “blocks”. I’ve tried using MagicaVoxel to paint 16x16x16 and it seems like “THE” perfect tool for this. Unfortunately the exported objects add a huge amount of geometry to the object that is not needed, most notably across colour boundaries which should be achieved by texture maps. Cleaning this object up AND the texture in Blender negates the gains of using MagicaVoxel.
  • Any other suggestions are welcome.

Yes, I have looked and Googled related threads and have not found modern or specific answers to these exact questions.

Yes this is still a thing in 2016. This is about how GPUs work internally rather than a simple bandwidth thing. Changing the shader or textures used requires a state change on the GPU which is fairly slow. Changing the geometry while keeping the same material is faster than changing the material and keeping the same geometry (or changing both), even though any of these will cause a new draw call. Unity tries to batch together meshes with the same material to reduce both draw calls and state changes, so atlasing helps a ton as it means several meshes can be using the same material.

There are several assets on the asset store that do more complex mesh combining and atlas creation.

2 Likes

Does Unity attempt to do automatic atlasing as part of it’s batching?
Something that creates atlases and updates object UV’s as a compile step would be perfect. Does such a tool exist?

UPDATE:
http://docs.unity3d.com/Manual/SpritePacker.html
“Unity handles the generation and use of sprite atlas textures behind the scenes so that the user needs to do no manual assignment. The atlas can optionally be packed on entering Play mode or during a build and the graphics for a sprite object will be obtained from the atlas once it is generated.”

This is EXACTLY what I was looking for, but for 3D objects and updating UVs.
Any ideas?

Nope. It does not modify UVs or texture data. Only combines meshes … likely using the meshcombiner function you already found.

Sure.

There are probably others. Haven’t used any of these and they seem to differ slightly in their functionality and there’s some cheaper / free versions that might do what you need too.

1 Like

Mesh Baker
Looks good, does mesh and texture optimisations. Killer - Trial version does not allow you to “Bake meshes in place” so I can’t even test it

Pro Draw Call Optimizer
Also looks quite good, only does atlasing and UV updating, which is fine for me. Output objects are in a strange ODCObj format. Still evaluating. Update. Apparently Unity API’s don’t allow you to remove existing objects, so for my game that contains 100’s of different objects I’d have to manually replace each one with the atlased/UV fixed version. This is not such a big issue if it’s done once or twice for beta and release, but because map objects will be added and removed all the time this is a pain. Being able to tag an object and do this behind the scenes in a non destructive manner would be perfect.

Pro Material Combiner ++
Killer - The last one seems to only do texture packing and not update mesh UV’s

That’s part of the problem, many of them no longer work with Unity 5 properly or don’t do what they say.
Added to that they don’t have demo versions. I’ve already been burned by that with other tools.
Thanks though.