Hi,
If I have a cube and a sphere would it be possible to use 1 material that uses a texture atlas? So I can make the textures for both the cube and the sphere, pack them into 1 texture and then fit/align the uvs for the gameobjects?
Yes, it’s possible to do that in a couple of ways.
-
You can simply create two different materials with the same texture and use tiling and offset to map the correct part of the Atlas onto your object. However, doing it this way defeats the purpose of having one texture atlas.
-
In a 3D modeling application, UV map a cube and a sphere to use a certain part of the atlas as its texture. Export and use those objects instead of Unity’s sphere and cube.
Sure. You can have as much as object UV in 1 texture as atlas.
Careful that more objects inside 1 UV means less quality on texture.
But it greatly increase performance especially for mobile.
Thanks for the help. So if I have multiple objects made using MAX, say a rock, tree etc, each one UV’ed and saved separately, how do I then make a texture that would combine all of the models UVs when they are all separate objects?
UVs of different objects don’t need be combines. Each object’s UV coordinates will simply define which part of the texture gets mapped onto that object.
Here is a quick description of how UVs work:
There are 2 methods:
Method 1: Plan well before unwrapping UV. Decide which objects should goes into this atlas and that atlas then select all specific objects and unwrap together. (So that you can see all selected objects’ UV at the same time.) For example you have 4 objects. You can separate the UV space (Open the UV grid line.) into 4 quarter and put the specific objects UV inside and finally form a 4 objects UV texture atlas.
Method 2: Let’s say you already have each texture UV per objects for PC / console games and now you want to combine these individual textures / objects to form a texture atlas for mobile. Texture atlas generator plugin for 3dsMax and Ninja UV Tool for Maya should help or you adjust manually. (Scale UV down 50% / 25% / Offset 0.5 / 0.25 etc… Time consume.) I believe there should be some Unity plugins which can do a great job too but I’m not sure about this.
Additional: This script should help out something.
http://docs.unity3d.com/ScriptReference/Texture2D.PackTextures.html
Ok thanks for the help!