Hidden Line Removal Adopted from U Strathclyde’s course page.

Slides:



Advertisements
Similar presentations
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
Advertisements

Computer Graphics methods
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.
Part I: Basics of Computer Graphics
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
CS 450: Computer Graphics OVERVIEW OF POLYGONS
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.
Computer Graphics 14: Surface Detection Methods
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
Components of illumination that from diffuse illumination (incident rays come from all over, not just one direction) - E d that from a point source which.
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.
Mathematical Fundamentals
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 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
Orthographic Drawings
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
PROJECTIONS OF SOLIDS & SECTIONS OF SOLIDS
1 SheetCourse: Engineering Graphics 1504Memorial University of Newfoundland Engi 1504 – Graphics Lecture 5: Sectioning and Dimensioning l Sectioning an.
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
Implementation II.
COM 366 Reading Data. COM 366 Reading data from disc files Organise the data in a logical fashion with comments as necessary. #Data for a cube # First.
Higher Dimensions. x Let's say we use a pencil to mark a point on paper. x is this point. We pick a direction and move the pencil along this direction.
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.
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.
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.
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.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Extended Work on 3D Lines and Planes. Intersection of a Line and a Plane Find the point of intersection between the line and the plane Answer: (2, -3,
Visible Surface Detection
Computer Graphics Implementation II
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
BACK FACE DETECTION back-face detection Determination of whether a face of an object is facing backward and therefore invisible. The usual test is whether.
Visible-Surface Detection Methods
3D Graphics Rendering PPT By Ricardo Veguilla.
CSCE 441: Computer Graphics Hidden Surface Removal
Implementation II Ed Angel Professor Emeritus of Computer Science
Isometric and Orthographic Projections
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Visible-Surface Determination
Presentation transcript:

Hidden Line Removal Adopted from U Strathclyde’s course page

Introduction Depth cueing Surfaces Vectors/normals Hidden face culling Convex/concave solids

Perspective Confusion

Hidden Line Removal (show demo – basic3d wireframe surface)

Hidden Line Removal No one best algorithm Look at a simple approach for convex solids based upon working out which way a surface is pointing relative to the viewer. convex concave

Based on surfaces not lines Need a Surface data structure WireframeSurface –made up of lines

Flat surfaces Key requirement of our surfaces is that they are FLAT. Easiest way to ensure this is by using only three points to define the surface…. – (any triangle MUST be flat - think about it) …but as long as you promise not to do anything that will bend a flat surface, we can allow them to be defined by as many points as you like. Single sided

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 (i.e. it sticks straight out)

Determining visibility Consider the six faces of a cube and their normal vectors Vectors N 1 and N 2 are are the normals to surfaces 1 and 2 respectively. Vector L points from surface 1 to the viewpoint. It can be seen that surface 1 is visible to the viewer whilst surface 2 cannot be seen from that position.

Determining visibility Mathematically, a surface is visible from the position given by L if: Where  is the angle between L and N. Equivalently,

Determining visibility Fortunately we can calculate cos  from the direction of L ( l x,l y,l z ) and N ( n x,n y,n z ) This is due to the well known result in vector mathematics - the dot product (or the scalar product) whereby:

Determining visibility Alternatively: Where L and N are unit vectors (i.e of length 1)

How do we work out L.N?

–At this point we know: we need to calculate cos  Values for l x,l y,l z The only things we are missing are n x,n y,n z

Calculating the normal vector –If you multiply any two vectors using the vector product, the result is another vector that is perpendicular to the plane (i.e normal) which contained the two original vectors.

IMPORTANT We need to adopt the convention that the calculated normal vector points away from the observer when the angle between the two initial vectors is measured in an clockwise direction. Failure to do this will lead to MAJOR confusion when you try and implement this Believe me, I know.

Calculating the normal –Where to find two vectors that we can multiply? –Answer: we can manufacture them artificially from the points that define the plane we want the normal of

Calculating the normal By subtracting the coordinates of consecutive points we can form vectors which a guaranteed to lie in the plane of the surface under consideration.

Calculating the normal We define the vectors to be anti-clockwise, when viewing the surface from the interior (imagine the surface is part of a cube and your looking at it from INSIDE the cube). Following the anticlockwise convention mentioned above we have produced what is known as an outward normal.

IMPORTANT An important consequence of this is that when you define the points that define a surface in a program, you MUST add them in anti-clockwise order

Calculating the normal This is a definition of the vector product

Visibility –At this point we know: we need to calculate cos  Values for l x,l y,l z values for n x,n y,n z

Visibility If then draw the surface else don’t! (or draw dashes)

Making it easier Actually, in certain cases we can simplify things a little. If the viewpoint lies somewhere on the negative side of z-axis, as it did when we first set up the projection transformations (i.e without any viewpoint transformations) we can forget about L and cos  All we really need to know is whether or not the normal points into the screen or out of it, i.e. is n z positive or negative? In that case, all we need to do is calculate n z and test it

An alternative approach Consider where the extension of the surface cuts the z-axis

More complex shapes Multiple objects Concave objects

More complex shapes In these cases, each surface must be considered individually. Two different types of approach are possible: –Object space algorithms - examine each face in space to determine it visibility –Image space algorithms - at each screen pixel position, determine which face element is visible. Approximately, the relative efficiency of an image space algorithm increases with the complexity of the scene being represented, but often the drawing can be simplified for convex objects by removing surfaces which are invisible even for a single object.

The z-buffer (or painter’s) algorithm –based upon sorting the surfaces by their z- coordinates. The algorithm can be summarised thus: –Sort the surfaces into order of increasing depth. Define the maximum z value of the surface and the z-extent. –resolve any depth ambiguities –draw all the surfaces starting with the largest z-value

Ambiguities Ambiguities arise when the z-extents of two surfaces overlap.

Ambiguities – front view

Resolving Ambiguities –An algorithm exists for ambiguity resolution –Where two shapes P and Q have overlapping z-extents, perform the following 5 tests (in sequence of increasing complexity). –If any test fails, draw P first.

x - extents overlap?

y -extents overlap?

Is Q not completely on the side of P nearest the viewer?

Is P not completely on the side of Q further from the viewer?

Does the projection of the two surfaces overlap?

If all tests are passed … then reverse P and Q in the list of surfaces sorted by Z max set a flag to say that the test has been perfomed once. The flag is necessary for the case of intersecting planes. If the tests are all passed a second time, then it is necessary to split the surfaces and repeat the algorithm on the 4 surfaces

End up drawing Q2,P1,P2,Q1

Summary Need for depth cues and hidden line removal Using surfaces rather than lines Calculating which way a surface is facing (surface normal) Base a decision on visibility on normal vector and observer vector

References es/52.359if/