Textures

While we have been emphasizing the Power Of Two, it is for a reason. Not only will they be more efficient, they also won't need rescaling at build time. As we have already said, in Unity you can use up to 4096x4096 pixels (make sure that you use these units in your graphics program), but 2048x2048 pixels is the highest available on many graphics cards and platforms. In other words, your game might not run with Textures higher than 2048x2048. So, if you build an absolutely fabulous 4096x4096 pixels Texture, it probably won't be such an absolutely fabulous experience for those on low-end devices. The best way to overcome this issue is to create Textures in a high resolution (4096x4096 pixels) and then downsize to a smaller power of 2 depending on your targeted device, as this is likely to vary. This goes for all repeated elements (for example, windows, doors, environmental assets) that will be within your scene.

Moreover, Power Of Two (POT) Textures (which have dimensions with a number of pixels corresponding to a POT) are recommended over Non-Power Of Two (NPOT) Textures because they are better for computational reasons (for example, more efficiency at runtime). We will look at the disadvantages and advantages of both, so you can see why:

  • POT advantages: Always supported by any graphics card.
  • POT disadvantages: Requires more disk space. Needs to be handled by the engine to only draw the parts that are needed if the image data inside the Texture does not use all pixels (in most cases, this is true and means extra work to be done by the graphics/game engine).
  • NPOT advantages: Uses Textures as they are; no waste of disk space per Texture file.
  • NPOT disadvantages: Not supported by all graphics cards. Might cause slower draw calls. Some graphics cards will show empty white or black rectangles, or the whole application will just crash. While saving some disk space to store the image file, it is going to waste VRAM when the Texture is uploaded to the graphics card as it will still be aligned in memory as if it were a POT image. The wasted pixel data might even cause pixel bleeding, which will show up as some fuzzy borders that haven’t been drawn anywhere in Textures but are added by graphics card drivers through mipmapping Textures.
There's also the possibility to mix POT sizes per axis, for example, 128x1024. This can work but it doesn't have to on all graphics cards, so POT with the same size for both axes is the best way to go for maximum co-compatibility.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset