Hidden Surfaces. Dr. Scott Schaefer. Hidden Surfaces. Hidden Surfaces. Hidden Surfaces. Backface Culling. Backface Culling. view direction. Backface Culling. view direction. Backface Culling. , draw polygon. view direction. Backface Culling. , cull polygon. view direction.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Dr. Scott Schaefer
view direction
view direction
counter clockwise orientation, draw polygon
clockwise orientation, cull polygon
3.1 Check if they overlap in x
 If not, they are fine
3.2 Check if they overlap in y
 If not, they are fine
 If yes, need to split one
 Need to find a plane to split one polygon by so that each new polygon is entirely in front of or entirely behind the other
 Polygons may actually intersect, so then need to split each polygon by the other
 Need to find a plane to split one polygon by so that each new polygon is entirely in front of or entirely behind the other
 Polygons may actually intersect, so then need to split each polygon by the other
 Preprocess: overlay a binary tree on objects in the scene
 Runtime: correctly traversing this tree enumerates objects from back to front
 Idea: divide space recursively into halfspaces by choosing splitting planes
Put front objects in the left branch
+

9
8
7
6

+
+

5
4
1
4
6
7
8
9
2
3
5
1
2
3
Put front objects in the left branch
+

9
8
7
6

+
+

5
4
1



+
+
+
1
2
3
3
2
4
5
6
7
9
8
Put front objects in the left branch
+

9
8
7
6

+
+

5
4
1



+
+
+
1
2
3
3
5
6
8
6


2
+
+
2
4
7
9
Put front objects in the left branch
+

9
8
7
6

+
+

5
4
1



+
+
+
1
2
3
3
5
6
8
6


2
+
+
2
4
7
9
When to stop the recursion?
 Split the object; give half to each node:
 Worst case: can create up to O(n3) objects!
Correctly traversing this tree enumerates objects from back to front
+

9
8
7
6

+
+

5
4
1



+
+
+
1
2
3
3
5
6
8
6


2
+
+
2
4
7
9
Traversal order?
Correctly traversing this tree enumerates objects from back to front
+

9
8
7
6

+
+

5
4
1



+
+
+
1
2
3
3
5
6
8
6


2
+
+
2
4
7
9
Traversal order:
8>9>7>6>5>3>4>2>1
6
72
52
3
71
51
1
2
4
1
b
3
f
b
72
71
b
b
f
4
6
Traversal order:
2
b
b
51
52
6
72
52
3
71
51
1
2
4
1
b
3
f
b
72
71
b
b
f
4
6
Traversal order:
6>(52)>(72)>3>(51)>4>(71)>2>1
2
b
b
51
52
6
72
52
3
71
51
1
2
4
1
b
3
f
b
72
71
b
b
f
4
6
Traversal order:
2
b
b
51
52
6
72
52
3
71
51
1
2
4
1
b
3
f
b
72
71
b
b
f
4
6
Traversal order:
1>2>(71)>4>(51)>3>(72)>(52)>6
2
b
b
51
52
6
72
52
3
71
51
1
2
4
1
b
3
f
b
72
71
b
b
f
4
6
Traversal order?
2
b
b
51
52
Take advantage of view direction to cull away polygons behind viewer
View frustum
Take advantage of view direction to cull away polygons behind viewer
Take advantage of view direction to cull away polygons behind viewer
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glClear(GL_COLOR_BUFFER_BIT  GL_DEPTH_BUFFER_BIT );
glCullFace ( GL_BACK );