Game Development Reference
In-Depth Information
Imagine it as though you have a dishwasher that can hold four plates. You
need to wash nine plates. You would do two full cycles and then have only
one plate in the third cycle. For the same amount of dishwashing you could
have invited another three guests to dinner! This illustration is exacerbated
as file sizes become larger.
If you sacrifice processing cycles, you will sacrifice quality and speed. Ideally,
images should have width and height values that are a power of two, for
example, 2, 4, 8, 16, 32, 64, 128, 256, etc. The image does not need to be
square; for example, the width could be 16 and the height 128. Making
an image this size in dimension will lead it to occupy a space in computer
memory that is also a power of two in size.
A digitized image is not just the size of its width and height, but also its
depth—its color depth . The color depth is defined as the number of bits
required to store the color values of each pixel. When a pixel is colored
according to its red, green, blue, and alpha values that take up 8 bits
(1 byte) each, it is said to have a color depth of 32 bits.
Therefore, an image that is 16 × 32 pixels with a color depth of 32 bits is
16,384 bits in total size. This is equal to 2 14 ; a power of two! Because computer
memory processes in chunks whose sizes are also a power of two, it will result
in an optimized use of each processing cycle.
But what happens if your texture is not a power of two? Your image will
be resized or rescaled. If it is rescaled, the game engine will make it into
an image with a power of two width and height closest to that of the
original. This means the original image will be squashed or stretched to
fit into the new space. This could result in undesirable distortions in the
texture. If the image is resized, the original could be cut off or extra blank
space added around the edges in order to make it fit into a power of two
texture. Either way, the result could be something that you don't want as
it may misalign your UV mapping.
Unity Specifics
Unity will accept nonpower of two images as textures but it will rescale
them. It accepts widths and heights of 2, 4, 8, 16, 32, 64, 128, 256, 512,
1024, or 2048 pixels. The majority of image file formats are accepted,
including psd, tiff, jpg, tga, png, gif, bmp, iff, and pict. A multilayered psd
file created with Photoshop will appear flattened inside the Unity Editor;
however, the layers will still be there and editable when reopened in
Search Nedrilad ::

Custom Search