Texture Atlas Generator

Buy now on Asset Store!

Texture Atlas Generator is a tool that generates texture atlases for a selected group of prefabs. This also means that new meshes, materials and prefabs adapted to the atlas textures are created. When using the newly created meshes (prefabs) Unity can batch draw calls in order to improve performance.

Important features include atlas generation for multi-materials meshes as well as multi-textures materials.

The requirement for atlas generation is that all corresponding materials of consecutive meshes use the same shader.

Take a look at the YouTube demonstration:

Screenshots

Interface

  • Atlas Name – name of the atlas to generate.
  • Delete Atlas – deletes the atlas under name given in Atlas Name field (simply deletes folders with given name and files that start with Atlas Name).
  • Import Folder – opens a dialog box that allows to import a whole folder with *.prefab files.
  • Prefabs Count – number of slots for prefabs to generate the atlas for.
  • Prefabs – list of slots that prefabs can be attached to. The atlas will be generated only for non-null slots.
  • Subtexture Width/Height – size of each of the original textures in the atlas.
  • Subtextures Names – list of textures names (separated with comma) from the original materials for which the atlas will be generated. This field is filled automatically when prefabs are imported from folder.
  • Generate Atlas – generates the atlas.

Examples

There are two sets of prefabs available at TextureAtlasGenerator/Assets/BlossomGames/TextureAtlasGenerator/Examples/Prefabs that can be tested. The first, set1 shows how multi-materials atlas generation works, whereas set2 depicts generation of more than one atlas texture.

Quick Tutorial

This quick tutorial will show you how to use Texture Atlas Generator step by step.

  • Name the atlas in the field Atlas Name.
  • Press Import Folder… button and navigate to TextureAtlasGenerator/Assets/BlossomGames/TextureAtlasGenerator/Examples/Prefabs folder. Select either set1 or set2. Prefabs from the selected folder will be imported and the prefabs list will get filled up. Obviously, the prefabs list can be constructed by hand but in this example we decided to use an automatic import feature.
  • Set a desired value in the fields Subtexture Width and Subtexture Height. These values should both be power of two. They denote the size of each subtexture/tile in the atlas, not the whole atlas.
  • The list of textuers names, separated with commas, in the field Subtextures Names tell which textures from prefabs’ shader (in fact, the shader from the first prefab on the list is assigned to all output prefabs) will be atlased. This field is filled automatically with all textures available for the material (of the first prefab) upon the folder import. It can also be filled by hand or by pressing Import from Prefabs button.
  • Press Generate Atlas to generate new prefabs, meshes, materials and of course atlas textures. Paths to the imported assets will be logged to Unity Console. The newly created prefabs can now simply be used instead of the original ones in order to improve your game’s performance.