Computer Graphics 14: Surface Detection Methods

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
Computer Graphics- SCC 342
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
03/12/02 (c) 2002 University of Wisconsin, CS559 Last Time Some Visibility (Hidden Surface Removal) algorithms –Painter’s Draw in some order Things drawn.
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Course Website: Computer Graphics 4: Viewing In 2D.
Computer Graphics Viewing.
May Visible Surface Detection Shmuel Wimer Bar Ilan Univ., Eng. Faculty Technion, EE Faculty.
Computer Graphics1 The A-buffer an Antialiased Hidden Surface Method.
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
Course Website: Computer Graphics 18: Ray-tracing.
Course Website: Computer Graphics 15: More Surface Detection Methods.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 of 29 Interesting Illumination Demo There’s a very nice Java illumination model demo which may help you understand the effects of different kinds of.
Course Website: Computer Graphics 9: Clipping In 3D.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
Hidden Surface Removal
Graphics Pipeline Hidden Surfaces CMSC 435/634. Visibility We can convert simple primitives to pixels Which primitives (or parts of primitives) should.
Graphics Pipeline Hidden Surface CMSC 435/634. Visibility We can convert simple primitives to pixels/fragments How do we know which primitives (or which.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Polygon Scan Conversion and Z-Buffering
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
Visible-Surface Detection Methods
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Visible-Surface Detection Jehee Lee Seoul National University.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
Advanced HSR Methods Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday, January 30, 2004.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Visible-Surface Detection Methods
CS 325 Introduction to Computer Graphics 03 / 22 / 2010 Instructor: Michael Eckmann.
Hidden Surface Removal
Implementation II.
1 3D Hidden Surface Removal 김 성 남. 2 Contents Goal Motivation Approaches - back face detection - depth buffer - A-buffer - Scan line - Depth.
Visible Surface Detection
Computer Graphics I, Fall 2010 Implementation II.
Honours Graphics 2008 Session 5. Today’s focus Rasterization Visibility determination Coarse / fine visibility determination.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
01/28/09Dinesh Manocha, COMP770 Visibility Computations Visible Surface Determination Visibility Culling.
Visible surface determination. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are.
CS 325 Introduction to Computer Graphics 03 / 10 / 2010 Instructor: Michael Eckmann.
1 Computer Graphics Week11 : Hidden Surface Removal.
Learning Objectives Classification of Visible Surface Detection Algorithms Classification of Visible Surface Detection Algorithms Back-Face Detection Back-Face.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Lecture 30: Visible Surface Detection
Visible Surface Detection
Computer Graphics Implementation II
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
BACK FACE DETECTION back-face detection Determination of whether a face of an object is facing backward and therefore invisible. The usual test is whether.
Visible-Surface Detection Methods
Chapter 14 Shading Models.
Computer Graphics 9: Clipping In 3D
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Chapter 14 Shading Models.
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Computer Graphics 14: 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

Why? We must determine what is visible within a scene from a chosen viewing position For 3D worlds this is known as visible surface detection or hidden surface elimination

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…) We know from before that a point (x, y, z) is behind a polygon surface if: where A, B, C & D are the plane parameters for the surface This can actually be made even easier if we organise things to suit ourselves

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)

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 Compares surface depth values throughout a scene for each pixel position on the projection plane Usually applied to scenes only containing polygons As depth values can be computed easily, this tends to be very fast Also often called the z-buffer method

Depth-Buffer Method (cont…) Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

Depth-Buffer Algorithm Initialise the depth buffer and frame buffer so that for all buffer positions (x, y) depthBuff(x, y) = 1.0 frameBuff(x, y) = bgColour

Depth-Buffer Algorithm (cont…) Process each polygon in a scene, one at a time For each projected (x, y) pixel position of a polygon, calculate the depth z (if not already known) If z < depthBuff(x, y), compute the surface colour at that position and set depthBuff(x, y) = z frameBuff(x, y) = surfColour(x, y) After all surfaces are processed depthBuff and frameBuff will store correct values

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

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 where m is the slope

Iterative Calculations (cont…) Depth values along the edge being considered are calculated using

Iterative Calculations (cont…) top scan line y scan line y - 1 scan line bottom 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 (Renders Everything You Ever Saw)

A-Buffer Method (cont…) The A-buffer expands on the depth buffer method to allow transparencies The key data structure in the A-buffer is the accumulation buffer

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

Scan-Line Method An image space method for identifying visible surfaces Computes and compares depth values along the various scan-lines for a scene

Scan-Line Method (cont…) Two important tables are maintained: The edge table The surface facet table The edge table contains: Coordinate end points of reach line in the scene The inverse slope of each line Pointers into the surface facet table to connect edges to surfaces

Scan-Line Method (cont…) The surface facet tables contains: The plane coefficients Surface material properties Other surface data Maybe pointers into the edge table

Scan-Line Method (cont…) To facilitate the search for surfaces crossing a given scan-line an active list of edges is formed for each scan-line as it is processed The active list stores only those edges that cross the scan-line in order of increasing x Also a flag is set for each surface to indicate whether a position along a scan-line is either inside or outside the surface

Scan-Line Method (cont…) Pixel positions across each scan-line are processed from left to right At the left intersection with a surface the surface flag is turned on At the right intersection point the flag is turned off We only need to perform depth calculations when more than one surface has its flag turned on at a certain scan-line position

Scan Line Method Example Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

Scan-Line Method Limitations The scan-line method runs into trouble when surfaces cut through each other or otherwise cyclically overlap Such surfaces need to be divided Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)

Summary We need to make sure that we only draw visible surfaces when rendering scenes There are a number of techniques for doing this such as Back face detection Depth-buffer method A-buffer method Scan-line method Next time we will look at some more techniques and think about which techniques are suitable for which situations