Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Today Composing transformations 3D Transformations
1Computer Graphics Homogeneous Coordinates & Transformations Lecture 11/12 John Shearer Culture Lab – space 2
Transformations Ed Angel Professor Emeritus of Computer Science
Graphics Pipeline.
3D Graphics Rendering and Terrain Modeling
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Based on slides created by Edward Angel
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Representation Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Representation CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
Geometric Objects and Transformation
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
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.
Implementation II.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
CSE Real Time Rendering Week 5. Slides(Some) Courtesy – E. Angel and D. Shreiner.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Computer Graphics I, Fall 2010 Implementation II.
1 Representation. 2 Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames.
Computer Graphics I, Fall 2010 Transformations.
Chapter 1 Graphics Systems and Models Models and Architectures.
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Computer Graphics Implementation II
Transformations Objectives
CSC461: Lecture 20 Parallel Projections in OpenGL
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.
3D Graphics Rendering PPT By Ricardo Veguilla.
Projections and Normalization
CSC461: Lecture 19 Computer Viewing
Models and Architectures
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Projections and Hidden Surface Removal
Models and Architectures
Transformations Ed Angel
Models and Architectures
Transformations Ed Angel Professor Emeritus of Computer Science
Isaac Gang University of Mary Hardin-Baylor
Presentation transcript:

Review on Graphics Basics

Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to fragments

Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to fragments

Polygon Rendering Pipeline Process objects one at a time in the order they are generated by the application Pipeline architecture All steps can be implemented in hardware on the graphics card application program display

Vertex Processing Much of the work in the pipeline is in converting object representations from one coordinate system to another – Object coordinates – Camera (eye) coordinates – Screen coordinates Every change of coordinates is equivalent to a matrix transformation Vertex processor also computes vertex colors

Projection Projection is the process that combines the 3D viewer with the 3D objects to produce the 2D image – Perspective projections: all projectors meet at the center of projection – Parallel projection: projectors are parallel, center of projection is replaced by a direction of projection

Primitive Assembly Vertices must be collected into geometric objects before clipping and rasterization can take place – Line segments – Polygons – Curves and surfaces

Clipping Just as a real camera cannot “see” the whole world, the virtual camera can only see part of the world or object space – Objects that are not within this volume are said to be clipped out of the scene

Rasterization If an object is not clipped out, the appropriate pixels in the frame buffer must be assigned colors Rasterizer produces a set of fragments for each object Fragments are “potential pixels” – Have a location in frame buffer – Color and depth attributes Vertex attributes are interpolated over objects by the rasterizer

Fragment Processing Fragments are processed to determine the color of the corresponding pixel in the frame buffer Colors can be determined by texture mapping or interpolation of vertex colors Fragments may be blocked by other fragments closer to the camera – Hidden-surface removal

Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to fragments

Affine Transformations Line and parallelism preserving Affine transformations used in Graphics – Rigid body transformations: rotation, translation – Scaling, shear Importance in graphics is that we need only transform endpoints of line segments and let implementation draw line segment between the transformed endpoints

Homogeneous Coordinates The homogeneous coordinates form for a three dimensional point [x y z] is given as p =[x’ y’ z’ w] T =[wx wy wz w] T We return to a three dimensional point (for w  0 ) by x  x’ /w y  y’/w z  z’/w If w=0, the representation is that of a vector Note that homogeneous coordinates replaces points in three dimensions by lines through the origin in four dimensions For w=1, the representation of a point is [x y z 1]

Homogeneous Coordinates and Computer Graphics Homogeneous coordinates are key to all computer graphics systems – All standard transformations (rotation, translation, scaling) can be implemented with matrix multiplications using 4 x 4 matrices – Hardware pipeline works with 4 dimensional representations

Translation Matrix We can also express translation using a 4 x 4 matrix T in homogeneous coordinates p ’= Tp where T = T (d x, d y, d z ) = This form is better for implementation because all affine transformations can be expressed this way and multiple transformations can be concatenated together

Rotation (2D) Consider rotation about the origin by  degrees – radius stays the same, angle increases by  x’=x cos  –y sin  y’ = x sin  + y cos  x = r cos  y = r sin  x’ = r cos (  y’ = r sin ( 

Rotation about the z axis Rotation about z axis in three dimensions leaves all points with the same z – Equivalent to rotation in two dimensions in planes of constant z – or in homogeneous coordinates p ’= R z (  )p x’=x cos  –y sin  y’ = x sin  + y cos  z’ =z

Rotation Matrix R = R z (  ) =

Scaling S = S(s x, s y, s z ) = x’=s x x y’=s y x z’=s z x p’=Sp Expand or contract along each axis (fixed point of origin)

Reflection corresponds to negative scale factors original s x = -1 s y = 1 s x = -1 s y = -1s x = 1 s y = -1

Shear Helpful to add one more basic transformation Equivalent to pulling faces in opposite directions

Shear Matrix Consider simple shear along x axis x’ = x + y cot  y’ = y z’ = z H(  ) =

Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to fragments

Affine vs. Projective Transformation Difference is in the last line of the transformation matrix. – Projective transformation preserves collinearity but not parallelism, length, and angle. – Affine transformation is a special case of the projective transformation. However, it preserves parallelism. M a = M p =

Projections and Normalization The default projection in the eye (camera) frame is orthogonal For points within the default view volume Most graphics systems use view normalization – All other views are converted to the default view by transformations that determine the projection matrix – Allows use of the same pipeline for all views x p = x y p = y z p = 0

Homogeneous Coordinate Representation x p = x y p = y z p = 0 w p = 1 p p = Mp M = In practice, we can let M = I and set the z term to zero later default orthographic projection

Simple Perspective Center of projection at the origin Projection plane z = d, d < 0

Perspective Equations Consider top and side views x p =y p = z p = d

Homogeneous Coordinate Form M = consider q = Mp where q =  p =

Perspective Division However w  1, so we must divide by w to return from homogeneous coordinates This perspective division yields the desired perspective equations We will consider the corresponding clipping volume with the OpenGL functions x p =y p = z p = d

Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to fragments

Phong Model For each light source and each color component, the Phong model can be written as I = (a+bd+cd 2 ) -1 [ k d I d l · n+k s I s ( v · r )  +k a I a ] For each color component we add contributions from all sources

Example Only differences in these teapots are the parameters in the modified Phong model

Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to fragments

Pipeline Clipping of Polygons Three dimensions: add front and back clippers Strategy used in SGI Geometry Engine Small increase in latency

Scan Conversion and Interpolation span C1C1 C3C3 C2C2 C5C5 C4C4 scan line C 1 C 2 C 3 specified by glColor or by vertex shading C 4 determined by interpolating between C 1 and C 2 C 5 determined by interpolating between C 2 and C 3 interpolate between C 4 and C 5 along span

Hidden Surface Removal z-Buffer Algorithm – Use a buffer called the z or depth buffer to store the depth of the closest object at each pixel found so far – As we render each polygon, compare the depth of each pixel to depth in z buffer – If less, place shade of pixel in color buffer and update z buffer