Docsity

Surface Detection Methods - Computer Graphics - Lecture Slides, Slides of Computer Graphics

Partial preview of the text

Download Surface Detection Methods - Computer Graphics - Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Surface Detection Methods

Contents

  • Today we will start to take a look at visible surface detection techniques: - Why surface detection? - Back face detection - Depth-buffer method - A-buffer method - Scan-line method

Two Main Approaches

  • Visible surface detection algorithms are broadly classified as: - Object Space Methods: Compares objects and parts of objects to each other within the scene definition to determine which surfaces are visible - Image Space Methods: Visibility is decided point- by-point at each pixel position on the projection plane
  • Image space methods are by far the more common

Back-Face Detection

  • The simplest thing we can do is find the faces on the backs of polyhedra and discard them

Back-Face Detection (cont…)

  • Ensure we have a right handed system with the

viewing direction along the negative z -axis

• Now we can simply say that if the z component

of the polygon’s normal is less than zero the surface cannot be seen

Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004) Docsity.com

Back-Face Detection (cont…)

  • In general back-face detection can be expected to eliminate about half of the polygon surfaces in a scene from further visibility tests
  • More complicated surfaces though scupper us!
  • We need better techniques to handle these kind of situations

Depth-Buffer Method (cont…)

Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004) Docsity.com

Depth-Buffer Algorithm

  1. Initialise the depth buffer and frame buffer so

that for all buffer positions ( x, y )

  • depthBuff(x, y) = 1.
  • frameBuff(x, y) = bgColour

Calculating Depth

  • At any surface position the depth is calculated from the plane equation as:

• For any scan line adjacent x positions differ by

±1, as do adjacent y positions

C

Ax By D

z

C

A x By D

z

C

A

z '= z −

Iterative Calculations

  • The depth-buffer algorithm proceeds by starting at the top vertex of the polygon

• Then we recursively calculate the x -coordinate

values down a left edge of the polygon

• The x value for the beginning position on each

scan line can be calculated from the previous one

m

x x

' = − where m is the slope

Iterative Calculations (cont…)

top scan line

bottom scan line

y scan line y - 1 scan line

x x’

A-Buffer Method

  • The A-buffer method is an extension of the depth-buffer method
  • The A-buffer method is visibility detection method developed at Lucasfilm Studios for the rendering system REYES ( R enders E verything Y ou E ver S aw)

A-Buffer Method (cont…)

  • If depth is >= 0, then the surface data field stores the depth of that pixel position as before
  • If depth < 0 then the data filed stores a pointer to a linked list of surface data

A-Buffer Method (cont…)

  • Surface information in the A-buffer includes:
    • RGB intensity components
    • Opacity parameter
    • Depth
    • Percent of area coverage
    • Surface identifier
    • Other surface rendering parameters
  • The algorithm proceeds just like the depth buffer algorithm
  • The depth and opacity values are used to determine the final colour of a pixel Docsity.com