Game Development Reference
In-Depth Information
renderer or the hardware rendered with the Prism engine, which can use OpenGL or
DirectX. You will still be responsible for correctly compositing, that is, providing anti-
aliasing for your multilayered imagery, using each image's alpha channel.
Digital Image Optimization: Using Compression, In-
dexed Color, and Dithering
There are a number of factors that affect digital image compression and some basic
techniques that you can use to achieve a better-quality result with a smaller data foot-
print. This is a primary objective in optimized digital imagery; obtaining the smallest
possible data footprint for your application (in this case, a game), while achieving the
highest quality visual result. Let's start with the aspects that most significantly affect
data footprint and examine how each of these contributes to data footprint optimization
for any given digital image. Interestingly, their order of significance is similar to the or-
der in which I have presented the digital imaging concepts thus far.
The most critical contributor to a resulting digital image asset file size is what I like
to call the data footprint , which is the number of pixels, or resolution of, a digital im-
age. This is logical, because each of the pixels needs to be stored, along with the color
and alpha values that are contained in their three (24 bit) or four (32 bit) channels. The
smaller you can get your resolution, while still having the image look sharp, the smal-
ler the resulting file size will be.
Raw (or uncompressed) image size is calculated by width × height × 3 for 24-bit
RBG images, and width × height × 4 for 32-bit ARGB images. For instance, an un-
compressed, truecolor, 24-bit VGA image will have 640 × 480 × 3, equaling 921,600B
of original (raw), uncompressed digital image data. To determine the number of kilo-
bytes in this raw VGA image, you would divide as follows: 921,600 ÷ 1,024, the num-
ber of bytes that are in a kilobyte, giving you an even 900KB of data in a truecolor
VGA image.
It is important to optimize for raw (uncompressed) image size by optimizing your
digital imagery resolution. This is because once an image is decompressed out of a
game application file, into system memory, this is the amount of memory that it is go-
ing to occupy, as the image will be stored pixel for pixel, using a 24-bit (RGB) or
32-bit (ARGB) representation in memory. This is one of the reasons I use PNG24 and
PNG32 for my game development, not indexed color (GIF or PNG8); if the OS is go-
ing to transmute the color to a 24-bit color space, then you should use that 24-bit color
space for quality reasons and deal with (accept) a slightly larger application file size.
Search WWH ::




Custom Search