How can I use a texture atlas to supply textures for a material?

There are so many questions and answers on this topic, but my head has exploded trying to understand them, because none seem to be related to my issue.

My situation is my game is suffering from draw call issues as it is a building game. Occlusion culling doesn’t work, as it is an outdoor game, so I need to look at reducing draw calls, and one idea I had was a texture atlas.

As you can see I have a lot of trees on the screen. These are not tree models, but are instead made up of individual blocks. These are buildable prefabs in my game. There are over 5000 individual models here but as you can see there are basically just 2 materials in use in this particular scene, the brown trunk and the green leaves. These materials both use the same normal map, the only difference being the individual 128x128 texture used.

My plan is to create a texture atlas which the material can use to select textures from. In this example, there are only 2 textures, but there are currently 16 default textures that would be assigned to the atlas. (More than likely increasing in the future).

Here is the default atlas I have made:

I can very easily work out the positions of the UV for each texture, as they are all pure power of 2, the question is, how can I make a material use a texture atlas in this regard?

Being able to atlas textures in my specific instance would hugely reduce the number of draw calls required, but I cannot see anything on having this implemented in a 3d game in this way.

Any thoughts tips or suggestions?


I did the test again, but found much better use of batching this time. The problem gets much worse the more of the different textures I use. Here is a quick breakdown of the issue, oddly, this time, I notice that with far fewer verts (1.3m in this video compared with 2.3m in another test) the fps is much lower.

Any help with suggestions which could narrow down where I should be looking to investigate optimisation opportunities would be welcome.

(please wait for video to be processed)

well if they’re just going to be solid blocks, why not forgo any texture at all, and instead just tint the object?

There’s a tiny parameter on regular diffuse materials that can be changed at runtime (in your case, perhaps at “Start”?) by writing:

GetComponent(Renderer).material.color =;
GetComponent().material.color =;

The can be any normal color (, blue, white, black, etc) but if you want a specific color, just go to the color picker in unity, and select your color. then take the 3 numbers and divide them by 255.

R: 107
G: 200
B: 56

divided all by 255:

var alpha : float;
Color(0.42, 0.78, 0.22, alpha); //<--some puke green.

more info here: Unity - Scripting API: Color

edit: it should be noted 3D objects use textures, not sprites, so setting up an atlas is not possible. Your best bet is to take advantage of tinting wherever you can. And you can do that with a black and white texture, should you desire a mincraft-type of rocky texture for everything.