Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

Visible-Surface Detection(identification)
15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows.
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
CSC418 Computer Graphics n Polygon normals n Back Faces n Visibility Algorithms.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
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.
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
CECS461 Computer Graphics II University of Missouri at Columbia Hidden Surface Removal.
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.
Mark Nelson Rendering algorithms Fall 2013
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Clipping & Scan Conversion
Computer Graphics 14: Surface Detection Methods
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.
Now Playing: Big Bird Eddie Floyd from The Complete Stax-Volt Singles Volume 1 ( ) Released April 30, 1991.
Visible-surface Detection Computer Graphics Seminar MUM
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
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
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.
Lecture 5: 3D Rendering Pipeline (II) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
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 Programming with OpenGL Three Dimensions – 2 Lecture 7 John Shearer Culture Lab – space 2
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.
Hidden Surface Removal
Implementation II.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.
Computer Graphics I, Fall 2010 Implementation II.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
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.
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.
COMPUTER GRAPHICS CS 482 – FALL 2015 NOVEMBER 10, 2015 VISIBILITY CULLING HIDDEN SURFACES ANTIALIASING HALFTONING.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Lecture 30: Visible Surface Detection
Computer Graphics Implementation II
Visible Surface Determination (VSD)
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
CSC418 Computer Graphics Back Faces Visibility Algorithms.
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Hidden Surfaces Dr. Scott Schaefer.
CSCE 441: Computer Graphics Hidden Surface Removal
Implementation II Ed Angel Professor Emeritus of Computer Science
Lecture 13 Clipping & Scan Conversion
Visibility (hidden surface removal)
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Introduction to Computer Graphics with WebGL
Hidden Surface Removal
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Hidden Surface Removal CSE 581

Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside: View Frustum Clipping  Remove polygons outside of the view volume  For example, Liang-Barsky 3D Clipping  Inside: Hidden Surface Removal  Backface culling  Polygons facing away from the viewer  Occlusion  Polygons farther away are obscured by closer polygons  Full or partially occluded portions Why should we remove these polygons?  Avoid unnecessary expensive operations on these polygons later

No Lines Removed

Hidden Lines Removed

Hidden Surfaces Removed

Occlusion: Full, Partial, None Full Partial None The rectangle is closer than the triangle Should appear in front of the triangle

Backface Culling Avoid drawing polygons facing away from the viewer  Front-facing polygons occlude these polygons in a closed polyhedron Test if a polygon is front- or back-facing? front-facing back-facing Ideas?

Detecting Back-face Polygons The polygon normal of a …  front-facing polygon points towards the viewer  back-facing polygon points away from the viewer If (n  v) > 0  “back-face” If (n  v) ≤ 0  “front-face” v = view vector Eye-space test … EASY!  “back-face” if n z < 0 glCullFace(GL_BACK) back front

Polygon Normals Let polygon vertices v 0, v 1, v 2,..., v n - 1 be in counterclockwise order and co-planar Calculate normal with cross product: n = (v 1 - v 0 ) X (v n v 0 ) Normalize to unit vector with n/║n║ v0v0 v1v1 v2v2 v3v3 v4v4 n

Normal Direction Vertices counterclockwise  Front-facing Vertices clockwise  Back-facing Front facingBack facing

Painter’s Algorithm (1) Assumption: Later projected polygons overwrite earlier projected polygons Graphics Pipeline Oops! The red polygon Should be obscured by the blue polygon

Painter’s Algorithm (2) Main Idea  A painter creates a picture by drawing background scene elemens before foreground ones Requirements  Draw polygons in back-to- front order  Need to sort the polygons by depth order to get a correct image from Shirley

Painter’s Algorithm (3) Sort by the depth of each polygon Graphics Pipeline depth

Painter’s Algorithm (4) Compute z min ranges for each polygon Project polygons with furthest z min first (z) depth z min

Painter’s Algorithm (5) Problem: Can you get a total sorting? z min Correct?

Painter’s Algorithm (6) Cyclic Overlap  How do we sort these three polygons? Sorting is nontrivial  Split polygons in order to get a total ordering  Not easy to do in general

Visibility How do we ensure that closer polygons overwrite further ones in general?

Z-Buffer Depth buffer (Z-Buffer)  A secondary image buffer that holds depth values  Same pixel resolution as the color buffer  Why is it called a Z-Buffer?  After eye space, depth is simply the z-coordinate Sorting is done at the pixel level  Rule: Only draw a polygon at a pixel if it is closer than a polygon that has already been drawn to this pixel

Z-Buffer Algorithm Visibility testing is done during rasterization

Z-buffer: A Secondary Buffer DAM Entertainment Color bufferDepth buffer

Z-Buffer How do we calculate the depth values on the polygon interior? P1P1 P2P2 P3P3 P4P4 ysys zaza zpzp zbzb Scanline order Bilinear Interpolation

Z-buffer - Example

Parallel with the image plane

Not Parallel

Z-Buffer Algorithm Algorithm easily handles this case

Z-buffering in OpenGL Create depth buffer by setting GLUT_DEPTH flag in glutInitDisplayMode()or the appropriate flag in the PIXELFORMATDESCRIPTOR. Enable per-pixel depth testing with glEnable(GL_DEPTH_TEST) Clear depth buffer by setting GL_DEPTH_BUFFER_BIT in glClear()