2/28/2016 CS 551 / 645: Introductory Computer Graphics Framebuffer Mathematical Foundations The Rendering Pipeline.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

UBI 516 Advanced Computer Graphics
MAE152 Computer Graphicsfor Scientists and Engineers Revision of Matrices Relevance to Graphics.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
Chapter 4.1 Mathematical Concepts
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
Welcome to CSc 830 Advanced Computer Graphics
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
2IV60 Computer Graphics Basic Math for CG
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
HCT.
Basic graphics. ReviewReview Viewing Process, Window and viewport, World, normalized and device coordinates Input and output primitives and their attributes.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
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.
Chapter 4.1 Mathematical Concepts
COMP 175: Computer Graphics March 24, 2015
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Computer Graphics in Java1 Objects and Viewers Two basic entities (one object seen from two different positions) :
Transformations Dr. Amy Zhang.
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
CS 445 / 645 Introduction to Computer Graphics Lecture 3 Mathematical Primitives Introduction to Transformations Lecture 3 Mathematical Primitives Introduction.
Computer Graphics Raster Devices Transformations Areg Sarkissian.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Mathematics for Graphics. 1 Objectives Introduce the elements of geometry  Scalars  Vectors  Points Develop mathematical operations among them in a.
CS 445 / 645: Introductory Computer Graphics Light.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
Geometric Objects and Transformation
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
David Luebke11/14/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 Computer Graphics Three-Dimensional Graphics I.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CS 551 / 645: Introductory Computer Graphics Mathematical Foundations.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
CS 445: Introduction to Computer Graphics David Luebke University of Virginia The Rendering Pipeline.
David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Computer Graphics Matrices
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
David Luebke2/16/2016 CS 551 / 645: Introductory Computer Graphics Mathematical Foundations The Rendering Pipeline.
Rendering Pipeline and Graphics Hardware Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Computer Graphics I, Fall 2010 Geometry.
David Luebke6/12/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Introduction; Mathematical Foundations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
CA 302 Computer Graphics and Visual Programming
- Introduction - Graphics Pipeline
Computer Graphics Raster Devices Transformations
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.
CS451Real-time Rendering Pipeline
Lecture 03: Linear Algebra
CSE 411 Computer Graphics Lecture #2 Mathematical Foundations
CS 551 / 645: Introductory Computer Graphics
Presentation transcript:

2/28/2016 CS 551 / 645: Introductory Computer Graphics Framebuffer Mathematical Foundations The Rendering Pipeline

2/28/2016 Organization l Class List l ITC accounts l Class web page is up l Assignment 1 goes out on Thursday l Read OGLPG Chapter 1 for Thursday

2/28/2016 Basic Definitions Raster: A rectangular array of points or dots. Pixel (Pel): One dot or picture element of the raster Scan line: A row of pixels Video raster devices display an image by sequentially drawing out the pixels of the scan lines that form the raster.

2/28/2016 Frame Buffers l A frame buffer may be thought of as computer memory organized as a two-dimensional array with each (x,y) addressable location corresponding to one pixel. l Bit Planes or Bit Depth is the number of bits corresponding to each pixel. l A typical frame buffer resolution might be 640 x 480 x x 1024 x x 1024 x 24

2/28/ Bit Memory, Monochrome Display (Bitmap Display)

2/28/ Bit Color Display

2/28/2016 True Color Display Red Blue bitplanes, 8 bits per color gun = 16,777,216

2/28/2016 Color Map Look-Up Tables Extends the number of colors that can be displayed by a given number of bit-planes RG B RED GREEN BLUE Pixel displayed at x', y' Pixel in bit map at x', y' 0 x 0 y x max y Frame bufferLook-up tableDisplay

2/28/2016 Pseudo color 2 8 x 24 Color Map LUT

2/28/2016 Display processor l Specialized hardware to assist in scan converting output primitives into the frame buffer. l Fundamental difference among display systems is how much the display processor does versus how much must be done by the graphics subroutine package executing on the general-purpose CPU. l Now often called graphics accelerator

2/28/2016 Mathematical Foundations l FvD appendix gives good review l I’ll give a brief, informal review of some of the mathematical tools we’ll employ –Geometry (2D, 3D) –Trigonometry –Vector spaces n Points, vectors, and coordinates –Dot and cross products –Linear transforms and matrices

2/28/2016 2D Geometry l Know your high school geometry: –Total angle around a circle is 360° or 2π radians –When two lines cross: n Opposite angles are equivalent n Angles along line sum to 180° –Similar triangles: n All corresponding angles are equivalent

2/28/2016 Trigonometry l Sine: “opposite over hypotenuse” l Cosine: “adjacent over hypotenuse” l Tangent: “opposite over adjacent” l Unit circle definitions: –sin (  ) = x –cos (  ) = y –tan (  ) = x/y –Etc… (x, y)

2/28/2016 Slope-intercept Line Equation Slope = m = rise / run Slope = (y - y1) / (x - x1) = (y2 - y1) / (x2 - x1) Solve for y: y = [(y2 - y1)/(x2 - x1)]x + [-(y2-y1)/(x2 - x1)]x1 + y1 or: y = mx + b x y P2 = (x2, y2) P1 = (x1, y1) P = (x, y)

2/28/2016 Parametric Line Equation l Given points P1 = (x1, y1) and P2 = (x2, y2) x = x1 + t(x2 - x1) y = y1 + t(y2 - y1) l When: –t=0, we get (x1, y1) –t=1, we get (x2, y2) –(0<t<1), we get points on the segment between (x1, y1) and (x2, y2) x y P2 = (x2, y2) P1 = (x1, y1)

2/28/2016 Other helpful formulas l Length = sqrt (x2 - x1) 2 + (y2 - y1) 2 l Midpoint, p2, between p1 and p3 –p2 = ((x1 + x3) / 2, (y1 + y3) / 2)) l Two lines are perpendicular if: –M1 = -1/M2 –cosine of the angle between them is 0

2/28/2016 3D Geometry l To model, animate, and render 3D scenes, we must specify: –Location –Displacement from arbitrary locations –Orientation

2/28/2016 Vector Spaces l Two types of elements: –Scalars (real numbers):  … –Vectors (n-tuples): u, v, w, … l Supports two operations: –Addition operation u + v, with: Identity 0 v + 0 = v Inverse - v + (- v ) = 0 –Scalar multiplication: Distributive rule:  ( u + v ) =  ( u ) +  ( v ) (  +  ) u =  u +  u

2/28/2016 Vector Spaces l A linear combination of vectors results in a new vector: v =  1 v 1 +  2 v 2 + … +  n v n l If the only set of scalars such that  1 v 1 +  2 v 2 + … +  n v n = 0 is  1 =  2 = … =  3 = 0 then we say the vectors are linearly independent l The dimension of a space is the greatest number of linearly independent vectors possible in a vector set l For a vector space of dimension n, any set of n linearly independent vectors form a basis

2/28/2016 Vector Spaces: A Familiar Example l Our common notion of vectors in a 2D plane is (you guessed it) a vector space: –Vectors are “arrows” rooted at the origin –Scalar multiplication “streches” the arrow, changing its length (magnitude) but not its direction –Addition uses the “trapezoid rule”: u+v y x u v

2/28/2016 Vector Spaces: Basis Vectors l Given a basis for a vector space: –Each vector in the space is a unique linear combination of the basis vectors –The coordinates of a vector are the scalars from this linear combination –Best-known example: Cartesian coordinates –Note that a given vector v will have different coordinates for different bases

2/28/2016 Vectors And Points l We commonly use vectors to represent: –Points in space (i.e., location) –Displacements from point to point –Direction (i.e., orientation)

2/28/2016 Points l Points support these operations –Point-point subtraction: Q - P = v n Result is a vector pointing from P to Q –Vector-point addition: P + v = Q n Result is a new point –Note that the addition of two points is not defined P Q v

2/28/2016 Dot Product l The dot product or, more generally, inner product of two vectors is a scalar: v 1 v 2 = x 1 x 2 + y 1 y 2 + z 1 z 2 (in 3D) l Useful for many purposes –Computing the length of a vector: length( v ) = sqrt( v v) –Normalizing a vector, making it unit-length –Computing the angle between two vectors: u v = |u| |v| cos(θ) –Checking two vectors for orthogonality –Projecting one vector onto another θ u v

2/28/2016 Cross Product l The cross product or vector product of two vectors is a vector: l The cross product of two vectors is orthogonal to both l Right-hand rule dictates direction of cross product

2/28/2016 Linear Transformations l A linear transformation: –Maps one vector to another –Preserves linear combinations l Thus behavior of linear transformation is completely determined by what it does to a basis l Turns out any linear transform can be represented by a matrix

2/28/2016 Matrices By convention, matrix element M rc is located at row r and column c: l By (OpenGL) convention, vectors are columns:

2/28/2016 Matrices l Matrix-vector multiplication applies a linear transformation to a vector: l Recall how to do matrix multiplication

2/28/2016 Matrix Transformations l A sequence or composition of linear transformations corresponds to the product of the corresponding matrices –Note: the matrices to the right affect vector first –Note: order of matrices matters! The identity matrix I has no effect in multiplication l Some (not all) matrices have an inverse:

2/28/2016 The Rendering Pipeline: A Whirlwind Tour Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

2/28/2016 The Display You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

2/28/2016 The Framebuffer You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

2/28/2016 The Rendering Pipeline Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

2/28/ D Rendering: Rasterization (Coming Soon) Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

2/28/2016 The Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

2/28/2016 The Rendering Pipeline: 3-D Modeling Transforms Scene graph Object geometry Lighting Calculations Viewing Transform Clipping Projection Transform Result: All vertices of scene in shared 3-D “world” coordinate system All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices 2-D screen coordinates of clipped vertices

2/28/2016 The Rendering Pipeline: 3-D Scene graph Object geometry Lighting Calculations Clipping Result: All vertices of scene in shared 3-D “world” coordinate system All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices 2-D screen coordinates of clipped vertices Modeling Transforms Viewing Transform Projection Transform

2/28/2016 Rendering: Transformations l So far, discussion has been in screen space l But model is stored in model space (a.k.a. object space or world space) l Three sets of geometric transformations: –Modeling transforms –Viewing transforms –Projection transforms

2/28/2016 Rendering: Transformations l Modeling transforms –Size, place, scale, and rotate objects and parts of the model w.r.t. each other –Object coordinates  world coordinates Z X Y X Z Y

2/28/2016 Rendering: Transformations l Viewing transform –Rotate & translate the world to lie directly in front of the camera n Typically place camera at origin n Typically looking down -Z axis –World coordinates  view coordinates

2/28/2016 Rendering: Transformations l Projection transform –Apply perspective foreshortening n Distant = small: the pinhole camera model –View coordinates  screen coordinates

2/28/2016 Rendering: Transformations l All these transformations involve shifting coordinate systems (i.e., basis sets) l That’s what matrices do… l Represent coordinates as vectors, transforms as matrices l Multiply matrices = concatenate transforms!                     Y X Y X   cossin cos

2/28/2016 The Rendering Pipeline: 3-D Modeling Transforms Scene graph Object geometry Lighting Calculations Viewing Transform Clipping Projection Transform Result: All vertices of scene in shared 3-D “world” coordinate system All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices 2-D screen coordinates of clipped vertices

2/28/2016 Rendering: Lighting l Illuminating a scene: coloring pixels according to some approximation of lighting –Global illumination: solves for lighting of the whole scene at once –Local illumination: local approximation, typically lighting each polygon separately l Interactive graphics (e.g., hardware) does only local illumination at run time

2/28/2016 The Rendering Pipeline: 3-D Modeling Transforms Scene graph Object geometry Lighting Calculations Viewing Transform Clipping Projection Transform Result: All vertices of scene in shared 3-D “world” coordinate system All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices 2-D screen coordinates of clipped vertices

2/28/2016 Rendering: Clipping l Clipping a 3-D primitive returns its intersection with the view frustum: l See Foley & van Dam section 19.1

2/28/2016 Rendering: Clipping l Clipping is tricky! In: 3 vertices Out: 6 vertices Clip In: 1 polygon Out: 2 polygons

2/28/2016 The End l Next: Basic OpenGL