Visible surface determination. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are.

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

Hidden Surface Removal - 12 a (Visible Surface determination)
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
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.
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
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.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
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.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Hidden Line Removal Adopted from U Strathclyde’s course page.
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.
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
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.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Zakrite ploskve. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are visible, so that.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
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.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
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.
Chris Mayer & Nic Shulver Hidden Surface Wire frame drawings Wire frame drawings are quick to produce but are often confusing It is difficult to determine.
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.
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.
1 Computer Graphics Week11 : Hidden Surface Removal.
Learning Objectives Classification of Visible Surface Detection Algorithms Classification of Visible Surface Detection Algorithms Back-Face Detection Back-Face.
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.
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.
Lecture 30: Visible Surface Detection
Visible surface determination
Computer Graphics Implementation II
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
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
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.
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Visible-Surface Determination
Presentation transcript:

Visible surface determination

Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are visible, so that we do not needlessly calculate and draw surfces, which will not ultimately be seen by the viewer, or which might confuse the viewer.

Simple example… With all lines drawn, it is not easy to determine the front and back of the box. Is this the front face of the cube or the rear?

Simple example… ??

Approaches There are 2 fundamental approaches to the problem. –Object space –Image space

Object space Object space algorithms do their work on the objects themselves before they are converted to pixels in the frame buffer. The resolution of the display device is irrelevant here as this calculation is done at the mathematical level of the objects Pseudo code… –for each object a in the scene determine which parts of object a are visible draw these parts in the appropriate colour Involves comparing the polygons in object a to other polygons in a and to polygons in every other object in the scene.

Image space Image space algorithms do their work as the objects are being converted to pixels in the frame buffer. The resolution of the display device is important here as this is done on a pixel by pixel basis. Pseudo code… –for each pixel in the frame buffer determine which polygon is closest to the viewer at that pixel location colour the pixel with the colour of that polygon at that location

Algorithms Object space –Back-face culling Image space –z-buffer algorithm Hybrid –Depth-sort

Back-face culling Back-face culling (an object space algorithm) works on 'solid' objects which you are looking at from the outside. That is, the polygons of the surface of the object completely enclose the object.

Back-face culling Which way does a surface point? Vector mathematics defines the concept of a surface’s normal vector. A surface’s normal vector is simply an arrow that is perpendicular to that surface. Every planar polygon has a surface normal, that is, a vector that is normal to the surface of the polygon. –Actually every planar polygon has two normals. Given that this polygon is part of a 'solid' object we are interested in the normal that points OUT, rather than the normal that points in.

Back-face culling Consider the 2 faces of a cube and their normal vectors. Vectors N 1 and N 2 are the normals to surfaces 1 and 2 respectively. Vector L points from surface 1 to the viewpoint. Depending on the angle between L, and N 1 & N 2, they may or may not be visible to the viewer. N 2 N 1 L surface1 surface2

Back-face culling If we define  to be the angle between L and N. Then a surface is visible from the position given by L if: Can calculate Cos  using the formula:

Back-face culling Determining N: Can use cross product to calculate N N = A  B –NB. Vertices are given a counterclockwise order when looking at visible side. A B E D N N

Back-face culling Limitations: –It can only be used on solid objects… Remove the top or front face of the cube, and suddenly we can see inside, and our algorithm falls over. –It works fine for convex polyhedra but not necessarily for concave polyhedra. example of a partially hidden face, that will not be eliminated by Back-face removal.

Z-buffer algorithm The z-buffer or depth-buffer is one of the simplest visible-surface algorithms. Z-buffering is an image-space algorithm, an involves the use of a (surprisingly) z-buffer, to store the depth, or z- value of each pixel. All of the elements of the z-buffer are initially set to be 'very far away.' Whenever a pixel colour is to be changed the depth of this new colour is compared to the current depth in the z-buffer. If this colour is 'closer' than the previous colour the pixel is given the new colour, and the z-buffer entry for that pixel is updated as well. Otherwise the pixel retains the old colour, and the z-buffer retains its old value.

Z-buffer algorithm Pseudo code… for each polygon for each pixel p in the polygon's projection { pz = polygon's normalized z-value at (x, y); //z ranges from -1 to 0 if (pz > zBuffer[x, y]) // closer to the camera { zBuffer[x, y] = pz; framebuffer[x, y] = colour of pixel p; }

Depth-sort algorithm a.k.a. The Painter's Algorithm The idea here is to go back to front drawing all the objects into the frame buffer with nearer objects being drawn over top of objects that are further away. Simple algorithm: –Sort all polygons based on their farthest z coordinate –Resolve ambiguities –draw the polygons in order from back to front This algorithm would be very simple if the z coordinates of the polygons were guaranteed never to overlap. Unfortunately that is usually not the case, which means that step 2 can be somewhat complex.

Depth-sort algorithm First must determine z-extent for each polygon

Depth-sort algorithm Ambiguities arise when the z-extents of two surfaces overlap. z x surface 1 surface 2

Depth-sort algorithm

Any polygons whose z extents overlap must be tested against each other. We start with the furthest polygon and call it P. Polygon P must be compared with every polygon Q whose z extent overlaps P's z extent. 5 comparisons are made. If any comparison is true then P can be written before Q. If at least one comparison is true for each of the Qs then P is drawn and the next polygon from the back is chosen as the new P.

Depth-sort algorithm 1.do P and Q's x-extents not overlap. 2.do P and Q's y-extents not overlap. 3.is P entirely on the opposite side of Q's plane from the viewport. 4.is Q entirely on the same side of P's plane as the viewport. 5.do the projections of P and Q onto the (x,y) plane not overlap. If all 5 tests fail we quickly check to see if switching P and Q will work. Tests 1, 2, and 5 do not differentiate between P and Q but 3 and 4 do. So we rewrite 3 and 4 3’. is Q entirely on the opposite side of P's plane from the viewport. 4’. is P entirely on the same side of Q's plane as the viewport.

Depth-sort algorithm z x P Q if they do, test fails x - extents not overlap?

Depth-sort algorithm z y P Q if they do, test fails y - extents not overlap?

Depth-sort algorithm is P entirely on the opposite side of Q's plane from the viewport. z x P Q Test is true…

Depth-sort algorithm is Q entirely on the same side of P's plane as the viewport. z x P Q Test is true…

Depth-sort algorithm do the projections of P and Q onto the (x,y) plane not overlap. z x P Q y x P Q hole in P Test is true…

Depth-sort algorithm If all tests fail… –… then reverse P and Q in the list of surfaces sorted by Z max –set a flag to say that the test has been performed once. –If the tests fail a second time, then it is necessary to split the surfaces and repeat the algorithm on the 4 surfaces

Depth-sort algorithm End up drawing Q2,P1,P2,Q1