version 1.2

Atlas3D Toolkit gives you only 1 drawcall
with textured & lightmapped dynamic meshes in Unity

With Atlas3D you can use NGUI ATLAS to texture imported meshes using the same workflow for both UI and 3D content.

Unity will do dynamic batching on meshes that have not more than 300 vertices, scale of 1 and the same material.

You can add LIGHTMAPPING with Unity Editor but normally it will break dynamic batching.

With Atlas3D you can REPAIR lightmapping and still have 1 drawcall on dynamic objects.

 

It simply converts original Unity atlas information and modifies uvs on source object. This way you can still use built in lightmapping engine and keep 1 drawcall without static batching on Unity. This method has its drawbacks. Every lightmapped object needs to be unique. So you trade mesh sharing to get low on drawcalls.

 

Atlas3D Toolkit is good for low-poly dynamic meshes in MOBILE games where you need low number of drawcalls.

It is useful for building world elements and putting lightmapping on them because they will batch even on indie version of Unity.

When you use unlit or vertex-lit shader that needs only diffuse texture atlas texturing gives you 1 drawcall even with big number of dynamic meshes.

 

Skinned meshes are not compatible with the current (1.2) version of Atlas3D because they are simply not batching at all even with the same material as other objects. I am working on a component that will merge multiple skinned meshes into one to keep 1 drawcall.

 

Check the video tutorial on YouTube:

 

 

 

 

Main workflow:

1. Model 3D Objects

- Remember that dynamic batching in Unity works only with limited number of vertices (300 when you use simple shader and even less when using more complicated rendering)

- Make scale of the mesh to be 1

- Apply uv mapping for diffuse texture

- Unity can generate uvs for lighmapping so you can skip this in your 3D software

 

- Use single bitmaps to texture meshes (we will make atlas in unity)

2. Import Objects into Unity (import settings)

- Check "Generate Lightmap UV" (you need this only for lightmapping, if you will only use texturing you can skip this option)

- Select "import materials" and choose "By base texture name" script will use that to automatically select sprites from atlas

- Turn off "Rig" and "Animations" because we cant use skinned meshes with this component

 

- Put imported objects on scene add some light and check drawcalls (default "diffuse" shader will give you 2 x mesh count of drawcalls)

 

3. Create Atlas using NGUI Atlas Maker

- Importer will create materials in subfolder called "Materials", use the materials to create new Atlas or update existing Atlas

 

- You should get Atlas texture like this

 

- Set shader on Atlas material to "mobile/unlit(with lightmapping)" or something similar to get 1 drawcall in your mobile game

 

4. Apply NGUI Atlas on 3Dmeshes

- Select all meshes and put "MeshAtlas" Component on them (find it in Components/NGUI/Atlas3D)

 

- Now select Atlas in the component just like in regular NGUI workflow

 

- If you imported meshes correctly with materials (described in step 2) script will automatically select right sprites from Atlas and your  meshes are ready

 

- You can always select Sprite manually

- Thats all with texturing - check your drawcalls - if you are lucky you have 1 drawcall for all the meshes

 

- But hey we need some light&shadows on the scene...

 

5. Add LightMapping

- Select all meshes that you want to be lightmapped on the scene

- Turn on "static" checkbox on them and bring Lightmapping window

- Unity will render lightmaps to 1 or more textures based on your setup. First lightmap cost zero drawcall. Every new texture will cost 1 additional drawcall so if you can fit on single texture you are good. Adjust "Resolution" parameter to scale the map.

 

- Hit Bake Scene and wait for the result. When ready you will see that our drawcalls again are up to the numer of meshes + number of additional lightmap textures

 

6. Repair Lightmapping on 3Dmeshes

- Turn on "Repair Lightmap" checkbox to show more options

- Now click "REPAIR Mode" to repair lightmapping - this will do the trick

- Check the number of drawcalls it should be 1 ;)

 

7. Additional things you should know

- "Update ATLAS" - hit this button when you change or update Atlas. This will refresh uvs on ALL the meshes that use the same Atlas as selected GameObject - no mater which mesh you select script will search scene automatically.

- "Update MESH" - Updates all the meshes in the scene. Hit it when you change any of the original mesh in 3D app.

- "BAKING Mode" - every time you will bake lightmaps again hit this button to temporary revert lightmaps just like unity likes to make the rendering.

- "REPAIR Mode" - When lightmapping is finished hit "REPAIR Mode" again and it will repair lightmapping to have 1 drawcall.

- Components were tested on Unity 3.5.7, 4.1.5 & 4.2, PC, Mac, iphone4s, ipad2, Galaxy2

- Don't forget to check off "static" in unity pro because it will try to automatically make static batching - this will give unexpected results ;) script is trying to make it for you but in case you see some strange instantiation on mobile device it's probably STATIC BATCHING doing its job ;)

- When something unexpected happens with your meshes on the scene, remember that you can always re-apply import settings on mesh prefab. Especially if uvs will break. This will refresh your meshes and you can start experiment again.

- enjoy

 

8. Version history

1.2 (2013.08.22)

- This version is a major update. Before installation you need to remove old componnents and delete the old Atlas3D folder

- Warning! To clear all the unwanted effects its advised to reimport all original meshes in the Assets in case they were modified by the previous version.

- Components are merged into single MeshAtlas component with atlasing and lightmapping option.

- Changed the method of uvs modification. Now the original mesh is never modified. Dynamic copies are generated in runtime for all the uvs changes.

- Simplified use without "make Unique" function. There are no more errors when meshes were instantiated.

- You can make prefabs from scene objects with MeshAtlas componnet without a problem.

- You can turn off component to display the original mesh with original material.

- Multiple objects modification. You can select many meshes on the scene and change atlas, texture, lightmapping options on all of them.

- When you add new mesh and you turn on lightmapping on, all other objects with MeshAtlas component that have lightmapping repaired will be turned to "BAKING MODE". Their "static" property will be turned on to be ready for lightmapping baking. Changing mode on one of the object automaticly changes this mode for other objects

 

1.1 (2013.08.09)

- You can put multiple original objects from the scene and there is no strange texture scaling after you put MeshTextureSelect component on them.

 

1.0 (2013.07.30)

- Original release of the toolkit.

 

*NGUI and Tasharen are trademarks
and copyright of Tasharen Entertainment.

*NGUI is required for Atlas3D tools to work!