|
|
|
|
| |
Using the stencil buffer on the ATI
Rage128 with Direct3D
|
|
|
The R128Reflect sample program shows a simple use for the stencil buffer: providing a protected area on the render target outside which no rendering will take place. This helps to show the emulation of a reflective surface, where the reflections are not to be visible outside the area of the surface. Figure 1 shows R128Reflect in action.
|
|
Figure 1
|
|
- R128Reflect works as follows:
-
- Draw every original object other than the reflective surface normally.
- Put the shape of the reflective surface into the stencil buffer, but not on to the z-buffer or draw buffer.
- Reflect all the original objects in the plane of the reflective surface, and draw them wherever the stencil buffer is non-zero.
- Alpha-blend the reflective surface additively on to the draw buffer.
- R128Reflect Controls
-
- F1 - Help
- F2 - Select Driver/Device/Mode
- [ALT]+[ENTER] - Toggle fullscreen/windowed
- Up/Down Arrows - Move camera up/down
- Left/Right Arrows - Rotate scene left/right
- F3 - Toggle use of stencil
- [ESC] - Quit
Downloads
DirectX 6 project file, source, executable, and support files
|
| |
 |
|
|
|