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.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

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.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination.
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
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.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye
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.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
1 Clipping and Hidden Surfaces CS-184: Computer Graphics Prof. James O’Brien.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
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.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
Hidden Surface Removal
Visible Surface Determination
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.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
Modeling of worlds A complicated object be decomposed into simple objects and represented by hierarchical model A world scene usually contain many objects.
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.
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.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
Visible-Surface Detection Jehee Lee Seoul National University.
03/14/02 (c) 2002 University of Wisconsin, CS559 Last Time Some more visibility (Hidden Surface Removal) algorithms –A-buffer –Scanline –Depth sorting.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
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)
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Implementation II.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
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.
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.

Computer Graphics Implementation II
(c) 2002 University of Wisconsin, CS559
Solid Area Scan Conversion or Visible Surface Detection
© University of Wisconsin, CS559 Fall 2004
Hidden Surfaces Dr. Scott Schaefer.
© University of Wisconsin, CS559 Spring 2004
Graphics Pipeline Hidden Surfaces
CSCE 441: Computer Graphics Hidden Surface Removal
Implementation II Ed Angel Professor Emeritus of Computer Science
Last Time Clipping Homework 4, due Nov 2 in class
CSCE 441: Computer Graphics Hidden Surface Removal (Cont.)
Sweep Fill Details For row = min to row=max
Hidden Surface Removal
Lecture 31: Visible Surface Detection
Implementation II Ed Angel Professor Emeritus of Computer Science
Visible-Surface Determination
Presentation transcript:

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 pixels are covered by any given line or polygon –Anti-alias –Three methods for figuring out what’s in front Next thing: –More on determine which polygon is in front

Depth Sorting (Object Precision, in view space) An example of a list-priority algorithm Sort polygons on depth of some point Render from back to front (modifying order on the fly) Rendering: For surface S with greatest depth –If no overlap in depth with other polygons, scan convert –Else, for overlaps in depth, test for overlaps in the image plane If none, scan convert and go to next polygon –If S, S’ overlap in depth and in image plane, swap order and try again –If S, S’ have been swapped already, split and reinsert

Depth Sorting (2) Testing for overlaps: Start drawing when first condition is met: –x-extents or y-extents do not overlap –S is behind the plane of S’ –S’ is in front of the plane of S –S and S’ do not intersect in the image plane S S’ S or z x S S’ z x S S

Depth sorting Advantages: –Filter anti-aliasing works fine Composite in back to front order with a sequence of over operations –No depth quantization error Depth comparisons carried out in high-precision view space Disadvantages: –Over-rendering –Potentially very large number of splits -  (n 2 ) fragments from n polygons

Area Subdivision Exploits area coherence: Small areas of an image are likely to be covered by only one polygon Four easy cases for determining what’s in front in a given region: 1.a polygon is completely in front of everything else in that region 2.no surfaces project to the region 3.only one surface is completely inside the region, overlaps the region, or surrounds the region

Warnock’s Area Subdivision (Image Precision) Start with whole image If one of the easy cases is satisfied (previous slide), draw what’s in front Otherwise, subdivide the region and recurse If region is single pixel, choose surface with smallest depth Advantages: –No over-rendering –Anti-aliases well - just recurse deeper to get sub-pixel information Disadvantage: –Tests are quite complex and slow

Warnock’s Algorithm Regions labeled with case used to classify them: 1)One polygon in front 2)Empty 3)One polygon inside, surrounding or intersecting Small regions not labeled

BSP-Trees (Object Precision) (Watt and ) Construct a binary space partition tree –Tree gives a rendering order –A list-priority algorithm Tree splits 3D world with planes –The world is broken into convex cells –Each cell is the intersection of all the half-spaces of splitting planes on tree path to the cell Also used to model the shape of objects, and in other visibility algorithms –BSP visibility in games does not refer to this algorithm

BSP-Tree Example A C B A B C

Building BSP-Trees Choose polygon (arbitrary) Split its cell using plane on which polygon lies –May have to chop polygons in two (Clipping!) Continue until each cell contains only one polygon fragment Splitting planes could be chosen in other ways, but there is no optimal algorithm for building BSP trees –Optimal means minimum number of polygon fragments in a balanced tree

BSP-Tree Rendering Observation: Things on the opposite side of a splitting plane from the viewpoint cannot obscure things on the same side as the viewpoint Rendering algorithm is recursive descent of the BSP Tree At each node (for back to front rendering): –Recurse down the side of the sub-tree that does not contain the viewpoint –Draw the polygon in the splitting plane Paint over whatever has already been drawn –Recurse down the side of the tree containing the viewpoint

BSP-Tree Rendering Example A C B A B C st View 2nd3rd4th

BSP-Tree Rendering (2) Advantages: –One tree works for any focal point –Filter anti-aliasing and transparency work Have back to front ordering for compositing –Can also render front to back, and avoid drawing back polygons that cannot contribute to the view Computer games! Disadvantages: –Can be many small pieces of polygon –Over-rendering

Exact Visibility An exact visibility algorithm tells you what is visible and only what is visible –No over-rendering –Warnock’s algorithm is an example Difficult to achieve efficiently in practice –Small detail objects in an environment make it particularly difficult But, in mazes and other simple environments, exact visibility is extremely efficient

Cells and Portals Assume the world can be broken into cells –Simple shapes –Rooms in a building, for instance Define portals to be the transparent boundaries between cells –Doorways between rooms, windows, etc In a world like this, can determine exactly which parts of which rooms are visible –Then render visible rooms plus contents

Cell and Portal Visibility Start in the cell containing the viewer, with the full viewing frustum Render the walls of that room and its contents Recursively clip the viewing frustum to each portal out of the cell, and call the algorithm on the cell beyond the portal

Cell-Portal Example (1) View

Cell-Portal Example (2) View

Cell-Portal Example (3) View

Cell-Portal Example (4) View

Cell-Portal Example (5) View

Cell-Portal Example (6) View

Cell-Portal Operations Must clip polygons to the current view frustum (not the original one) –Can be done with additional hardware clipping planes Must clip the view frustum to the portal –Easiest to clip portal to frustum, then set frustum to exactly contain clipped portal In Project 2, you implement these things in software

Cell-Portal Properties Advantages –Extremely efficient - only looks at cells that are actually visible: visibility culling –Easy to modify for approximate visibility - render all of partially visible cells, let depth buffer clean up –Can handle mirrors as well - flip world about the mirror and pretend mirror is a portal Disadvantages –Restricted to environments with good cell/portal structure