1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Graphic pipeline  Scan-conversion algorithm (high level)  Pixels.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
Mark Nelson Rendering algorithms Fall 2013
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Hidden Surface Removal 고려대학교 컴퓨터 그래픽스 연구실.
Part I: Basics of Computer Graphics
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Interpolation Clipping.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Clipping & Scan Conversion
X86 and 3D graphics. Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that.
Gopi -ICS186AW03 - Slide1 Graphics Pipeline: First Pass.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
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.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Hidden Surface Removal
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Computer Graphics Mirror and Shadows
Polygon Scan Conversion and Z-Buffering
Basics of Rendering Pipeline Based Rendering –Objects in the scene are rendered in a sequence of steps that form the Rendering Pipeline. Ray-Tracing –A.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
COMP 261 Lecture 16 3D Rendering. input: set of polygons viewing direction direction of light source(s) size of window. output: an image Actions rotate.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Visible-Surface Detection Jehee Lee Seoul National University.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
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.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Hidden Surface Removal
CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008.
Implementation II.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
1 Georgia Tech, IIC, GVU, 2007 MAGIC Lab Rossignac Perspective & scan-conversion  How to draw perspective images.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
Chapter III Rasterization
Computer Graphics I, Fall 2010 Implementation II.
Honours Graphics 2008 Session 5. Today’s focus Rasterization Visibility determination Coarse / fine visibility determination.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Learning Objectives Classification of Visible Surface Detection Algorithms Classification of Visible Surface Detection Algorithms Back-Face Detection Back-Face.
RENDERING : Global Illumination
2 3D Viewing Process  3D viewing process MC Model Space Model Transformation Model Transformation WC World Space Viewing Transformation Viewing Transformation.
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.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Shadows & occlusion  Shadow - occlusion duality  Floor shadows.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Rendering Pipeline Fall, 2015.
- Introduction - Graphics Pipeline
Computer Graphics Implementation II
Week 2 - Friday CS361.
Hidden Surface Removal
CS451Real-time Rendering Pipeline
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
CSL 859: Advanced Computer Graphics
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.
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Chapter V Vertex Processing
Lecture 13 Clipping & Scan Conversion
Chapter VII Rasterizer
Visibility (hidden surface removal)
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Graphic pipeline  Scan-conversion algorithm (high level)  Pixels covered by a triangle’s projection  Why scan-conversion is faster than ray-casting  Conversion of points and vectors to screen coordinates

2 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Scan-conversion algorithm (high level) For each triangle T do For each pixel P covered by the projection of T { If (T is in front of previously visited triangles seen through P) { Update the color of P} } The “in front of” test is accomplished by storing the distance to the nearest triangle encountered so far along ray(E,P) in the zbuffer Z[P] The color is computed through linear interpolation of the colors at the vertices of the triangle

3 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Graphic Pipeline  Model transforms  Vertex lighting  Viewing transform  Frustum clipping  Perspective transform  Slope computation  Scan-conversion

4 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Conversion screen coordinates Screen center O, horizontal axis unit vector I, viewing direction K.  Compute the (x,y,z) coordinates of a point Q in the screen coordinate system K J I O x=OQI y=OQJ z=OQK Q

5 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Frustum

6 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac  What does it do? –Trims each triangle to the portion that projects onto the screen  Why? –To avoid processing pixels that do not exist  How? –Could (should?) do this during scan-conversion clip the range of L to the vertical range of the screen clip the pixel range [S..E] to the horizontal range of the screen –Usually done as a separate preprocessing stage In model space (before perspective transform) –Intersect the triangle the viewing frustum »Intersection of 5 or 6 half-spaces Or in image space (after perspective) –Using axis-aligned half-spaces Clipping

7 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Clipping a triangle by a half-space  Compute the intersection of triangle (A,B,C) with half-space H(Q,N) defined by {P:NPQ>0} –If (NAQ)(NBQ)<0 Insert intersection point M –Binary search or –Division »t:= NAQ / NBA »M:=A+tAB –Repeat for other 2 edges –Discard bad vertices (B) –Triangulate  How complex can the result be? –Block/plane intersection : convex hexagon –Intersect it with a triangle N Q A BC M Could we get 10 vertices?

8 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Perspective  Transform the model so that the (x,y) of each vertex correspond to its projection on the screen.  But if we set z to 0, we will not know what is hidden We need a perspective transform that preserves depth order!

9 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Pixels covered by a triangle’s projection  Their center must fall inside the projection of the triangle  We need only to worry about the pixels inside the axis aligned rectangle around the projection of T  Could test each one of them against the triangle (expensive)  Could update linear inequality of the 3 clipping half-spaces –F(x+1,y) = f(x,y) + constant  Usually done in scan-line –Establish leading and trailing pixels –Using slope of edges

10 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac A naïve 3D graphics rasterization process Clear z-buffer Z[*,*] and back frame buffer I[*,*] For each triangle (A,B,C) do Lit A, B, C using normals, surface attributes, lighting parameters Transform vertices {A’=dA/(d+A.z); B’=dC/(d+B.z); C’=dC/(d+C.z)} Compute slopes for c (color), z (depth), and leading/trailing edges For each scanline L covered by triangle (A’,B’,C’) do Compute pixel range [S..E] by interpolation on leading/trailing edges Compute z and c at pixel (S,L, by interpolation on the leading edge For each pixel P in [S..E] do Compute z and c using interpolation If z < Z[P,L] then {Z[P,L]:=z; I[P,L]:=c} Swap back and front frame buffer to show image PSE L

11 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Rasterization costs  Per vertex –Lighting calculations –Perspective transformation –Slopes calculation  Per pixel –Interpolations of z, c (and leading trailing edges, amortized) –Read, compare, right to update the z-buffer and frame buffer

12 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Ray-casting / scan-conversion similarities  Ray-casting: –For each pixel P do For each triangle T projecting over P do –Decide if the triangle is visible –Compute reflected color and store in the pixel  Scan-conversion: –For each triangle T do For each pixel P covered by the projection of T do –Decide if the triangle is visible –Compute reflected color and store in the pixel

13 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Scan-conversion is faster than ray-casting  Ray casting consider all ray-triangle pairs.  Scan-conversion only considers pixels covered by each triangle. –10,000 times less work if you have 10x10 pixel triangles  Ray-casting requires multiplications and divisions for selecting which triangles cover a pixel and for computing the corresponding depth.  Scan-conversion uses a constant number of multiplications and division per triangle (to compute vertex projections and slopes), but only additions to test which pixels are covered and to compute the color and depth for each pixel.