Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

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.
Computer Graphics Inf4/MSc 28/10/08Lecture 91 Computer Graphics Lecture 9 Visible Surface Determination Taku Komura.
Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.
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.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Clipping II, Hidden Surfaces.
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.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
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.
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
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.
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
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.
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
The BSP-tree from Prof. Seth MIT.. Motivation for BSP Trees: The Visibility Problem We have a set of objects (either 2d or 3d) in space. We have.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
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.
3/23/04© University of Wisconsin, CS559 Spring 2004 Last Time Antialiasing –Area-weighted sampling Visibility –Painters algorithm –Depth buffer (Z-buffer)
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.
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.
1 3D Hidden Surface Removal 김 성 남. 2 Contents Goal Motivation Approaches - back face detection - depth buffer - A-buffer - Scan line - Depth.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.
Where We Stand At this point we know how to: –Convert points from local to window coordinates –Clip polygons and lines to the view volume –Determine which.
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.
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.
Hidden Surface Removal. 2 Goal: Determine which surfaces are visible and which are not. Z-Buffer is just one of many hidden surface removal algorithms.
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
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Hidden Surface Removal
Presentation transcript:

Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination

Computer Graphics Inf4/MSc 19/10/2007Lecture 92 Hidden surface removal Inventing renderers led to geometric models, a call for more realism and therefore lots of polygons. All this led to intense interest in finding efficient algorithms for hidden surface removal. Some algorithms are more correctly called visible surface algorithms but the two names are used interchangeably. Today we’ll look at several out of many generated during the period of intense interest (around late 60s to late 70s).

Computer Graphics Inf4/MSc 19/10/2007Lecture 93 Visibility of primitives We don’t want to waste time rendering primitives which don’t contribute to the final image. A scene primitive can be invisible for 3 reasons: –Primitive lies outside field of view –Primitive is back-facing (under certain conditions) –Primitive is occluded by one or more objects nearer the viewer How do we remove these efficiently? How do we identify these efficiently?

Computer Graphics Inf4/MSc 19/10/2007Lecture 94 The visibility problem. Two problems remain: (Clipping we have covered) Removal of faces facing away from the viewer. Removal of faces obscured by closer objects.

Computer Graphics Inf4/MSc 19/10/2007Lecture 95 Visible surface algorithms. Hidden/Visible Surface/Line Elimination/Determination Requirements – Handle diverse set of geometric primitives – Handle large number of geometric primitives Classification: Sutherland, Sproull, Schumacher (1974): Object Space –Geometric calculations involving polygons –Floating point precision: Exact –Often process scene in object order Image Space –Visibility at pixel samples –Integer precision –Often process scene in image order

Computer Graphics Inf4/MSc 19/10/2007Lecture 96 Back face culling. We saw in modelling, that the vertices of polyhedra are oriented in an anticlockwise manner when viewed from outside – surface normal N points out. Project a polygon. –Test z component of surface normal. If negative – cull, since normal points away from viewer. –Or if N. V > 0 we are viewing the back face so polygon is obscured. Only works for convex objects without holes, ie. closed orientable manifolds.

Computer Graphics Inf4/MSc 19/10/2007Lecture 97 Back face culling Back face culling can be applied anywhere in the pipeline: world or eye coords, NDC, image space. Where is the best point? What portion of the scene is eliminated, on average? –Depends on application If we clip our scene to the view frustrum, then remove all back-facing polygons – are we done? NO! Most views involve overlapping polygons.

Computer Graphics Inf4/MSc 19/10/2007Lecture 98 How de we handle overlapping? How about drawing the polygons in the “right order” so that we get the correct result ( eg. blue, then green, then peach)? Is it just a sorting problem ? Yes it is for 2D, but in 3D we can encounter intersecting polygons or groups of non-intersecting polygons which form a cycle where order is impossible (later).

Computer Graphics Inf4/MSc 19/10/2007Lecture 99 Simple Z-buffering Simple to include in scanline algorithm. Interpolate z during scan conversion. Maintain a depth (range) image in the frame buffer (16 or 24 bits common ). When drawing, compare with the currently stored z value. Pixel given intensity of nearest polygon.

Computer Graphics Inf4/MSc 19/10/2007Lecture 910 Implementation. Initialise frame buffer to background colour. Initialise depth buffer to z = max. value for far clipping plane, ie. LHCS Need to calculate value for z for each pixel –But only for polygons intersecting that pixel. –Could interpolate from values at vertices. Update both frame and depth buffer.

Computer Graphics Inf4/MSc 19/10/2007Lecture 911 Determining depth. -Only one subtraction needed -Depth coherence.

Computer Graphics Inf4/MSc 19/10/2007Lecture 912 Why is z-buffering so popular ? Advantage Simple to implement in hardware. –Add additional z interpolator for each primitive. –Memory for z-buffer is now not expensive Diversity of primitives – not just polygons. Unlimited scene complexity Don’t need to calculate object-object intersections. Disadvantage Extra memory and bandwidth Waste time drawing hidden objects Z-precision errors May have to use point sampling

Computer Graphics Inf4/MSc 19/10/2007Lecture 913 Z-compositing. Can use depth other than from polygons. Reflected laser power Laser range return. Colour photograph. Data courtesy of UNC.

Computer Graphics Inf4/MSc 19/10/2007Lecture 914 Ray casting. Sometimes referred to as Ray-tracing. Involves projecting an imaginary ray from the centre of projection (the viewers eye) through the centre of each pixel into the scene. Scene Window Eyepoint

Computer Graphics Inf4/MSc 19/10/2007Lecture 915 Computing ray-object intersections. The heart of ray tracing. E.g sphere ( the easiest ! ). Expand, substitute for x,y & z. Gather terms in t.  Quadratic equation in t. Solve for t. -No roots – ray doesn’t intersect. - 1 root – ray grazes surface. - 2 roots – ray intersects sphere, (entry and exit)

Computer Graphics Inf4/MSc 19/10/2007Lecture 916 Ray-polygon intersection. Not so easy ! 1.Determine whether ray intersects polygon’s plane. 2.Determine whether intersection lies within polygon. Easiest to determine (2) with an orthographic projection onto the nearest axis and the 2D point-in-polygon test. Ray x y z

Computer Graphics Inf4/MSc 19/10/2007Lecture 917 Ray casting. Easy to implement for a variety of primitives – only need a ray-object intersection function. Pixel adopts colour of nearest intersection. Can draw curves and surfaces exactly – not just triangles ! Can generate new rays inside the scene to correctly handle visibility with reflections, refraction etc – recursive ray- tracing. Can be extended to handle global illumination. Can perform area-sampling using ray super-sampling. But… too expensive for real-time applications.

Computer Graphics Inf4/MSc 19/10/2007Lecture 918 Examples of Ray-traced images.

Computer Graphics Inf4/MSc 19/10/2007Lecture 919 Painters algorithm (object space). Draw surfaces in back to front order – nearer polygons “paint” over farther ones. Supports transparency. Key issue is order determination. Doesn’t always work – see image at right.

Computer Graphics Inf4/MSc 19/10/2007Lecture 920 BSP (Binary Space Partitioning) Tree. One of class of “list-priority” algorithms – returns ordered list of polygon fragments for specified view point (static pre-processing stage). Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon View of scene from above

Computer Graphics Inf4/MSc 19/10/2007Lecture 921 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon a 5b 1 2 5a 4 5b back front

Computer Graphics Inf4/MSc 19/10/2007Lecture 922 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon a 5b 4 5b back front 2 15a front

Computer Graphics Inf4/MSc 19/10/2007Lecture 923 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon a 5b back front 2 15a front 5b 4

Computer Graphics Inf4/MSc 19/10/2007Lecture 924 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon back 2 1 front 5 4 back Alternate formulation starting at 5

Computer Graphics Inf4/MSc 19/10/2007Lecture 925 Displaying a BSP tree. Once we have the regions – need priority list BSP tree can be traversed to yield a correct priority list for an arbitrary viewpoint. Start at root polygon. –If viewer is in front half-space, draw polygons behind root first, then the root polygon, then polygons in front. –If polygon is on edge – either can be used. –Recursively descend the tree. If eye is in rear half-space for a polygon – then can back face cull.

Computer Graphics Inf4/MSc 19/10/2007Lecture 926 BSP Tree. A lot of computation required at start. –Try to split polygons along good dividing plane –Intersecting polygon splitting may be costly Cheap to check visibility once tree is set up. Can be used to generate correct visibility for arbitrary views.  Efficient when objects don’t change very often in the scene.

Computer Graphics Inf4/MSc 19/10/2007Lecture 927 Warnock’s Algorithm Elegant hybrid of object-space and image-space. Uses standard graphics solution:- if situation too complex then subdivide problem. Start with root window: –If zero or one intersecting, contained or surrounding polygon then scan convert window –Else subdivide window as quadtree –Recurse until zero or one polygon, or some set depth –Depth may be pixel resolution, display nearest polygon

Computer Graphics Inf4/MSc 19/10/2007Lecture 928 Warnock’s example

Computer Graphics Inf4/MSc 19/10/2007Lecture 929 Warnock performance measure Warnock’s algorithm: –Screen-space subdivision (screen resolution, r = w*h) hybrid object-space & image-space algorithm good for relatively few static primitives, precise. –Working set size (memory requirement): O(n) –Storage overhead (over & above model): O(n lg r) –Time to resolve visibility to screen precision: O(n*r) –Overdraw (depth complexity – how often a typical pixel is written by rasterization process): none

Computer Graphics Inf4/MSc 19/10/2007Lecture 930 BSP performance measure Tree construction and traversal (object-space ordering algorithm – good for relatively few static primitives, precise) Working set size (depends on application): O(1), O(lg n) Storage overhead: O(n 2 ) Time to resolve visibility to screen precision: O(n 2 ) Overdraw: maximum

Computer Graphics Inf4/MSc 19/10/2007Lecture 931 Z-buffer performance Brute-force image-space algorithm scores best for complex scenes – not very accurate but is easy to implement and is very general. Working set size: O(1) Storage overhead: O(1) Time to resolve visibility to screen precision: O(n) Overdraw: maximum But even O(n) is now intolerable!

Computer Graphics Inf4/MSc 19/10/2007Lecture 932 Ex. Architectural scenes Here there can be an enormous amount of occlusion

Computer Graphics Inf4/MSc 19/10/2007Lecture 933 Occlusion at various levels

Computer Graphics Inf4/MSc 19/10/2007Lecture 934 Cells & Portals (object-space) Model scene as a graph: Nodes: Cells (or rooms) Edges: Portals (or doors) Graph gives us: Potentially visible set Superset of visible polygons Room to room visibility Not a complete solution ! A BC D E F G A B DCE

Computer Graphics Inf4/MSc 19/10/2007Lecture 935 What about other applications? Outdoor environments: –Urban regions, forests, natural scenes in general Or very complex assemblies: mechanical CAD parts (Boeing 777 engine block) Molecular visualization Very hard and still not solved problem

Computer Graphics Inf4/MSc 19/10/2007Lecture 936 References for this lecture Foley et al. Chapter 15, all of it. Introductory text, Chapter 13, all of it Or equivalents in other texts, look out for: –(as well as the topics covered today) –Depth sort – Newell, Newell & Sancha –Scan-line algorithms –Weiler-Atherton subdivision on polygon edges