University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility II Week 7,

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

CSC418 Computer Graphics n Polygon normals n Back Faces n Visibility Algorithms.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
CS 551 / 645: Introductory Computer Graphics Visible Surface Determination.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
CECS461 Computer Graphics II University of Missouri at Columbia Hidden Surface Removal.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
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 고려대학교 컴퓨터 그래픽스 연구실.
CS 445 / 645: Introductory Computer Graphics
UBI 516 Advanced Computer Graphics
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Clipping II, Hidden Surfaces.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures I Week 8, Mon.
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.
Clipping & Scan Conversion
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Hidden Surfaces II Week.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
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
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Visibility Week 9, Fri 31 Oct 2003.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility Week 7, Wed.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Visibility: Z Buffering Week 10, Mon 3 Nov 2003.
Hidden Surface Removal
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
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,
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
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.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Hidden Surface Removal
Implementation II.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Computer Graphics Zhen Jiang West Chester University.
David Luebke 1 12/8/2015 Visibility CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
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.
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.
Hidden Surfaces University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
Hidden Surfaces / Depth Test University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
CS 445 / 645 Introduction to Computer Graphics Lecture 21 Visibility Visibility.
Visible Surface Detection
Computer Graphics Implementation II
Visibility Week 9, Fri 31 Oct 2003
CSC418 Computer Graphics Back Faces Visibility Algorithms.
Hidden Surfaces Dr. Scott Schaefer.
CSCE 441: Computer Graphics Hidden Surface Removal
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Visibility: Z Buffering Week 10, Mon 3 Nov 2003
Hidden Surfaces II Week 9, Mon Mar 15
Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility II Week 7, Fri Feb 25

2 News midterm scores will be scaled stay tuned for details demo signups continue you can check your time slot from scans posted to course page (student numbers blocked out) Mon 1-5, Tue 10-1, 3-5, Wed 1-5 final date/time posted April 19, 8:30-12:30

3 News Written assignment 2 out

4 Review: Invisible Primitives why might a polygon be invisible? polygon outside the field of view / frustum solved by clipping polygon is backfacing solved by backface culling polygon is occluded by object(s) nearer the viewpoint solved by hidden surface removal

5 Review: Back-Face Culling on the surface of a closed orientable manifold, polygons whose normals point away from the camera are always occluded: note: backface culling alone doesn’t solve the hidden-surface problem!

6 Review: Back-face Culling NDCS eye works to cull if y z y z cullingsometimes misses polygons that should be culled instead, cull if eye is below polygon plane eye above below VCS above below

7 Review: Painter’s Algorithm draw objects from back to front problems: no valid visibility order for intersecting polygons cycles of non-intersecting polygons possible

8 Review: BSP Trees preprocess: create binary tree recursive spatial partition viewpoint independent

9 Review: BSP Trees runtime: correctly traversing this tree enumerates objects from back to front viewpoint dependent check which side of plane viewpoint is on draw far, draw object in question, draw near pros simple, elegant scheme works at object or polygon level cons computationally intense preprocessing stage restricts algorithm to static scenes

10 Correction BSP Trees : Viewpoint B F N NF F N N F no!

11 Warnock’s Algorithm (1969) based on a powerful general approach common in graphics if the situation is too complex, subdivide BSP trees was object space approach Warnock is image space approach

12 Warnock’s Algorithm start with root viewport and list of all objects recursion: clip objects to viewport if only 0 or 1 objects done else subdivide to new smaller viewports distribute objects to new viewpoints recurse

13 Warnock’s Algorithm termination viewport is single pixel explicitly check for object occlusion

14 Warnock’s Algorithm pros: very elegant scheme extends to any primitive type cons: hard to embed hierarchical schemes in hardware complex scenes usually have small polygons and high depth complexity (number of polygons that overlap a single pixel) thus most screen regions come down to the single-pixel case

15 The Z-Buffer Algorithm (mid-70’s) both BSP trees and Warnock’s algorithm were proposed when memory was expensive first 512x512 framebuffer was >$50,000! Ed Catmull proposed a radical new approach called z-buffering. the big idea: resolve visibility independently at each pixel

16 The Z-Buffer Algorithm we know how to rasterize polygons into an image discretized into pixels:

17 The Z-Buffer Algorithm what happens if multiple primitives occupy the same pixel on the screen? which is allowed to paint the pixel?

18 The Z-Buffer Algorithm idea: retain depth after projection transform each vertex maintains z coordinate relative to eye point can do this with canonical viewing volumes

19 The Z-Buffer Algorithm augment color framebuffer with Z-buffer or depth buffer which stores Z value at each pixel at frame beginning, initialize all pixel depths to  when rasterizing, interpolate depth (Z) across polygon check Z-buffer before storing pixel color in framebuffer and storing depth in Z-buffer don’t write pixel if its Z value is more distant than the Z value already stored there

20 Interpolating Z edge equations: Z just another planar parameter: z = (-D - Ax – By) / C if walking across scanline by (D x ) z new = z old – (A/C)(D x ) total cost: 1 more parameter to increment in inner loop 3x3 matrix multiply for setup

21 Interpolating Z edge walking just interpolate Z along edges and across spans barycentric coordinates interpolate Z like other parameters

22 Z-Buffer store (r,g,b,z) for each pixel typically bits, can be more for all i,j { Depth[i,j] = MAX_DEPTH Depth[i,j] = MAX_DEPTH Image[i,j] = BACKGROUND_COLOUR Image[i,j] = BACKGROUND_COLOUR} for all polygons P { for all pixels in P { for all pixels in P { if (Z_pixel < Depth[i,j]) { if (Z_pixel < Depth[i,j]) { Image[i,j] = C_pixel Image[i,j] = C_pixel Depth[i,j] = Z_pixel Depth[i,j] = Z_pixel } }}

23 Depth Test Precision reminder: projective transformation maps eye-space z to generic z-range (NDC) simple example: thus:

24 Depth Test Precision therefore, depth-buffer essentially stores 1/z, rather than z! issue with integer depth buffers high precision for near objects low precision for far objects -z eye z NDC -n-f

25 Depth Test Precision low precision can lead to depth fighting for far objects two different depths in eye space get mapped to same depth in framebuffer which object “wins” depends on drawing order and scan-conversion gets worse for larger ratios f:n rule of thumb: f:n < 1000 for 24 bit depth buffer with 16 bits cannot discern millimeter differences in objects at 1 km distance

26 Z-Buffer Algorithm Questions how much memory does the Z-buffer use? does the image rendered depend on the drawing order? does the time to render the image depend on the drawing order? how does Z-buffer load scale with visible polygons? with framebuffer resolution?

27 Z-Buffer Pros simple!!! easy to implement in hardware hardware support in all graphics cards today polygons can be processed in arbitrary order easily handles polygon interpenetration enables deferred shading rasterize shading parameters (e.g., surface normal) and only shade final visible fragments

28 Z-Buffer Cons poor for scenes with high depth complexity need to render all polygons, even if most are invisible shared edges are handled inconsistently ordering dependent eye

29 Z-Buffer Cons requires lots of memory (e.g. 1280x1024x32 bits) requires fast memory Read-Modify-Write in inner loop hard to simulate translucent polygons we throw away color of polygons behind closest one works if polygons ordered back-to-front extra work throws away much of the speed advantage

30 Hidden Surface Removal two kinds of visibility algorithms object space methods image space methods

31 Object Space Algorithms determine visibility on object or polygon level using camera coordinates resolution independent explicitly compute visible portions of polygons early in pipeline after clipping requires depth-sorting painter’s algorithm BSP trees

32 Image Space Algorithms perform visibility test for in screen coordinates limited to resolution of display Z-buffer: check every pixel independently Warnock: check up to single pixels if needed performed late in rendering pipeline