Game Development Reference
In-Depth Information
practically any object other than a wall. A hole will appear in the middle
of the object, and this hole will expand as you move closer.
10.3.5
Screen Space
Once we have clipped the geometry to the view frustum, it is projected
into screen space, which corresponds to actual pixels in the frame buffer.
Remember that we are rendering into an output window that does not
necessarily occupy the entire display device. However, we usually want our
screen-space coordinates to be specified using coordinates that are absolute
to the rendering device (Figure 10.9).
Screen space is a 2D space, of course. Thus, we must project the points
from clip space to screen space to generate the correct 2D coordinates.
The first thing that happens is the standard homogeneous division by w.
(OpenGL calls the result of this division the normalized device coordinates.)
Then, the x- and y-coordinates must be scaled to map into the output
window. This is summarized by
screen x = clip x
winRes x
2 clip w
Projecting and mapping
to screen space
+ winCenter x ,
(10.8)
screen y = − clip y
winRes y
2 clip w
+ winCenter y .
(10.9)
A quick comment is warranted about the negation of the y component in
the math above. This reflects DirectX-style coordinate conventions where
Figure 10.9. The output window in screen space
 
Search WWH ::




Custom Search