100 likes | 267 Views
Inside-Outside & Culling. Introduction to Computer Graphics CSE 470/598 Arizona State University Dianne Hansford. Rendering Polygons. A polygon has two sides front & back front is outward normal side Can render front & back differently Great for cutaways.
E N D
Inside-Outside & Culling Introduction to Computer Graphics CSE 470/598Arizona State University Dianne Hansford
Rendering Polygons • A polygon has two sides • front & back • front is outward normal side • Can render front & back differently • Great for cutaways Figure from Diepstraten et. al. “Interactive Cutaway Illustrations”http://www.vis.uni-stuttgart.de/ger/research/pub/pub2003/eg2003-diepstraten.pdf
Polygons: Front & Back • Convention: front facing polygon vertices appear counterclockwise (ccw) on the screen 3 back facing 3 2 1 front facing 1 2 outward facing normals
Front Facing Polygon • Eye coordinates • Eye at origin • Looking at geometry down –z axis 3 v2 e3¢n >= 0 outward facing n v1 1 2 e3
Solids • Closed geometry called a solid • Reasonable solids* can be constructed from polygons of consistent orientation • sphere, torus, ... • Opaque closed surface: no back facing polygons visible • Moebius strip/Klein bottle – not orientable • Escher’s Moebius strip: http://worldofescher.com • Klein bottle: http://alem3d.obidos.org/i/kbottle/kbc1.jpg * also called orientable manifold
Culling • Culling is another form of clipping • removing polygons from the pipeline • speed up rendering • Culling removes back facing polygons • makes sense for solids • example: back facing polygons of a sphere • Happens in NDC coordinates
Culling of Solids cos(theta) = n . e_3
Culling for non-closed surfaces no culling culling used inappropriately
OpenGL & Culling • glEnable(GL_CULL_FACE) • glDisable(GL_CULL_FACE) • glCullFace(GL_BACK) • Also: GL_FRONT, GL_FRONT_AND_BACK • glFrontFace(GL_CCW) (default) • Also: GL_CW