The use of Dragon Book 9 Chapter8 Stencil

Source: Internet
Author: User

Note 1: First is the experience of the mirror example.

The overall process is:

1. Draw a normal object; Clear the stencil of each pixel 2. Set the stencil value of the specular area as the reference value 1 3. Determines whether the stencil value of each pixel is 1 after render, and the teapot entity is drawn if the condition is met

It is important to note that:

1. Draw the stencil area is 1 o'clock, our aim is only to change the pixel stencil, the other values do not change, so: first prohibit the ZBuffer write, followed by the drawing set is not visible, that is, the use of mixing, set the source Alpha zero.

2. When drawing the mirror teapot, because the z-value of the mirror under Carmen observation is less than mirror, the occlusion of depth z is avoided and the zbuffer is emptied. Second, let the Mirror look and mirror together.

3. Modification of the reverse blanking mode. The default CWW mode, which is drawn clockwise, but the teapot within the mirror is exactly the part of the back blanking, so change the cull mode to CW.

Mathematical aspect: Find point V for planar np+d=0 symmetrical Mirror point coordinates.

The use of Dragon Book 9 Chapter8 Stencil

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.