- Home /
Texture mapping for performance
Hi,
I'm trying my best to use best practise in my game and optimize where possible. A friend of mine was saying how I should use a 2048x2048 texture for my ENTIRE level, so that the engine only has to load one texture file.
I can understand that logic behind trying to cram as much as I can into a texture, but it's certainly a much harder way of working especially when I want to make as many reusable prefabs as possible.
I was wondering if this is actually good advice, is using more texture files (and subsequently more materials) in my scene going to hurt performance?
You might want to look at the free version of NGUI for optimizing your GUI calls and its texture atlas; not really the same as your question re: the entire level, but I'm thinking along the same lines as you for my project - optimize - and stumbled on free NGUI.
Answer by jtbentley · Aug 29, 2010 at 02:28 AM
On a PC, you really do need to throw quite a lot of textures at it to hurt performance. However, you should always prototype fast, then optimise, optimise, optimise.
I have yet to build a PC App (I'm an iPhone guy, meh), but for iPhone I'll try squeeze as many things onto a single 1024x1024 texture as possible. Often, an entire level can be fit onto a single map, two at most.
Moral of the story is - Squeeze as much onto a single map as you can, but for the sake of ease, you can do it logically. Levels are a map, enemies are a single map, gui is all a single map, etc.
Answer by Jessy · Aug 23, 2010 at 09:52 AM
It's not worth making a texture atlas for the reason your friend is suggesting. If you're using the same shader, and shader settings, on multiple objects, it's often a good idea to make a texture atlas, because then all the objects can use the same material. With Unity iPhone, this will happen automatically with batching, and in other versions of Unity, you can use Mesh.CombineMeshes. (Batching may be a feature found in other versions of Unity in the future, but as of Unity 3 beta 5, it doesn't seem to be supported for the standalone or web platforms.)
Your answer
![](https://koobas.hobune.stream/wayback/20220613071850im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Why does my game require so much rendering power? 1 Answer
textures vs textureless 2 Answers
Creating a shader that shows a texture through a decal 0 Answers
What is the simple way of applying Texture Atlas to Unity 3 Answers