The
Zen of Direct3D Game Programming
Author: Peter
Walsh
Publisher: Prima Tech (Now Premier
Press)
ISBN: 0-7615-3429-6
Purchasing: [Amazon.Com]
- RRP US$59.99
Reviewed: 29th May 2002
Front
Cover Shot:
Nice
Title
First
impressions of this book are good - almost simply
based on the title. If you have a good look at the
list of books reviewed on
this site you'll very quickly notice that,
whilst the titles all accurately represent the
content, they aren't usually the most imaginative
book titles ever to grace this planet.
"The
Zen of Direct3D..." - instantly an
interesting title, and definitely much more likely
to grab my attention if I were in a bookstore at
the moment.
However,
beyond the cool title, this is fairly simply
another
everything-you-need-to-know-about-Direct3D8 type
book. Not that there's anything hugely wrong with
this, up to a certain point, the more books on a
subject the better for the book-buying public. So,
what does this book have that sets it apart from
other books on Direct3D?
Start
from the top
This
book basically starts from square 1, with the only
prerequisite being your ability to program in
C/C++. Unlike many similar books, it doesn't waste
pages trying to teach us the C or C++ programming
language - all the better for it: if I wanted to
learn C++ I'd buy a book about that in particular!
There is a slight concession to this though, the
first appendix deals with the more general
features of C++ with respect to a 'C' coder who
wanted a quick crash-course.
The
book is a fairly large tome, weighing in at 840
pages covering 5 parts and 16 chapters (plus two
appendices). Given that 'Zen' (in layman's terms)
is being at 'one' with with your
environment/situation, this book is going to need
all the pages it can get. I'm just wondering, is
it possible to be completely at one with the
Direct3D API? it's an interesting idea...
Leave
no stone unturned
This
book doesn't go the full distance as far as
Direct3D is concerned - it stops at about the
point where you start diversifying into general
programming algorithms, special effects, shaders
etc... however, up until the point where it
finishes, it really does dig deep and leaves no
stone unturned.
The
book starts with standard Win32 graphics
programming - which once you've learnt D3D isn't a
whole lot of use to you really (apart from maybe
making tools). However, it does serve as a useful
stepping stone if you're completely new to the
whole Direct3D/DirectXGraphics experience. If
you're a veteran of 'normal' windows programming
then this will either be below your level, or at
best will serve as a brief refresher course in
windows graphics.
Once
you've finished the Win32 graphics section its
straight onto the wonderful world of Direct3D8.
Part 3 is where you first properly meet Direct3D,
yet it's initially limited (until part 4) to 2D
graphics only. This is quite a clever strategy -
jumping straight into the deep end with 3D
graphics requires you to also cover vector and
matrix math's to a certain level, which is what
often makes the learning curve considerably
steeper.
Learning
2D graphics in Direct3D is pretty much as simple
as learning the initialization process and then
the basic rules of triangle-based geometry
(although this book leaves this till part 4) and
the rendering process. This book takes it one step
further and covers custom font engines, consoles,
sprite classes and GDI interaction. Whilst each
individual component is relatively simple, the sum
of them all makes for a fairly in-depth analysis
of 2D graphics programming.
3D
graphics is a fairly similar affair - although it
has a hefty dose of 3D math, vector and matrix
theory before you get onto any applied discussion.
Most of the 3D graphics is left until we develop a
simple graphics engine ("Zen 3D engine")
- which is used as a case-study / worked example
through which you can finish off your learning.
Limitations
Unfortunately
there are a few limiting factors for this book,
the most obvious one will be the lack of depth at
the more complicated end. This I can live with,
asking one author to cover absolutely everything
in one book would be very difficult and probably a
foolish idea.
However, as far
as 'Zen' goes, there are a few little things that
the author seems to have skipped that I only
picked up on because I've got plenty of experience
with Direct3D. Namely that of triangle 'ordering'.
As far as the author is concerned a triangle is
defined by 3 vertices, full stop. But, as you may
know, there are several different ways of encoding
(and hence rendering) triangle data - lists,
strips and fans in particular. I covered this
topic in the 3rd tutorial in my Direct3D8
series, have a quick look at this
part to see what I mean. Technically you can
get by without this bothering you - and maybe as a
learning aid it's better, but sooner or later it
will catch you out. If you turn culling off (such
that vertex-order doesn't matter) you'll kill
performance, as well as using only triangle-lists
will not allow you to hit top-speed in your
engine. Sooner or later you're going to have to
come back to basics and learn it all - so why
isn't it included here?
My final gripe
with this "area" is that loading of
textures is pretty much brushed by - the majority
of hardware requires (and all hardware prefers)
textures to be a size 2n - 64,128,256
etc... but this isn't mentioned at all! only that
Direct3D will handle these things internally.
hmm...
Where
it's good, it's very good.
When
this book does a good job and properly covers an
area it is very good - second to none. However,
it's lack of long-term detail (this is strictly a
beginners book) and a couple of minor omissions
that I just mentioned scores against it for anyone
looking to go far with Direct3D.
Good
Things |
Bad
Things |
Well structured chapters and sections. |
Doesn't take things very far, and doesn't
offer many references for extended
reading. |
•
Nice chapter headings/titles. |
•
Misses a couple of essential parts
required for your long-term sanity :) |
•
Covers all the bases as far as getting
started is concerned |
•
did we need 150 pages of Win32 graphics
programming? |
•
Plenty of background theory and
explanation |
|
•
Doesn't make the mistake of spending
precious pages on teaching us C and/or C++ |
|
•
A good CD included, although not the best
one in the series. |
|
|