Game Development Reference
In-Depth Information
When it comes down to it, there are two types of art assets used in games: 2D
and 3D. Two-dimensional art assets are the most used, as everything in the
game has a 2D visual element. From trees to buildings, terrain to explosions,
and characters to user interfaces they all include 2D art. In addition, normal
maps and shading maps are also 2D images.
1.6.1 The Power of Two Rule
Since the inception of computer graphics, people have been trying to create
superior and higher resolution images. The quality has not been restricted by
the ability of art to create, but by the computer hardware's ability to process.
In the mix with computer games is the need to quickly render frame after
frame of real-time animation that changes with game flow influenced by user
input. Unlike an animated movie in which the contents of each frame are
known from the outset, the interactive nature of a computer game means that
the artist will never know what will be in any particular frame. The game itself
needs to render frames on the fly. This requires a lot of processing power. This
is why, over the years, as hardware performance has improved, so too has the
quality of game graphics.
However, as a game developer you will still want to push the boundaries of
quality and knowing a few simple tricks can help you optimize your art assets
to get the best out of the graphics processing. One such trick is to follow the
power of two rule.
Computers continuously process data in cycles in order to push it through
the processors, whether it be the central processing unit or, more commonly
for graphics, the graphical processing unit. Processors can only handle
so much data in one cycle and therefore it is chunked into packages
of certain sizes.
Earlier in this chapter we examined the most elementary values in
computing. They were 0 for on and 1 for off. These values are the basis for
binary code that is used to encrypt all values in computer memory. The
smallest amount of computer memory is a bit . It can store either a 0 or a 1.
If we put two bits together they can store four values: 00, 01, 10, or 11. Three
bits can store eight values: 000, 001, 011, 010, 011, 100, 101, or 111. In fact,
the number of values that can be stored is 2 to the power of the number
of bits or 2 number of bits . Therefore, eight bits (called a byte) can store 2 8
or 256 values.
A computer processor has a limited number of bytes it can push through in
one cycle. By making an image file a power of two in dimensions, it optimizes
the number of cycles required to process it. For example, if an image were
nine bytes in size and the processor could process four bytes per cycle, the
first two bytes of the image could be processed in two cycles. On the third
cycle the ninth byte would be processed. This would mean three whole
empty bytes of space wasted during the third cycle.
Search Nedrilad ::




Custom Search