|
This sample illustrates how to transfer an image mask to the stencil buffer, and utilizes this technique to perform a dynamic wipe between two 3D scenes. Rendering of the scene begins by rendering of a texture over the entire screen, which includes an alpha channel that contains the image mask. After disabling writes to the color and depth buffers, we enable alpha testing and set stencil function to increment the stencil value of every pixel that passes the alpha test. Following the application of the alpha mask to the screen, we then render two different scenes. For the first scene, we set the stencil function so that only those pixels with a stencil value equal to zero are written to. Pixels with a non-zero stencil buffer value are left undisturbed, preserving their color and depth values. The second scene is rendered, after configuring the stencil function to write only to those pixels with non-zero stencil values. Finally, the composite scene is presented, as seen in the screen grab above. By manipulating the texture coordinates of the alpha mask primitives, quickly moving the mask from side to side while shearing the texture vertically, we achieve a very fluid and artistic transition between the two scenes. |
Visitors Since 1/1/2000:
|