Direct3D Workshop November 17, 2005 Workshop by Geoff Cagle Presented by Players 2 Professionals.

Slides:



Advertisements
Similar presentations
Computer Graphics Lecture 4 Geometry & Transformations.
Advertisements

Flash Animation Using Linear Transformations By Kevin Hunter Kevin Hunter Marcus Yu Marcus Yu.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
CS 376 Introduction to Computer Graphics 02 / 09 / 2007 Instructor: Michael Eckmann.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Representation Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Outline for Today More math… Finish linear algebra: Matrix composition
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Now Playing: Gong Sigur Rós From Takk... Released September 13, 2005.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Representation CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Linear Equations in Linear Algebra
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
CS 450: Computer Graphics 2D TRANSFORMATIONS
1 Computer Graphics Week7 -2D Rotation. 3-Rotation A shape can be rotated about any of the three axes. A rotation about the z-axis will actually rotate.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices n New stuff Homogenous co-ordinates 3D transformations as matrices.
Geometric Intuition Randy Gaul. Vectors, Points and Basis Matrices Rotation Matrices Dot product and how it’s useful Cross product and how it’s useful.
Mathematical Fundamentals
Rotations and Translations
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Patrick Nichols Thursday, September 18, Linear Algebra Review.
Recap of linear algebra: vectors, matrices, transformations, … Background knowledge for 3DM Marc van Kreveld.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Rotations and Translations
Transformations Jehee Lee Seoul National University.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Affine Transformations.
CSE Real Time Rendering Week 5. Slides(Some) Courtesy – E. Angel and D. Shreiner.
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Math Review.
Affine Geometry Jehee Lee Seoul National University.
1 Representation. 2 Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames.
Graphics Lecture 2: Slide 1 Lecture 2 Transformations for animation.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Computer Graphics I, Fall 2010 Transformations.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
COMPUTER GRAPHICS AND LINEAR ALGEBRA AN INTRODUCTION.
Homogeneous Coordinates They work, but where do they come from? Jonathan Senning
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Coordinate Change.
Computer Graphics CC416 Week 15 3D Graphics.
3D Geometric Transformations
CSCE 441 Computer Graphics 3-D Viewing
Representation Ed Angel Professor Emeritus of Computer Science,
COMP 175: Computer Graphics February 9, 2016
Isaac Gang University of Mary Hardin-Baylor
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Isaac Gang University of Mary Hardin-Baylor
Representation Ed Angel Professor Emeritus of Computer Science,
Transformations.
Transformations 2 University of British Columbia
Game Programming Algorithms and Techniques
Representation Ed Angel
Presentation transcript:

Direct3D Workshop November 17, 2005 Workshop by Geoff Cagle Presented by Players 2 Professionals

Workshop Breakdown ► Part 1: 3D Graphics Pipeline ► Part 2: Projective Space ► Part 3: Windows Programming ► Intermission ► Part 4: Setting Up Direct3D ► Part 5: Using Direct3D

Notes and Code Samples ► You can download these notes and all the code samples from

Part 2 Projective Space

Motivation ► How should space be represented in computer graphics? ► Using linear algebra seems like a fairly natural way to represent space, but eventually you will find it has its limits. ► A better solution is called projective space, and it’s the math being used behind all graphics cards today. ► Let’s start with the linear algebra and develop projective spaces from there.

Vectors ► Remember vectors? ► They have direction and magnitude. ► We usually break down vectors into x, y, and z components. ► Vectors can represent coordinates (displacement from an origin).

Matrices ► Remember matrices? ► Matrices can represent transformations  From a vector to a vector.  From another matrix to another matrix. ► Matrices can also represent tensors, orientations, or coordinate systems.

Matrix-Vector Multiplication ► Each columns of the matrix can be interpreted as transforming a component of the vector.

Linear Transformations ► A transformation T is linear iff ► Linear transformations include Scaling, Shearing, and Rotations. ► Translation is not linear:

Linear Transformations (Cont’d) ► A transformation is linear iff it can be written in matrix- vector form:  You can find the columns of A by transforming the standard basis: ► Multiplying matrices together results in a composition of transforms.

Affine Spaces ► Extending vector spaces, affine spaces add another set of objects called points. ► A point has a position, but not a direction or magnitude. ► Points have only a couple operations:  P – Q = v  Q + v = P  Where P and Q are points and v is a vector. ► You cannot add two points together or multiply a point by a scaler.

Affine Frame ► Let e 1, e 2, e 3 form a basis for the vectors in an affine space, A. ► Let O be a point in A. We will call this point the origin. ► Then e 1, e 2, e 3, O forms a frame for A.  Any vector in A can be written as:  Any point can be written as:

Affine Coordinates ► Using frames we can write vectors like this: ► And points like this:

Affine Coordinates ► The appended 0 or 1 is called the w-component. ► In affine space this is either  0 for a vector  1 for a point  And anything else is undefined. ► Note that if you add vectors together or scale them, the result is a vector, but if you try the same with points, the result is undefined.

Affine Transform ► An affine transform adds translation to a linear transform. ► In regular vector space it has the form: ► In affine space it is written as: ► If you run a point through this transform it is translated, while vectors are not.

Perspective ► Projective space is an extension to affine space. ► Using transformations in this space we will be able to calculate perspective.

Projective Space ► In projective space, the w-component is either 0 for a vector or any nonzero real number for a point. ► However, coordinates in projective space are homogeneous.  Two points in projection space are said to be equivalent if the coordinates of one are a multiple of the other.  That is, if:

Projective Space (Cont’d) ► Points in projective space actually represent lines through the origin. ► We can standardize the points, by dividing by w so that its w component is 1.

Projective Space (Cont’d) ► In the case of the projective plane (the 2D projective space).  3D coordinates are used.  The intersection points of the lines through the origin and the plane w=1 make a perspective image of the space.

Projective Transform ► The projective transform generalizes the affine transform. ► With homogeneous coordinates it looks like: ► With linear algebra it would look like this:

Perspective Transform ► When perspective is actually calculated in computer graphics, it doesn’t usually flatten the space. ► Instead coordinates are transformed so that the viewing frustum is transformed into a unit square ► This is done through a composite of a scaling and a projective transform.

Direct3D Matrices and Vectors ► Direct3D includes a matrices and vectors (as well as planes and quaternions).  D3DVECTOR and D3DMATRIX  D3DXVECTOR # and D3DMATRIX #  D3DXMATRIXA #  Where # is an integer. ► List of functions for D3DX* structures =/library/en- us/directx9_c/directx/graphics/reference/d3dx/fun ctions/math/mathfunctions.asp =/library/en- us/directx9_c/directx/graphics/reference/d3dx/fun ctions/math/mathfunctions.asp =/library/en- us/directx9_c/directx/graphics/reference/d3dx/fun ctions/math/mathfunctions.asp

Direct3D Math Quirks ► Be aware of Direct3D’s left handed coordinate system  X is positive to the left  Y is positive to the top  Z is position going into the monitor ► Matrices are multiplied on the right side of a vector:

References 1. Computer-Aided Geometric Design by F. Yamaguchi 2. Computer Animation Slides by JeHee Lee Computer Graphics Notes by Ken Joy /GraphicsNotes/Graphics-Notes.html /GraphicsNotes/Graphics-Notes.html /GraphicsNotes/Graphics-Notes.html