Graphics Pipeline Hidden Surfaces CMSC 435/634. Visibility We can convert simple primitives to pixels Which primitives (or parts of primitives) should.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.
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
CECS461 Computer Graphics II University of Missouri at Columbia Hidden Surface Removal.
Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Course Website: Computer Graphics 15: More Surface Detection Methods.
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.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
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.
Visible-surface Detection Computer Graphics Seminar MUM
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.
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
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.
CS 450: COMPUTER GRAPHICS VISIBLE SURFACE DETECTION SPRING 2015 DR. MICHAEL J. REALE.
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,
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.
Visible-Surface Detection Methods
CS 325 Introduction to Computer Graphics 03 / 22 / 2010 Instructor: Michael Eckmann.
Binary Space Partitioning Trees Ray Casting Depth Buffering
CS 376 Introduction to Computer Graphics 03 / 21 / 2007 Instructor: Michael Eckmann.
Hidden Surface Removal
Implementation II.
1 3D Hidden Surface Removal 김 성 남. 2 Contents Goal Motivation Approaches - back face detection - depth buffer - A-buffer - Scan line - Depth.
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.
Presented by: Bhavna Agarwal. Given a bunch of 3D objects predefined in x,y,z; order them in geometry.
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.
Hidden Surface Removal. Visible Surface Invisible Primitives  Why might a polygon be invisible?  Polygon outside the field of view  Polygon is backfacing.
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.
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.
Lecture 30: Visible Surface Detection
Visible Surface Detection
Computer Graphics Implementation II
Solid Area Scan Conversion or Visible Surface Detection
CSC418 Computer Graphics Back Faces Visibility Algorithms.
Visible-Surface Detection Methods
Hidden Surfaces Dr. Scott Schaefer.
Graphics Pipeline Hidden Surfaces
CSCE 441: Computer Graphics Hidden Surface Removal
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Lecture 32: Visible Surface Detection
Hidden Surface Removal
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Introduction to Computer Graphics with WebGL
Hidden Surface Removal
Lecture 31: Visible Surface Detection
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Graphics Pipeline Hidden Surfaces CMSC 435/634

Visibility We can convert simple primitives to pixels Which primitives (or parts of primitives) should be visible?

Back-face Culling Polygon is back-facing if V  N > 0 Assuming view is along –Z V = (0,0,1) V  N = N z Simplifying further – If N z ≤ 0, then cull Works for non-overlapping convex polyhedra With concave polyhedra, some hidden surfaces will not be culled

Painter ’ s Algorithm First polygon: – (6,3,10), (11, 5,10), (2,2,10) Second polygon: – (1,2,8), (12,2,8), (12,6,8), (1,6,8) Third polygon: – (6,5,5), (14,5,5), (14,10,5),( 6,10,5)

Painter’s Algorithm Given List of polygons Array of colors: color[x,y] Algorithm Sort polygons on minimum z For each polygon P in sorted list For each pixel (x,y,z) in P color[x,y] = color(P,x,y)

Painter ’ s Algorithm: Cycles Which to scan first? Split along line, then scan 1,2,3,4 (or split another polygon and scan accordingly) Moral: Painter ’ s algorithm is fast and easy, except for detecting and splitting cycles and other ambiguities

Depth-sort: Overlapping Surfaces Assume you have sorted by maximum Z – Then if Z min > Z ’ max, the surfaces do not overlap each other (minimax test) Correct order of overlapping surfaces may be ambiguous. Check it.

Depth-sort: Overlapping Surfaces No problem: paint S, then S ’ Problem: painting in either order gives incorrect result Problem? Naïve order S S ’ S ” ; correct order S ’ S ” S

Depth-sort: Order Ambiguity 1.Bounding rectangles in xy plane do not overlap Check overlap in x x ’ min > x max or x min > x ’ max -> no overlap Check overlap in y y ’ min > y max or y min > y ’ max -> no overlap 2.Surface S is completely behind S ’ relative to viewing direction. Substitute all vertices of S into plane equation for S ’ if all are “ inside ” (< 0), no ambiguity

Depth-sort: Order Ambiguity 3.Surface S ’ is completely in front S relative to viewing direction. Substitute all vertices of S ’ into plane equation for S if all are “ outside ” ( >0), no ambiguity

Binary Space Partitioning

Building a BSP Tree Use pgon 3 as root, split on its plane Pgon 5 split into 5a and 5b

Building a BSP Tree Split left subtree at pgon 2

Building a BSP Tree Split right subtree at pgon 4

Building a BSP Tree Alternate tree if splits are made at 5, 4, 3, 1

BSP Tree: Building the Tree BSPTree MakeBSP ( Polygon list ) if ( list is empty ) return null else { root = some polygon ; remove it from the list backlist = frontlist = null for ( each remaining polygon in the list ) if ( p in front of root ) addToList ( p, frontlist ) else if ( p in back of root ) addToList ( p, backlist ) else splitPolygon (p,root,frontpart,backpart) addToList ( frontpart, frontlist ) addToList ( backpart, backlist ) return (combineTree(MakeBSP(frontlist), root, MakeBSP(backlist)))

BSP Tree: Displaying the Tree DisplayBSP ( tree ) if ( tree not empty ) if ( viewer in front of root ) DisplayBSP ( tree -> back ) DisplayPolygon ( tree -> root ) DisplayBSP ( tree -> front ) else DisplayBSP ( tree -> front ) DisplayPolygon ( tree -> root ) DisplayBSP ( tree -> back )

BSP Tree Display Built BSP tree structure

BSP Tree Display C in front of 3 (order back/front) draw 4/5b branch C in back of 4 (order front/back) nothing in front of 4 draw 4 draw 5b draw 3 draw 1/2/5a branch C in back of 2 (order front/back) draw 5a draw 2 draw 1

Scanline Algorithm Simply problem by considering only one scanline at a time intersection of 3D scene with plane through scanline

Scanline Algorithm Consider xz slice Calculate where visibility can change Decide visibility in each span

Scanline Algorithm 1.Sort polygons into sorted surface table (SST) based on first Y 2.Initialize y and active surface table (AST) Y = first nonempty scanline AST = SST[y] 3.Repeat until AST and SST are empty Identify spans for this scanline (sorted on x) For each span determine visible element (based on z) fill pixel intensities with values from element Update AST remove exhausted polygons y++ update x intercepts resort AST on x add entering polygons 4.Display Intensity array

Scanline Visibility Algorithm Scanline  – AST: ABC – Spans 0 -> x 1 x 1 -> x 2 x 2 -> max background ABC background

Scanline Visibility Algorithm Scanline  – AST: ABC DEF – Spans 0 -> x 1 x 1 -> x 2 x 2 -> x 3 x 3 -> x 4 x 4 -> max background ABC background DEF background

Scanline Visibility Algorithm Scanline  – AST: ABC DEF – Spans 0 -> x 1 x 1 -> x 2 x 2 -> x 3 x 3 -> x 4 x 4 -> max background ABC DEF background

Scanline Visibility Algorithm Scanline  + 1 – Spans 0 -> x 1 x 1 -> x 2 x 2 -> x 3 x 3 -> x 4 x 4 -> max background ABC DEF background ABC background DEF background Scanline  + 2 –Spans 0 -> x 1 x 1 -> x 2 x 2 -> x 3 x 3 -> x 4 x 4 -> max

Characteristics of Scanline Algorithm Good – Little memory required – Can generate scanlines as required – Can antialias within scanline – Fast Simplification of problem simplifies geometry Can exploit coherence Bad – Fairly complicated to implement – Difficult to antialias between scanlines

Z-Buffer First polygon – (1, 1, 5), (7, 7, 5), (1, 7, 5) – scan it in with depth Second polygon – (3, 5, 9), (10, 5, 9), (10, 9, 9), (3, 9, 9) Third polygon – (2, 6, 3), (2, 3, 8), (7, 3, 3)

Z-Buffer Algorithm Originally by Cook, Carpenter, Catmull Given List of Polygons Array of depths: zbuffer[x,y] initialized to ∞ Array of colors: color[x,y] Algorithm For each Polygon P For each pixel (x,y,z) in P If z < zbuffer[x,y] zbuffer[x,y] = z color[x,y] = color(P,x,y)

Z-Buffer Characteristics Good – Easy to implement – Requires no sorting of surfaces – Easy to put in hardware Bad – Requires lots of memory (about 9MB for 1280x1024 display) – Can alias badly (only one sample per pixel) – Cannot handle transparent surfaces

A-Buffer Method Basically z-buffer with additional memory to consider contribution of multiple surfaces to a pixel Need to store – Color (rgb triple) – Opacity – Depth – Percent area covered – Surface ID – Misc rendering parameters – Pointer to next

Taxonomy of Visibility Algorithms Ivan Sutherland -- A Characterization of Ten Hidden Surface Algorithms Basic design choices – Space for operations Object Image – Object space Loop over objects Decide the visibility of each – Timing of object sort Sort-first Sort-last

Taxonomy of Visibility Algorithms Image space – Loop over pixels – Decide what ’ s visible at each Timing of sort at pixel – Sort first – Sort last – Subdivide to simplify

Taxonomy Revisted Another dimension – Point-sampling – continuous