CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008.

Slides:



Advertisements
Similar presentations
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Advertisements

1 Computer Graphics Chapter 8 3D Transformations.
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
CS 4363/6353 INTRODUCTION TO COMPUTER GRAPHICS. WHAT YOU’LL SEE Interactive 3D computer graphics Real-time 2D, but mostly 3D OpenGL C/C++ (if you don’t.
Viewing and Projections
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Projection Matrices Ed Angel
Part I: Basics of Computer Graphics Viewing Transformation and Coordinate Systems Chapter
Objectives Derive the perspective projection matrices used for standard OpenGL projections Derive the perspective projection matrices used for standard.
Gopi -ICS186AW03 - Slide1 Graphics Pipeline: First Pass.
1 Jinxiang Chai CSCE 441 Computer Graphics. 2 Midterm Time: 10:10pm-11:20pm, 10/20 Location: HRBB 113.
1 Lecture 8 Clipping Viewing transformations Projections.
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
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.
2/26/04© University of Wisconsin, CS559 Spring 2004 Last Time General Orthographic Viewing –Specifying cameras in world coordinates –Building world  view.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
COMP 175: Computer Graphics March 24, 2015
Viewing and Projections
Computer Graphics Panos Trahanias ΗΥ358 Spring 2009.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
Week 2 - Wednesday CS361.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
CS-378: Game Technology Lecture #2.1: Projection Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
Programming 3D Applications CE Displaying Computer Graphics Week 3 Lecture 5 Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
CS 4731: Computer Graphics Lecture 13: Projection Emmanuel Agu.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
2/19/04© University of Wisconsin, CS559 Spring 2004 Last Time Painterly rendering 2D Transformations –Transformations as coordinate system changes –Transformations.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
1 Graphics CSCI 343, Fall 2015 Lecture 18 Viewing III--More Projection.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
CS559: Computer Graphics Final Review Li Zhang Spring 2010.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Viewing and Projection

CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Modeling and The Viewing Pipeline Jian Huang CS594 The material in this set of slides have referenced slides from Ohio State, Minnesota and MIT.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
Introduction to Computer Graphics
Visible Surface Detection
Rendering Pipeline Fall, 2015.
Intro to 3D Graphics.
Graphics Fundamentals
CSCE 441 Computer Graphics 3-D Viewing
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
Lecture 9: Projection Li Zhang Spring 2008
CENG 477 Introduction to Computer Graphics
3D Clipping.
CSL 859: Advanced Computer Graphics
Lecture 9: Projection Li Zhang Spring 2008
Presentation transcript:

CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008

Today Finish Projection Rasterization Antialising Hidden Surface Removal Reading: – Shirley ch 7,4,8

3D Geometry Pipeline Model Space (Object Space) World Space Eye Space (View Space) Rotation Translation Resizing Rotation Translation Projective, Scale Translation

Clipping and the viewing frustum The center of projection and the portion of the projection plane that map to the final image form an infinite pyramid. The sides of the pyramid are clipping planes. Frequently, additional clipping planes are inserted to restrict the range of depths. These clipping planes are called the near and far or the hither and yon clipping planes. All of the clipping planes bound the viewing frustum.

View Volume Transformation We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volume – This matrix will go in our pipeline before an orthographic projection matrix (l,b,n) (r,t,n)(l,b,n) (r,t,n) (r,t,f)

Mapping Lines We want to map all the lines through the center of projection to parallel lines – This converts the perspective case to the orthographic case, we can use all our existing methods The relative intersection points of lines with the near clip plane should not change The matrix that does this looks like the matrix for our simple perspective case n f -z y

How to get this mapping? n f -z y

Properties of this mapping If z = n, M(x,y,z,1) = [x,y,z,1] near plane is unchanged If x/z = c1, y/z = c2, then x’=n*c1, y’=n*c2 bending converging rays to parallel rays If z1 < z2, z1’ < z2’ z ordering is preserved n f -z y In pyramid  In cube

General Perspective

To Canonical view volume Perspective projection transforms a pyramid volume to an orthographic view volume (l,b,n) (r,t,n)(l,b,n) (r,t,n) (r,t,f) (1,-1,1) (-1,1,-1) Canonical view volume [-1,1]^3 Scale, translate

Orthographic View to Canonical Matrix

Complete Perspective Projection After applying the perspective matrix, we map the orthographic view volume to the canonical view volume:

3D Geometry Pipeline Model Space (Object Space) World Space Eye Space (View Space) Rotation Translation Resizing : Projective, Scale, Translation Canonical View Space Screen Space (2D) Rotation Translation Image Space (pixels) Raster Space

3D Geometry Pipeline Model Space (Object Space) World Space Eye Space (View Space) Rotation Translation Resizing Canonical View Space Screen Space (2D) Rotation Translation Image Space (pixels) Raster Space

3D Geometry Pipeline Model Space (Object Space) World Space Eye Space (View Space) Rotation Translation Resizing Canonical View Space Screen Space (2D) Rotation Translation Image Space (pixels) Raster Space Order matters!!!

Canonical  Window Transform (-1,-1) (1,1) n y -1 (x min,y min )=(-0.5,-0.5) n x -1 (x max, y max )=(n x -0.5,n y -0.5)

3D Geometry Pipeline Model Space (Object Space) World Space Eye Space (View Space) Rotation Translation Resizing Canonical View Space Screen Space (2D) Rotation Translation Image Space (pixels) Raster Space

Polygons are basic shape primitives Any 3D shape can be approximated by a polygon using a locally linear (planar) approximation. To improve the quality of fit, we need only increase the number of edges

Line Drawing (x 1, y 1 ) (x 0, y 0 )

Line Drawing (x 1, y 1 ) (x 0, y 0 ) for x = x0 to x1 do y=y0+(∆y/∆x)(x-x0) draw(x,round(y)) for x = x0 to x1 do y=y0+(∆y/∆x)(x-x0) draw(x,round(y))

Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1

Implicit Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 f(x+1,y+0.5)<0

Implicit Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 f(x+1,y+0.5)<0 Incremental Evaluation

Implicit Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else d<0 d=f(x+1,y+0.5) D=d-∆y+∆x D=d-∆y Incremental Evaluation

Implicit Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else d<0 d=2f(x+1,y+0.5) D=d-2∆y+2∆x D=d-2∆y Incremental Evaluation Integer operation

Implicit Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else d<0 d=2f(x+1,y+0.5) D=d-2∆y+2∆x D=d-2∆y

Implicit Line Drawing y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else d<0 d=2f(x+1,y+0.5) D=d-2∆y+2∆x D=d-2∆y

Implicit Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1

Implicit Line Drawing y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1

Implicit Line Drawing (x 1, y 1 ) (x 0, y 0 ) y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else y = y0 for x = x0 to x1 do draw(x,y) if (some condition) then y=y+1 else d<0 d=2f(x+1,y+0.5) D=d-2∆y+2∆x D=d-2∆y If ∆y>∆x, switch x and y

Drawing Triangle

for all y do for all x do if (in triangle) then draw(x,y) with color c for all y do for all x do if (in triangle) then draw(x,y) with color c A3A3 A1A1 A2A2 P

Drawing Triangle for all y do for all x do compute t 1,t 2,t 3 if t 1,t 2,t 3 in [0,1] then draw(x,y) with color t 1 c 1 +t 2 c 2 +t 3 c 3 for all y do for all x do compute t 1,t 2,t 3 if t 1,t 2,t 3 in [0,1] then draw(x,y) with color t 1 c 1 +t 2 c 2 +t 3 c 3 A3A3 A1A1 A2A2 P

Common Edge for all y do for all x do compute t 1,t 2,t 3 if t 1,t 2,t 3 in [0,1] then draw(x,y) with color t 1 c 1 +t 2 c 2 +t 3 c 3 for all y do for all x do compute t 1,t 2,t 3 if t 1,t 2,t 3 in [0,1] then draw(x,y) with color t 1 c 1 +t 2 c 2 +t 3 c 3