CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.

Slides:



Advertisements
Similar presentations
15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows.
Advertisements

8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
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.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
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.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
1 Dr. Scott Schaefer Shadows. 2/40 Shadows Shadows provide clues about depth Make scenes appear more realistic.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility II Week 7,
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Scan Conversion CS123 1 of 44Scan Conversion - 10/14/2014.
Spatial Data Structure: Quadtree, Octree,and BSP tree Mengxia Zhu Fall 2007.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Hidden Surface Removal
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Computer Graphics Mirror and Shadows
Polygon Scan Conversion and Z-Buffering
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
Visible-Surface Detection Jehee Lee Seoul National University.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
CS-378: Game Technology Lecture #2.2: Clipping and Hidden Surfaces Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney,
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.
CS 325 Introduction to Computer Graphics 03 / 22 / 2010 Instructor: Michael Eckmann.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Hidden Surface Removal
Implementation II.
Computer Graphics Zhen Jiang West Chester University.
Computer Graphics I, Fall 2010 Implementation II.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
01/28/09Dinesh Manocha, COMP770 Visibility Computations Visible Surface Determination Visibility Culling.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Visible surface determination. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are.
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.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S History and modern practice avdNovember 4, 2003VSD 1/46 CIS 736 Computer Graphics Visible Surface.
Visible Surface Detection
Computer Graphics Implementation II
Visible Surface Determination (VSD)
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
3D Graphics Rendering PPT By Ricardo Veguilla.
3D Clipping.
CSCE 441: Computer Graphics Hidden Surface Removal
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of 14Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  Given a set of 3-D objects and a view specification (camera), determine which edges or surfaces of the object are visible  why might objects not be visible? occlusion vs. clipping  clipping works on the object level (clip against view volume)  occlusion works on the scene level (compare depth of object/edges/pixels against other objects/edges/pixels)  Also called Hidden Surface Removal (HSR)  We begin with some history of previously used VSD algorithms 2 of 14 What is it? Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 3 of 14  Sutherland categorized algorithms as to whether they work on objects in the world (object precision) or with projections of objects in screen coordinates (image precision) and refer back to the world when z is needed Object-Precision Algorithms Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  Back-to-front algorithm was used in the first hardware-rendered scene, the 1967 GE Flight Simulator by Schumacher et al using a video drum to hold the scene   Create drawing order so each polygon overwrites the previous one. This guarantees correct visibility at any pixel resolution  Strategy is to work back to front; find a way to sort polygons by depth (z), then draw them in that order  do a rough sort of polygons by smallest (farthest) z-coordinate in each polygon  scan-convert most distant polygon first, then work forward towards viewpoint (“painters’ algorithm”)  See 3D depth-sort algorithm by Newell, Newell, and Sancha   Can this back-to-front strategy always be done?  problem: two polygons partially occluding each other – need to split polygons 4 of 14 Painter’s Algorithm – Image Precision Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 5 of 14 Finally, clip against normalized view volume (-1 < x < 1), (-1 < y < 1), (-1 < z < 0) Hardware Scan Conversion: VSD (1/4) Canonical perspective-transformed view volume with cube z +x +y (-1, 1, -1) (1, -1, 0) Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 6 of 14 Hardware Scan Conversion: VSD (2/4) Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  Draw every polygon that we can’t reject trivially (totally outside view volume)  If we find a piece (one or more pixels) of a polygon that is closer to the front, we paint over whatever was behind it  Use plane equation for z = f(x, y)  Note: use positive z here [0, 1]  Applet: zbuffer.php zbuffer.php 7 of 14 Z-Buffer Algorithm void zBuffer() { int x, y; for (y = 0; y < YMAX; y++) for (x = 0; x < XMAX; x++) { WritePixel (x, y, BACKGROUND_VALUE); WriteZ (x, y, 1); } for each polygon { for each pixel in polygon’s projection { //plane equation double pz = Z-value at pixel (x, y); if (pz < ReadZ (x, y)) { // New point is closer to front of view WritePixel (x, y, color at pixel (x, y)) WriteZ (x, y, pz); } Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  Requires two “buffers”  Intensity Buffer: our familiar RGB pixel buffer, initialized to background color  Depth (“Z”) Buffer: depth of scene at each pixel, initialized to 255  Polygons are scan-converted in arbitrary order. When pixels overlap, use Z-buffer to decide which polygon “gets” that pixel 8 of 14 Hardware Scan Conversion: VSD (3/4) integer Z-buffer with near = 0, far = = = Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  After scene gets projected onto film plane we know depths only at locations in our depth buffer that our vertices got mapped to  So how do we efficiently fill in all the “in between” z-buffer information?  Simple answer: incrementally!  Remember scan conversion/polygon filling? As we move along Y-axis, track x position where each edge intersects scan line  Do the same for z coordinate with y-z slope instead of y-x slope  Knowing z 1, z 2, and z 3 we can calculate z a and z b for each edge, and then incrementally calculate z p as we scan.  Similar to interpolation to calculate color per pixel (Gouraud shading) 9 of 14 Hardware Scan Conversion: VSD (4/4) Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  Dirt-cheap and fast to implement in hardware, despite brute force nature and potentially many passes over each pixel  Requires no pre-processing, polygons can be treated in any order!  Allows incremental additions to image – store both frame buffer and z- buffer and scan-convert the new polygons  Lost coherence/polygon id’s for each pixel, so can’t do incremental deletes of obsolete information.  Technique extends to other surface descriptions that have (relatively) cheap z= f(x, y) computations (preferably incremental) 10 of 14 Advantages of Z-buffer Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  Perspective foreshortening (see slides in Viewing III)  Compression in z-axis in post- perspective space  Objects far away from camera have z-values very close to each other  Depth information loses precision rapidly  Leads to z-ordering bugs called z-fighting 11 of 14 Disadvantages of Z-Buffer nearfar z x Before z x 01 After Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam ©  Z-fighting occurs when two primitives have similar values in the z-buffer  Coplanar polygons (two polygons that occupy the same space)  One is arbitrarily chosen over the other, but z varies across the polygons and binning will cause artifacts, as shown on next slide  Behavior is deterministic: the same camera position gives the same z-fighting pattern Z-Fighting (1/3) Two intersecting cubes 12 of 14Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Z-Fighting (2/3) Red in front of blue Blue, which is drawn after red, ends up in front of red 1 x axis of image (each column is a pixel) z-value bins Eye at origin, Looking down Z axis Here the red and blue lines represent cross-sections of the red and blue coplanar polygons from the previous slide 13 of 14Visible Surface Determination – 10/15/15

CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 14 of 14 Z-Fighting (3/3)  Examples   /course/cs123/data/scenes/contest/ntom.xml: Visible Surface Determination – 10/15/15