Game Development Reference
In-Depth Information
Figure 1.5: Presenting two
times. When using a swap
chain that contains two sur-
faces, we see that presenting
basically amounts to swapping
the surfaces.
Thus, the structure of our rendering code is:
1.
Render to back buffer.
2.
Present the back buffer.
3.
Goto (1).
1.3.6 Depth Buffers
The depth buffer is a surface that does not contain image data but
rather depth information about a particular pixel. There is an entry in
the depth buffer that corresponds to each pixel in the final rendered
image. So if the rendered image had a resolution of 640x480, there
would be 640x480 depth entries.
Figure 1.6: A group of objects that partially
obscure each other because one is in front of
another
Figure 1.6 shows a simple scene where some objects partially obscure
the objects behind them. In order for Direct3D to determine which pix-
els of an object are in front of another, it uses a technique called depth
buffering or z-buffering .
Depth buffering works by computing a depth value for each pixel
and performing a depth test. The depth test basically compares the
depths of pixels competing to be written to a particular pixel location.
 
Search WWH ::




Custom Search