Visible-Surface Detection 1. 2IV60 Computer graphics set 11: Hidden Surfaces. Visible-Surface Detection 3. Visible-Surface Detection 2

Similar documents
Visible Surface Detection Methods

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

CS488. Visible-Surface Determination. Luc RENAMBOT

Visible Surface Detection. (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

Werner Purgathofer

CEng 477 Introduction to Computer Graphics Fall 2007

Computer Graphics II

Computer Graphics. Bing-Yu Chen National Taiwan University

8. Hidden Surface Elimination

Visible-Surface Detection Methods. Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin

The Traditional Graphics Pipeline

RASTERIZING POLYGONS IN IMAGE SPACE

The Traditional Graphics Pipeline

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

9. Visible-Surface Detection Methods

Spatial Data Structures

Spatial Data Structures

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

The Traditional Graphics Pipeline

Hidden surface removal. Computer Graphics

Ray Tracing. Outline. Ray Tracing: History

Hidden Surface Removal

Hidden-Surface Removal.

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Drawing the Visible Objects

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

More Visible Surface Detection. CS116B Chris Pollett Mar. 16, 2005.

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Spatial Data Structures

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Spatial Data Structures

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

Today. CS-184: Computer Graphics. Lecture #10: Clipping and Hidden Surfaces. Clipping. Hidden Surface Removal

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Lecture 4. Viewing, Projection and Viewport Transformations

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Lecture 11: Ray tracing (cont.)

Computer Graphics: 8-Hidden Surface Removal

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Pipeline Operations. CS 4620 Lecture 10

Topic #1: Rasterization (Scan Conversion)

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Ray Tracing Foley & Van Dam, Chapters 15 and 16

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Real-Time Shadows. André Offringa Timo Laman

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

(Refer Slide Time 03:00)

CS Computer Graphics: Hidden Surface Removal

Supplement to Lecture 16

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Computer Graphics. Lecture 9 Environment mapping, Mirroring

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Graphics and Interaction Rendering pipeline & object modelling

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Hidden Surface Elimination: BSP trees

General Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

4.5 VISIBLE SURFACE DETECTION METHODES

Visibility: Z Buffering

Chapter 4. Chapter 4. Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 1

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Visibility. Welcome!

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks)

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

VIII. Visibility algorithms (II)

CS 130 Exam I. Fall 2015

Ray Tracing. Shandong University

Spatial Data Structures

(Refer Slide Time 05:03 min)

The Graphics Pipeline. Interactive Computer Graphics. The Graphics Pipeline. The Graphics Pipeline. The Graphics Pipeline: Clipping

Real-Time Rendering (Echtzeitgraphik) Dr. Michael Wimmer

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

CHAPTER 1 Graphics Systems and Models 3

8. Hidden Surface Elimination

Fondamenti di Grafica 3D The Rasterization Pipeline.

Computer Graphics I Lecture 11

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Pipeline Operations. CS 4620 Lecture 14

Shadows in the graphics pipeline

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

Rasterization. MIT EECS Frédo Durand and Barb Cutler. MIT EECS 6.837, Cutler and Durand 1

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

Shadows. COMP 575/770 Spring 2013

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Visibility and Occlusion Culling

Point Cloud Filtering using Ray Casting by Eric Jensen 2012 The Basic Methodology

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Computer Graphics. Rendering. by Brian Wyvill University of Calgary. cpsc/enel P 1

Course Title: Computer Graphics Course no: CSC209

Transcription:

Visible-urface Detection IV60 omputer graphics set : Hidden urfaces Problem: Given a scene and a projection, what can we see? Jack van Wijk TU/e Visible-urface Detection Terminology: Visible-surface detection vs. hidden-surface removal Hidden-line removal vs. hidden-surface removal Many algorithms: omplexity scene Type of objects Hardware Visible-urface Detection Two main types of algorithms: Object space: Determine which part of the object are visible Image space: Determine per pixel which point of an object is visible Object space Image space H&B 6-:50 Visible-urface Detection Visible-surface detection = sort for depth what and in what order varies Performance: use coherence Objects Position in world space Position in image space Time H&B 6-:50 Visible-urface Detection 5 Four algorithms: Back-face elimination Depth-buffer Depth-sorting Ray-casting But there are many other. H&B 6

Back-face elimination We cannot see the back-face of solid objects: Hence, these can be ignored Back-face elimination We cannot see the back-face of solid objects: Hence, these can be ignored N V V N > 0 : back face V V N < 0 :front face N H&B 6-:50-505 H&B 6-:50-505 Back-face elimination Object-space method Works fine for convex polyhedra: ±50% removed oncave or overlapping polyhedra: require additional processing Interior of objects can not be viewed Partiallisible front faces Depth-Buffer Algorithm Image-space method Aka z-buffer algorithm Normalized view volume Algorithm: Draw polygons, Remember the color most in front. H&B 6-:50-505 front = visible pixel View plane H&B 6-:505-508 Depth-Buffer Algorithm var zbuf: array[n,n] of real; { z-buffer: 0=near, =far } fbuf: array[n,n] of color; { frame-buffer } For all <= i, j <=N do zbuf[i,j] :=.0; col[i,j] := Backgroundolour; For all polygons do { scan conversion } For all covered pixels (i,j) do alculate depth z; If z < zbuf[i,j] then { closer! } zbuf[i,j] := z; fbuf[i,j] := surfacecolor(i,j); orting H&B 6-:505-508 Depth-Buffer Algorithm Fast calculation z: use coherence. polygon Plane : Ax + By + z + D = 0 scan line Ax By D Hence : z( x, y) = y A( x + ) By D Also : z( x +, y) = x x+ A Thus : z( x +, y) = z( x, y) B Also: z ( x, y) = z( x, y ) + H&B 6-:505-508

Depth-Buffer Algorithm + Easy to implement + Hardware supported + Polygons can be processed in arbitrary order + Fast: ~ #polygons, #covered pixels - osts memory - olor calculation sometimes done multiple times - Transparancy is tricky H&B 6-:505-508 Depth-orting Algorithm Image and Object space Aka Painter s algorithm. ort surfaces for depth. Draw them back to front Depth-orting Algorithm implistic version sorting: ort polygons for (average/frontal) z-value Depth-orting Algorithm A polygon can be drawn if all remaining polygons satisfy one of the following tests:!?!?!?!?. No overlap of bounding rectangles of and. is completely behind plane of. is completely in front of plane of. Projections and do not overlap Depth-orting Algorithm. No overlap of bounding rectangles of and Depth-orting Algorithm 5. is completely behind plane of ubstitute all vertices of in plane equation, and test if the result is always negative.

Depth-orting Algorithm 6. is completely in front of plane of ubstitute all vertices of in plane equation of, and test if the result is always positive Depth-orting Algorithm 7. Projections and do not overlap Depth-orting Algorithm 8 If all tests fail: wap and, and restart with. Depth-orting Algorithm 9 Problems: circularity and intersections olution: ut up polygons. Depth-orting Algorithm 0 - Tricky to implement - Polygons have to be known from the start - low: ~ #polygons Ray-casting Algorithm Image-space method Related to depth-buffer, order is different Normalized view volume + Fine for certain types of objects, such as plots of z=f(x, y) or non-intersecting spheres + Produces exact boundaries polygons 0.5 0-0.5-0 0 z front = visible pixel View plane Algorithm: Per pixel: - alculate intersection points - Determine front one H&B 6-0:58-59

Ray-casting Algorithm Var fbuf: array[n,n] of colour; { frame-buffer } n : integer; { #intersections } z : array[maxintsec] of real; { intersections } p : array[maxintsec] of object; { corresp. objects } For all <= i, j <=N do { for alle pixels } For all objects do alculate intersections and add these to z and p, keeping z and p sorted; if n > then fbuf[i,j] := surfacecolor(p[], z[]); H&B 6-0:58-59 Ray-casting Algorithm Acceleration intersection calculations: Use (hierarchical) bounding boxes z H&B 6-0:58-59 Ray-casting algorithm + Relatively easy to implement + For some objects very suitable (for instance spheres and other quadratic surfaces) + Transparency can be dealt with easily - Objects must be known in advance - loooow: ~ #objects*pixels, little coherence + pecial case of ray-tracing H&B 6-0:58-59 omparison Hardware available? Use depth-buffer, possibly in combination with back-face elimination or depth-sort for part of scene. If not, choose dependent on complexity scene and type of objects: imple scene, few objects: depth-sort Quadratic surfaces: ray-casting Otherwise: depth-buffer Many additional methods to boost performance (kdtrees, scene decomposition, etc.) H&B 6-:59 OpenGL backface removal glenable(gl_ull_fae); // Turn culling on glullface(mode); // pecify what to cull mode = GL_FRONT or GL_BAK // GL_BAK is default W: front Orientation matters! If you want to change the default: glfrontface(vertexorder); // Order of vertices vertexorder = GL_W or // lockwise GL_W; // ounterclockwise (default) W: back OpenGL depth-buffer functions glenable(gl_depth_tet); // Turn testing on gllear(gl_depth_buffer_bit); // lear depth-buffer, // typically once per frame gldepthfunc(condition); // hange test used condition: GL_LE // loser: visible (default) GL_GREATER // Farther: visible Note: range between z near and z far is mapped to [0,], using one or two bytes precision. If z far has an unnecessarily high value, you loose precision, and artifacts can appear. H&B 6-:5-55 H&B 6-:5-55 5

Next We know how to determine what is visible, and we looked at illumination and shading. Next: Let s consider more advanced shading. 6