Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Computer Graphics Week11 : Hidden Surface Removal.

Similar presentations


Presentation on theme: "1 Computer Graphics Week11 : Hidden Surface Removal."— Presentation transcript:

1 1 Computer Graphics Week11 : Hidden Surface Removal

2 We learned how to eliminate the back-facing polygonal surfaces of our model using a technique called back-face culling. 2 A sphere obstructing a cone: back-face culling is on

3  But when we draw our object as a solid surface, we want to see the object that is in front.  This example shows a solid cone and a sphere. The cone translates back and forth along the z- axis. 3 A cone a. in front of the sphere, b. behind the sphere

4 Even when the cone is behind the sphere, we still see it being drawn in front! We want not only the back surfaces of the sphere and cone to be hidden from view, but also the portion of the cone being obstructed from view by the sphere. The process to remove these surfaces is called hidden surface removal. Back-face culling is part of this removal process. 4

5 Z-Buffering One of the simplest techniques to accomplish hidden surface removal is known as z-buffering or depth buffering. In this process, a buffer in memory called the z- buffer is used to keep track of the surface that is closest to the eye for any given pixel. The closest object finally gets drawn onto the screen. 5

6 Note that for solid closed objects, this process will automatically remove back-facing surfaces also. OpenGL provides z-buffering by way of a depth buffer. To use it, you need to first enable depth buffering. You can do this by initializing the display mode to use the depth buffer 6

7 and then enabling the depth-buffering test Before drawing the scene, you need to clear the depth buffer and then draw the objects in the scene. Open GL will perform all the calculations to store the closest surface information in its depth buffer and draw the scene accordingly. 7


Download ppt "1 Computer Graphics Week11 : Hidden Surface Removal."

Similar presentations


Ads by Google