1
\$\begingroup\$

I'm researching new ways to optimize games for better performance. Currently I am working on texture atlasing, which is giving me a hard time. I made the atlas using Texture2D.PackTextures and saved the offset and height and width values to a text file.

Now when I insert the values to a material the texture is shown correctly, but since batching requires that the same material is used - how I can I use the same material with different offsets?

enter image description here

Picture: All the cubes use the same texture. Only the two on the right batch as they use the same material.

\$\endgroup\$
1
\$\begingroup\$

I think you have 3 options:

  1. Change UVs to point directly to the object on the texture atlas (in effect having N:N meshes:textures)
  2. Create a seperate material per texture
  3. If you change tiling via script it should work on the same material (although it might just be creating a clone of the current material)

P.S. I haven't read the whole post but it seems to be discussing your question: http://answers.unity3d.com/questions/276212/what-is-the-simple-way-of-applying-texture-atlas-t.html

\$\endgroup\$
1
  • \$\begingroup\$ Pointing UVs directly to the texture atlas on a modeling software did the trick, but changing the material coordinates in a script just created another instance of that material(no batching). \$\endgroup\$ – Esa Aug 13 '13 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.