In this guide, I want to show how I worked on update 1.1 of our 3D, cartoon-style “Poly” environment packs. I go through the process using our freely downloadable Poly Desert Pack.
Why use a texture atlas?
In the previous version (1.0) I used Material colors only. Modifying the color is straightforward and can be achieved in the Inspector or during runtime. But it also means that I have one Material for each color present. This is not a problem when you have a small scene, but can cause performance issues in densely populated areas with high triangle count.
How to create a basic color texture atlas
Step 1: Create meshes, and set material colors
In this older article, I write about how I created the basic meshes for PolyDesert package. I set up individual material slots according to colors.
Step 2: UV unwrap and arrangement
When unwrapping, I tend to keep the UV shell number as low and undistorted as possible. This is especially important on large objects such as cliffs – they should be ready for lightmapping. From a texturing point of view, it is allowed to create overlapping UVs, for example, all the thorn’s UVs can share the same place. Unity can take care on creating lightmap UVs for these objects if needed.
Step 3: Create a color texture atlas
Here comes the magic! The traditional way for creating a color atlas is to gather your textures and lay them out in an image editing software. Then adjust the UVs in Blender to match those textures.
I recently found a cool add-on to automate the color palette creation and material combining. With MaterialCombiner, I select all the meshes I want to share an atlas, set the image size to Power of 2, then hit the Combine button.
The add-on adjusts UVs according to materials and creates an atlas with the colors of each one, and changes the material slot on all models. Because of this, it is advised to create a backup before combining.
Step 4: Check Material slots and UVs
This step is for making sure that everything looks like it should be. To view how the models would look in the game engine, change the render type to Game and 3D View shading to Texture. I search for culling and normal facing issues this way.
Step 5: Export models to Unity
I exported the models in OBJ format, with a single material slot. Then I imported them to Unity and added the color palette texture to the material. You can speed up the export/import process if you are saving the models directly into the Unity projects folders.
Thanks for reading, I hope some of you will benefit from this guide.
If you have questions or suggestions on this topic, you can share your thoughts in the comments section below!