and an introduction to matrices

Slides:



Advertisements
Similar presentations
Animation in Video Games presented by Jason Gregory
Advertisements

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
1 3D Vector & Matrix Chapter 2. 2 Vector Definition: Vector is a line segment that has the direction. The length of the line segment is called the magnitude.
Computer Graphics Lecture 4 Geometry & Transformations.
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.
Camera Models A camera is a mapping between the 3D world and a 2D image The principal camera of interest is central projection.
1 3D modelling with OpenGL Brian Farrimond Robina Hetherington.
Graphics-1 Gentle Introduction to Computer Graphics (2) Based on: –David Brogan’s “Introduction to Computer Graphics” Course Slides, University of Virginia.
3-D Geometry.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Cameras, lenses, and calibration
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
Vectors Jeff Chastine.
Transformations of Objects CVG lab. Introduction  Affine transformations : Affine transformations are a fundamental cornerstone of computer graphics.
Transformations Dr. Amy Zhang.
And an introduction to matrices COORDINATE SYSTEMS JEFF CHASTINE 1.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Geometric transformations The Pipeline
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Foundations of Computer Graphics (Fall 2012) CS 184, Lectures 13,14: Reviews Transforms, OpenGL
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
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.
SE 313 – Computer Graphics Lecture 8: Transformations and Projections Lecturer: Gazihan Alankuş 1.
Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization 3D Rendering Praktikum: Shader Gallery The.
CSE Real Time Rendering Week 5. Slides(Some) Courtesy – E. Angel and D. Shreiner.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Part One - Parallel Projection textbook
Viewing and Projection
Lecture 5: Introduction to 3D
Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization GameFX C# / DirectX 2005 The Rendering Pipeline.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
CS-321 Dr. Mark L. Hornick 1 Three-Dimensional Graphics Problem How can you effectively display 3-D information on a 2-D display?
Midterm Review. Overall No OpenGL programming questions, but programming pipeline and concepts of important OpenGL functions are required. – Parameter.
Lecture 14: Projection CS4670 / 5670: Computer Vision Noah Snavely “The School of Athens,” Raphael.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
Coordinate Systems Lecture 20 Wed, Oct 15, Object Coordinates Each object has its own “local” coordinate system, called object coordinates. Normally.
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.
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Introduction to Computer Graphics
Modeling Transformations
Review: Transformations
Chapter 3 Drawing In the World.
Graphics Fundamentals
CSCE 441 Computer Graphics 3-D Viewing
Introduction to Computer Graphics CS 445 / 645
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Lecture 2 Transformations
Introduction to Computer Graphics with WebGL
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Day 05 Shader Basics.
Computer Graphics (Spring 2003)
Projection in 3-D Glenn G. Chappell
Last Time Canonical view pipeline Projection Local Coordinate Space
Introduction to Shaders
3D Graphics.
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Introduction to Computer Graphics with WebGL
Computer Graphics Computer Viewing
Computer Viewing Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
Presentation transcript:

and an introduction to matrices Coordinate Systems and an introduction to matrices Jeff Chastine

The Local Coordinate System Sometimes called “Object Space” It’s the coordinate system the model was made in Jeff Chastine

The Local Coordinate System Sometimes called “Object Space” It’s the coordinate system the model was made in (0, 0, 0) Jeff Chastine

The World SPACE The coordinate system of the virtual environment (619, 10, 628) Jeff Chastine

(619, 10, 628) Jeff Chastine

Question How did get the monster positioned correctly in the world? Let’s come back to that… Jeff Chastine

Camera Space It’s all relative to the camera… Jeff Chastine

Camera Space It’s all relative to the camera… and the camera never moves! (0, 0, -10) Jeff Chastine

The Big Picture How to we get from space to space? ? ? Jeff Chastine

The Big Picture M ? How to we get from space to space? For every model Have a (M)odel matrix! Transforms from object to world space M ? Jeff Chastine

The Big Picture M V How to we get from space to space? To put in camera space Have a (V)iew matrix Usually need only one of these M V Jeff Chastine

The Big Picture M V MV How to we get from space to space? The ModelView matrix Sometimes these are combined into one matrix Usually keep them separate for convenience M V MV Jeff Chastine

Matrix - What? A mathematical structure that can: Translate (a.k.a. move) Rotate Scale Usually a 4x4 array of values Idea: multiply each point by a matrix to get the new point Your graphics card eats matrices for breakfast 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 The Identity Matrix Jeff Chastine

Back to The Big Picture M If you multiply a matrix by a matrix, you get a matrix! How might we make the model matrix? M Jeff Chastine

Back to The Big Picture M Translation matrix T Rotation matrix R1 Scale matrix S If you multiply a matrix by a matrix, you get a matrix! How might we make the model matrix? M Jeff Chastine

Back to The Big Picture M T * R1 * R2 * S = M Translation matrix T Rotation matrix R1 Rotation matrix R2 Scale matrix S If you multiply a matrix by a matrix, you get a matrix! How might we make the model matrix? M T * R1 * R2 * S = M Jeff Chastine

Matrix Order (an angry vertex) Multiply left to right Results are drastically different (an angry vertex) Jeff Chastine

Matrix Order Multiply left to right Results are drastically different Order of operations Rotate 45° Jeff Chastine

Matrix Order Multiply left to right Results are drastically different Order of operations Rotate 45° Translate 10 units Jeff Chastine

Matrix Order Multiply left to right Results are drastically different Order of operations Rotate 45° Translate 10 units before after Jeff Chastine

Matrix Order Multiply left to right Results are drastically different Order of operations Jeff Chastine

Matrix Order Multiply left to right Results are drastically different Order of operations Translate 10 units Jeff Chastine

Matrix Order Multiply left to right Results are drastically different Order of operations Translate 10 units Rotate 45° Jeff Chastine

Matrix Order Multiply left to right Results are drastically different Order of operations Translate 10 units Rotate 45° after before Jeff Chastine

Back to The Big Picture M T * R1 * R2 * S = M Translation matrix T Rotation matrix R1 Rotation matrix R2 Scale matrix S If you multiply a matrix by a matrix, you get a matrix! How might we make the model matrix? M T * R1 * R2 * S = M Backwards Jeff Chastine

Back to The Big Picture M S * R1 * R2 * T = M Translation matrix T Rotation matrix R1 Rotation matrix R2 Scale matrix S If you multiply a matrix by a matrix, you get a matrix! How might we make the model matrix? M S * R1 * R2 * T = M Jeff Chastine

The (P)rojection Matrix Projects from 3D into 2D Two kinds: Orthographic: depth doesn’t matter, parallel remains parallel Perspective: Used to give depth to the scene (a vanishing point) End result: Normalized Device Coordinates (NDCs between -1.0 and +1.0) Jeff Chastine

Orthographic vs. Perspective Jeff Chastine

An Old Vertex Shader Originally we passed using NDCs (-1 to +1) in vec4 vPosition; // The vertex in NDC void main () { gl_Position = vPosition; } Originally we passed using NDCs (-1 to +1) Jeff Chastine

A Better Vertex Shader New position in NDC Original (local) position in vec4 vPosition; // The vertex in the local coordinate system uniform mat4 mM; // The matrix for the pose of the model uniform mat4 mV; // The matrix for the pose of the camera uniform mat4 mP; // The projection matrix (perspective) void main () { gl_Position = mP*mV*mM*vPosition; } New position in NDC Original (local) position Jeff Chastine

SMILE – It’s the END! Jeff Chastine