Game Development Reference
In-Depth Information
n Lighting: Each object in range of a light source is illuminated by calculating
additional colors applied to each vertex.
n Rasterization: Polygons are drawn, sometimes in many passes, to handle addi-
tional effects such as lighting and shadows.
Graphics pipelines also come in two flavors: fixed-function and programmable. The
fixed-function pipeline sets rendering states and then uses those states to draw ele-
ments with those exact states. A programmable pipeline is much more flexible
it
allows programmers to have detailed control over every pixel on the screen. Many
systems, like the Nintendo Wii, still use a fixed-function pipeline. Modern graphics
cards running Direct3D 10 or above and consoles like the Xbox360 and the PS3 use
a programmable pipeline.
Knowing both fixed-function and programmable pipelines can be a really useful
thing, but there are only so many trees in the forest, and I think it is best that this
chapter focus on a programmable pipeline, specifically Direct3D 11. For those of you
who are still running on a system that can
'
t use Direct3D 11, like a Windows XP
machine, don
'
t worry. All the code that accompanies this topic contains code for
Direct3D 9
s fixed-function pipeline. The 3D graphics chapters in this topic only
describe Direct3D 11, but if you are interested in Direct3D 9, you can find more
information about it in the third edition of this topic or in comments in the source
code.
Before you see Direct3D 11, I
'
m going to take a quick shortcut through two math
classes you probably slept though in high school or college. I know that because I
slept through the same classes
'
trigonometry and linear algebra.
3D Math 101
I
ve succeeded if I get through
writing it without losing consciousness. This stuff can make your eyes glaze over.
Remember one thing: You must understand the math, or you
'
ll try my best to make this topic interesting. I
'
ll know I
'
'
ll be hopelessly con-
fused if you attempt any 3D programming. Sure, you ' ll be able to compile a DirectX
sample program, tweak some parameters, and make some pretty pictures. Once you
leave
Sampleland
and start making changes to your 3D code, however, you won
'
t
have a clue why your screen is black and none of the pretty pictures show up. You
ll
attempt to fix the problem with random tweaks of various numbers in your code,
mostly by adding and removing minus signs, and you
'
'
ll end up with the same black
screen and a mountain of frustration.
 
 
Search WWH ::




Custom Search