Rasterization May 14, 2007. Triangles Only We will discuss the rasterization of triangles only. Why? –Polygon can be decomposed into triangles. –A triangle.

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS SOFTWARE.
Advertisements

Scan Conversion A. Samal. Scan Conversion Last step in the graphics pipeline Efficiency is a central issue Common primitives – Lines – Polygons – Circles.
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
Computer Graphics Hardware Acceleration for Embedded Level Systems Brian Murray
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Graphics Programming: Polygon Filling
X86 and 3D graphics. Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Adv. Computer Graphics CS6500, Spring 2003.
1 Jinxiang Chai CSCE 441 Computer Graphics. 2 Midterm Time: 10:10pm-11:20pm, 10/20 Location: HRBB 113.
Sorting and cell compositing for irregular meshes Nelson Max, Peter Williams, Richard Cook, Claudio Silva.
©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Other Rendering Techniques Types of rendering – Wireframe techniques – Scan-line conversion – Reyes.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
Polygon Scan Conversion and Z-Buffering
Under the Hood: 3D Pipeline. Motherboard & Chipset PCI Express x16.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
1Computer Graphics Implementation III Lecture 17 John Shearer Culture Lab – space 2
Introduction to Computer Graphics with WebGL
CS 480/680 Computer Graphics Implementation III Dr. Frederick C Harris, Jr. Fall 2011.
A Quadrilateral Rendering Primitive Kai Hormann · Marco Tarini A Quadrilateral Rendering Primitive Visual Computing Group · CNR · Pisa.
Volume Rendering CMSC 491/635. Volume data  3D Scalar Field: F(x,y,z) = ?  Implicit functions  Voxel grid  Scalar data  Density  Temperature  Wind.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CAP4730: Computational Structures in Computer Graphics
CS418 Computer Graphics John C. Hart
Texture Mapping May 4, Many slides are borrowed from UNC-CH COMP236 Course (Spring 2003) taught by Leonard McMillan
Hidden Surface Removal
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
CS5500 Computer Graphics April 23, Today’s Topic Details of the front-end of the 3D pipeline: –How to construct the viewing matrix? –How to construct.
Lecture 15: Raster Graphics and Scan Conversion
Unstructured Volume Rendering. Grid Types uniformrectilinearregularcurvilinear Structured Grids: regularirregularhybridcurved Unstructured Grids:
Lecture 13: Raster Graphics and Scan Conversion
2 3D Viewing Process  3D viewing process MC Model Space Model Transformation Model Transformation WC World Space Viewing Transformation Viewing Transformation.
Computer Graphics CC416 Week 14 Filling Algorithms.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Graphics Pipeline Bringing it all together. Implementation The goal of computer graphics is to take the data out of computer memory and put it up on the.
Computer Graphics I, Fall 2010 Scan conversion algorithms.
Computer Graphics Filling.
Computer Graphics Filled Area Primitives II Lecture 09 Taqdees A
University of New Mexico
Implementation III.
Polygon Filling Algorithms
CS148: Introduction to Computer Graphics and Imaging
Algorithm design techniques Dr. M. Gavrilova
Introduction to Computer Graphics with WebGL
Lecture 13 Clipping & Scan Conversion
Chapter VII Rasterizer
Computer Graphics Implementation III
Introduction to Meshes
Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007.
CS5500 Computer Graphics April 24, 2006.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Type to enter a caption. Computer Graphics Week 6 Lecture 1.
Implementation III Ed Angel Professor Emeritus of Computer Science
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Introduction to Meshes
Clipping Polygons Lecture 31 Fri, Nov 9, 2007.
Presentation transcript:

Rasterization May 14, 2007

Triangles Only We will discuss the rasterization of triangles only. Why? –Polygon can be decomposed into triangles. –A triangle is always convex. –Results in algorithms that are more hardware friendly.

Being Hardware Friendly [Angel 4e] Section or [Angel 3e] Section : –Intersect scan lines with polygon edges. –Sort the intersections, first by scan lines, then by order of x on each scan line. –It works for polygons in general, not just in triangles. –O(n log n) complexity  feasible in software implementation only (i.e., not hardware friendly)

Color and Z Now we know which pixels must be drawn. The next step is to find their colors and Z’s. Gouraud shading: linear interpolation of the vertex colors. Isn’t it straightforward? –Interpolate along the edges. (Y direction) –Then interpolate along the span. (X direction)

Interpolation in World Space vs Screen Space p1=(x1, y1, z1, c1); p2=(x2, y2, z2, c2); p3=(x3, y3, z3, c3) in world space If (x3, y3) = (1-t)(x1, y1) + t(x2, y2) then z3=(1-t)z1+t z2; c3=(1-t)c1+t c2 But, remember that we are interpolating on screen coordinates (x’, y’):

Let p’ 1 =(x’ 1, y’ 1 ); p’ 2 =(x’ 2, y’ 2 ) and p’ 3 =(x’ 3, y’ 3 )= (1-s)(x’ 1, y’ 1 ) + s(x’ 2, y’ 2 ) Does s=t? If not, should we compute z3 and c3 by s or t? Express s in t (or vice versa), we get something like: So, if we interpolate z on screen space, we get the z of “some other point on the line” This is OK for Z’s, but may be a problem for texture coordinates (topic of another lecture)

Appendix

Derivation of s and t Two end points P 1 =(x 1, y 1, z 1 ) and P 2 =(x 2, y 2, z 2 ). Let P 3 =(1-t)P 1 +(t)P 2 After projection, P 1, P 2, P 3 are projected to (x’ 1, y’ 1 ), (x’ 2, y’ 2 ), (x’ 3, y’ 3 ) in screen coordinates. Let (x’ 3, y’ 3 )=(1-s)(x’ 1, y’ 1 ) + s(x’ 2, y’ 2 ).

(x’ 1, y’ 1 ), (x’ 2, y’ 2 ), (x’ 3, y’ 3 ) are obtained from P 1, P 2, P 3 by:

Since We have:

When P 3 is projected to the screen, we get (x’ 3, y’ 3 ) by dividing by w, so: But remember that (x’ 3, y’ 3 )=(1-s)(x’ 1, y’ 1 ) + s(x’ 2, y’ 2 ) Looking at x coordinate, we have

We may rewrite s in terms of t, w 1, w 2, x’ 1, and x’ 2. In fact, or conversely Surprisingly, x’ 1 and x’ 2 disappear.