Visible Surface Detection - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Visible Surface Detection

Description:

... the detection of which surfaces are completely hidden with respect to the camera ... of the surfaces which are hidden with respect to the camera. Shadows ... – PowerPoint PPT presentation

Number of Views:250
Avg rating:3.0/5.0
Slides: 22
Provided by: isabellebi
Category:

less

Transcript and Presenter's Notes

Title: Visible Surface Detection


1
Visible Surface Detection
2
Agenda
  • Visibility culling
  • Hidden-surface elimination
  • OpenGL visibility-detection functions

3
Learning Objectives
  • Understand how graphics systems perform
    visible-surface detection and hidden-surface
    elimination
  • Understand the OpenGL functions for visibility
    detection

4
Some Definitions
  • Visible surface detection, or hidden surface
    elimination, refer to the methods and algorithms
    to determine which parts of which surfaces of a
    scene are visible from a chosen viewing position.

5
Some Definitions
  • Visibility culling refers to the detection of
    which surfaces are completely hidden with respect
    to the camera
  • Hidden-surface eliminationrefers to the
    elimination of the parts of the surfaces which
    are hidden with respect to the camera
  • Shadowsrefer to the determination of the parts
    of the surfaces which are hidden with respect to
    the light sources

6
Visibility Culling
  • Main methods
  • View frustum culling do not draw objects
    outside of the view frustum
  • Back face culling do not draw surfaces facing
    backwards from the camera
  • Occlusion culling do not draw objects completed
    occluded by other objects

7
Back Face Detection
  • Back face detection
  • Locates the back faces of a polyhedron
  • Back faces should not be drawn
  • Back faces are facing backwards with respect to
    camera
  • Simple test Vview . N 0
  • More simple test, if N (A, B, C), C

8
(No Transcript)
9
Hidden Surface Elimination
  • Main methods
  • Object space by object comparison
  • Depth sorting method
  • Image space pixel by pixel
  • Depth buffer method
  • Scan line method
  • Ray casting

10
Depth Sorting Method
  • Depth sorting method
  • Also called the painters algorithm starts by
    background, then most distant objects, then
    nearest objects, and foreground is painted last
  • Sorts the surfaces in order of increasing depth
  • Surfaces are scan-converted in order, starting
    with the surface of greatest depth

11
Depth Buffer Method
  • Depth buffer method
  • Also called the z-buffer method.
  • Compares surface depth values throughout a scene
    for each pixel position on the projection plane.
  • Only the pixel with the smallest depth value is
    shown.
  • For each pixel, only the color of depth of the
    closest object is shown.
  • Depths are interpolated from vertices just like
    colors.

12
(No Transcript)
13
Scan Line Method
  • Scan line method
  • Scan line algorithm computes the depth values
    along the scan lines for a scene.
  • For each scan line, algorithm constructs and
    sorts spans.
  • For each scan line, algorithms sorts depths
    within each scan line.

14
(No Transcript)
15
Ray Tracing Method
  • Ray tracing method
  • Traces a ray for every pixel
  • Objects intersecting this ray are visible
  • If ray intersects multiple objects, take the
    closest
  • Only shades each pixel once
  • Algorithm is slow

16
(No Transcript)
17
Raytracing
From Alan Watt, 3D Computer Graphics
18
OpenGL Visibility Detection Functions
  • Polygon cullingglEnable (GL_CULL_FACE)glCullFa
    ce (mode) // mode GL_BACKthis removes the
    back faces GL_FRONT would remove the front
    faces, and GL_FRONT_AND_BACK removes all polygon
    surfaces.Default GL_BACKglDisable
    (GL_CULL_FACE)

19
OpenGL Visibility Detection Functions
  • Depth buffer functionsglutInitDisplayMode
    (GLUT_SINGLE GLUT_RGB GLUT_DEPTH)request
    depth bufferglClear(GL_DEPTH_BUFFER_BIT)initi
    alizes the depth bufferglEnable
    (GL_DEPTH_TEST)activates depth-buffer
    visibility detection routinesglDisable
    (GL_DEPTH_TEST) disables this

20
OpenGL Visibility Detection Functions
  • Wire-frame surface-visibility functionsglPolygon
    Mode (GL_FRONT_AND_BACK, GL.GL_LINE)request to
    generate only the edges of a polygon aka
    wireframeglEnable (GL_POLYGON_OFFSET_FILL)dep
    th-offset method to be used to eliminate the
    hidden edgesglDisable (GL_POLYGON_OFFSET_FILL)
    disables thisexample in Chap9Visible.java

21
OpenGL Visibility Detection Functions
Write a Comment
User Comments (0)
About PowerShow.com