Lecture 136.837 Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

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.
CSC418 Computer Graphics n Polygon normals n Back Faces n Visibility Algorithms.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
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
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
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
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.
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.
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 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.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
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.
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.
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.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
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.
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
Visible Surface Determination (VSD)
Week 2 - Friday CS361.
Hidden Surface Removal
CSC418 Computer Graphics Back Faces Visibility Algorithms.
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 13 Clipping & Scan Conversion
Visibility (hidden surface removal)
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm

Lecture 13Slide Fall 2001 Visibility Problem The problem of visibility is to determine which transformed, illuminated, and projected primitives contribute to pixels on the screen. In many cases, however, rather than solving the direct problem of determining what is visible, we will instead address the converse problem of eliminating those primitives that are invisible: primitives outside of the field of view back-facing primitives on a closed, convex object primitives occluded by other objects closer to the camera

Lecture 13Slide Fall 2001 Outside the Field-of-View Clipping, as we discussed the lecture before last, addresses the problem of removing the objects outside of the field of view. Outcode clipping attempted to remove all those objects that were entirely outside of the field of view (it came up a little short of that goal, however). Frustum clipping, as demonstrated by the plane-at-a- time approach that we discussed, removed portions of objects that were partially inside of and partially outside of the field of view.

Lecture 13Slide Fall 2001 General Approaches Image-Based Approach for (each pixel in the image) { determine the ray through the pixel determine the closest object along the ray draw the pixel in the color of the closest object } Object-Based Approach for (each object in the world) { determine unobstructed object parts draw the parts in the appropriate color }

Lecture 13Slide Fall 2001 Back-Face Culling Back-face culling addressing a special case of occlusion called convex self-occlusion. Basically, if an object is closed (having a well defined inside and outside) then some parts of the outer surface must be blocked by other parts of the same surface. We'll be more precise with our definitions in a minute. On such surfaces we need only consider the normals of surface elements to determine if they are invisible.

Lecture 13Slide Fall 2001 Removing Back-Faces Idea: Compare the normal of each face with the viewing direction Given n, the outward-pointing normal of F foreach face F of object if (n. v > 0) throw away the face Does it work?

Lecture 13Slide Fall 2001 Fixing the Problem canonical projection We can't do view direction clipping just anywhere! Downside: Projection comes fairly late in the pipeline. It would be nice to cull objects sooner. Upside: Computing the dot product is simpler. You need only look at the sign of the z.

Lecture 13Slide Fall 2001 Culling Technique #2 Detect a change in screen-space orientation. If all face vertices are ordered in a consistent way, back-facing primitives can be found by detecting a reversal in this order. One choice is a counterclockwise ordering when viewed from outside of the manifold. This is consistent with computing face normals (Why?). If, after projection, we ever see a clockwise face, it must be back facing.

Lecture 13Slide Fall 2001 Culling Technique #2 This approach will work for all cases, but it comes even later in the pipe, at triangle setup. We already do this calculation in our triangle rasterizer. It is equivalent to determining a triangle with negative area.

Lecture 13Slide Fall 2001 Culling Plane-Test Here is a culling test that will work anywhere in the pipeline. Remove faces that have the eye in their negative half-space. This requires computing a plane equation for each face considered. We still need to compute the normal (How?). But, we don't have to normalize it. How do we go about computing a value for d?

Lecture 13Slide Fall 2001 Culling Plane-Test Once we have the plane equation, we substitute the coordinate of the viewing point (the eye coordinate in our viewing matrix). If it is negative, then the surface is back-facing.

Lecture 13Slide Fall 2001 Handling Occlusion For most interesting scenes and viewpoints, some polygons will overlap; somehow, we must determine which portion of each polygon is visible to eye.

Lecture 13Slide Fall 2001 A Painter's Algorithm The painter's algorithm, sometimes called depth-sorting, gets its name from the process which an artist renders a scene using oil paints. First, the artist will paint the background colors of the sky and ground. Next, the most distant objects are painted, then the nearer objects, and so forth. Note that oil paints are basically opaque, thus each sequential layer completely obscures the layer that its covers. A very similar technique can be used for rendering objects in a three- dimensional scene. First, the list of surfaces are sorted according to their distance from the viewpoint. The objects are then painted from back-to- front. While this algorithm seems simple there are many subtleties. The first issue is which depth-value do you sort by? In general a primitive is not entirely at a single depth. Therefore, we must choose some point on the primitive to sort by.

Lecture 13Slide Fall 2001 Implementation The algorithm can be implemented very easily. First we extend the drawable interface so that any object that might be drawn is capable of supplying a z value for sorting. import Raster; public abstract interface Drawable { public abstract void Draw(Raster r); public abstract float zCentroid(); } Next, we add the required method to our triangle routine: public final float zCentroid() { return (1f/3f) * (vlist[v[0]].z + vlist[v[1]].z + vlist[v[2]].z); }

Lecture 13Slide Fall 2001 Rendering Code Here is a painter’s method that we can add to any rendering applet: void DrawScene() { view.transform(vertList, tranList, vertices); ((FlatTri) riList[0]).setVertexList(tranList); raster.fill(getBackground()); sort(0, triangles-1); for (int i = triangles-1; i >= 0; i--) { triList[i].Draw(raster); }

Lecture 13Slide Fall 2001 Problems with Painters The painter's algorithm works great... unless one of the following happens: Big triangles and little triangles. This problem can usually be resolved using further tests. Suggest some. Another problem occurs when the triangle from a model interpenetrate as shown below. This problem is a lot more difficult to handle. generally it requires that primitive be subdivided (which requires clipping). Cycles among primitives

Lecture 13Slide Fall 2001 Next Time