Download as a PDF

Transcript
CHAPTER 5. RENDERING
33
(a) Anal fin does not
obscure pelvic fin
(b) Pelvic fin not obscuring other pelvic fin
(c) Pelvic fin not being obscured
Figure 5.3: Using the Stencil and Alpha Tests
In the first pass the alpha test is used to create a stencil mask in the stencil buffer, using the black
and white texture. The fragment’s value is discarded if the colour is black, (i.e. the background
is discarded). The second pass then uses this stencil from the stencil buffer to determine what
is finally drawn to the screen.
This method creates the exact shape fin desired. It has no artifacts, as in the alpha test method.
But the disadvantage of this method is that it is lot slower due to the stencil buffer being cleared
each and every time the fin is drawn.
Figures 5.3 and 5.4 show the fish using this method.