Hide the back in graphic rendering

Source: Internet
Author: User

In 3D graphics, a triangle element has two surfaces.

In dx, we think that in the camera coordinate system, the side of the triangle that you observe is clockwise and the other side is the back, while in OpenGL, the opposite is better. (The vertex direction is also called surround)

DX is the left-hand coordinate system, while OpenGL is the right-hand coordinate system.

DX:

D3drs_cullmode, Drawing status

Usage: Device-> setrenderstate (d3drs_cullmode, X );

X value
1. d3dcull_none // completely disable backend hiding
2. d3dcull_cw // only fades out triangles in clockwise order.
3. d3dcull_ccw // only fades out the triangles in the clockwise direction (the default value is in the blanking)

DX reference: http://blog.csdn.net/yaoxinchao/article/details/7982099

OpenGL:

Void Glfrontface(Glenum Mode) Is used to control how the front of a polygon is determined. By default, it is gl_ccw (counterclockwise ). Gl_ccw indicates that the vertex sequence of the projection Polygon on the window coordinate is clockwise and the surface is positive. Gl_cw indicates that the face in clockwise direction of the vertex is positive. Gl_cull_face: gldisable (gl_cull_face). Disable glcullface: Specify the glcullface () parameters of the polygon face removal operation, including gl_front and gl_back. Disables illumination, shadow, and color calculation and operations on the front or back of a polygon to eliminate unnecessary rendering calculations. In summary, if we set to draw only the triangle elements on the front side during the backend hiding, in your pilot project, if this triangle element is identified as the front, it is drawn and removed if it is regarded as the back (this triangle will not be rendered, instead of removing the surface of the back of the triangle ), therefore, we need to ensure that the vertices of a closed model are consistent. If they are inconsistent and the backend is used to hide them, we may see that part of the model is missing.

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: info-contact@alibabacloud.com 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.