In practice, 3D accelerators actually perform back-face culling by them-
selves, so as the triangle rates of cards increase, the amount of manual
back-face culling that is performed has steadily decreased. However, the
information is useful for custom 3D engines that don’t plan on using the
facilities of Direct3D.
Clipping Lines
One thing that you’ll need is the ability to take two points (a and b) that
are on different sides of a plane defining a line segment, and find the point
making the intersection of the line with the plane.
This is easy enough to do. Think of this parametrically. Point a can be
thought of as the point at time 0 and point b as the point at time 1, and
the point of intersection you want to find is somewhere between those
Take the dot product of a and b. Using them and the inverse of the
plane’s d parameter, you can find the scale value (which is a value between
0 and 1 that defines the parametric location of the particle when it inter
sects the plane). Armed with that, you just use the scale value, plugging it
into the linear parametric equation to find the intersection location. Figure
4.17 shows this visually.
148 n Chapter 4: 3D Math Foundations
Figure 4.16: A visual example of back-face culling

Get Advanced 3D Game Programming with DirectX 10.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.