CAP4730: Computational Structures in Computer Graphics 3D Transformations.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Three Dimensional Viewing
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
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.
Projection Matrices Ed Angel
Part I: Basics of Computer Graphics Viewing Transformation and Coordinate Systems Chapter
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
4.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 4 Projection Clipping Viewport Transformation.
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
CAP4730: Computational Structures in Computer Graphics
Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.
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.
Introduction to 3D viewing 3D is just like taking a photograph!
12.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping.
Viewing and Projections
Week 2 - Wednesday CS361.
1 Projection Matrices. 2 Objectives Derive the projection matrices used for standard OpenGL projections Introduce oblique projections Introduce projection.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
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.
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
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.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Viewing CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Mark Nelson 3d projections Fall 2013
Basic 3D Concepts. Overview 1.Coordinate systems 2.Transformations 3.Projection 4.Rasterization.
University of North Carolina at Greensboro
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.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Viewing and Projection
Viewing and Projection
CS-321 Dr. Mark L. Hornick 1 Three-Dimensional Graphics Problem How can you effectively display 3-D information on a 2-D display?
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
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.
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
Computer Graphics Projections.
3D Viewing and Clipping Ming Ouhyoung 歐陽明 Professor Dept. of CSIE and GINM NTU.
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.
Introduction to Computer Graphics
Visible Surface Detection
Rendering Pipeline Fall, 2015.
University of North Carolina at Greensboro
3D Viewing cgvr.korea.ac.kr.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
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.
CENG 477 Introduction to Computer Graphics
Projections and Normalization
Three Dimensional Viewing
Isaac Gang University of Mary Hardin-Baylor
Presentation transcript:

CAP4730: Computational Structures in Computer Graphics 3D Transformations

Outline 3D World What we are trying to do Translate Scale Rotate

Transformations in 3D! Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations. T=(t x, t y, t z )

Scale, 3D Style S=(s x, s y, s z )

Rotations, in 3D no less! R=(r x, r y, r z,  ) What does a rotation in 3D mean? Q: How do we specify a rotation? A: We give a vector to rotate about, and a theta that describes how much we rotate.  Q: Since 2D is sort of like a special case of 3D, what is the vector we’ve been rotating about in 2D?

Rotations about the Z axis R=(0,0,1,  ) What do you think the rotation matrix is for rotations about the z axis? 

Rotations about the X axis R=(1,0,0,  ) Let’s look at the other axis rotations 

Rotations about the Y axis R=(0,1,0,  ) 

Rotations for an arbitrary axis

   Steps: 1. Normalize vector u 2. Compute  3. Compute  4. Create rotation matrix u

Vector Normalization Given a vector v, we want to create a unit vector that has a magnitude of 1 and has the same direction as v. Let’s do an example.

Computing the Rotation Matrix 1. Normalize u 2. Compute R x (  ) 3. Compute R y (  ) 4. Generate Rotation Matrix

Rotation Matrix

Applying 3D Transformations P’=TRTP Let’s compute M

Homogenous Coordinates We need to do something to the vertices By increasing the dimensionality of the problem we can transform the addition component of Translation into multiplication.

Homogenous Coordinates Homogenous Coordinates – embed 3D transforms into 4D All transformations can be expressed as matrix multiplications. Inverses and combination easier Equivalence of vectors ( )=( ) What this means programatically

The Question Given a 3D point, an eye position, a camera position, and a display plane, what is the resulting pixel position? Now extend this for a group of three points Then apply what you know about scan conversion.

Different Phases: Model Definition

Different Phases: Transformations

Different Phases: Projection

Different Phases: Rasterization

Different Phases: Scan Conversion

What are the steps needed?

Let’s Examine the Camera If I gave you a world, and said I want to “render” it from another viewpoint, what information do I have to give you? –Position –Which way we are looking –Which way is “up” –Aspect Ratio –Field of View –Near and Far

Camera View Direction View Up View Right View Normal

Camera View Up View Right What are the vectors?

Graphics Pipeline So Far Object Object Coordinates Transformation Object -> World World World Coordinates Projection Xform World -> Projection Camera Projection Coordinates Screen Device Coordinates Normalize Xform & Clipping Projection -> Normalized Viewport Normalized Coordinates Viewport Transform Normalized -> Device

Transformation World->Camera View Direction View Up View Right View Normal

Transformation World->Camera View Up = V View Right = u View Direction = -N

Cross Products Given two vectors, the cross product returns a vector that is perpendicular to the plane of the two vectors and with magnitude equal to the area of the parallelogram formed by the two vectors.  u

Parallel Projections (known aliases): Orthographic or Isometric Projection

Parallel Projection

Parallel Projections (known aliases): Oblique Projection L  

Projections foreshortening - the farther an object is from the camera, the smaller it appears in the final image

Perspective Projection Side View P=(x p,y p,z p ) t=0 C=(x c,y c,z c ) t=1 P’=(x’,y’,z’) t=? z’ zpzp xpxp x’

Perspective Projection Side View P=(x p,y p,z p ) t=0 C=(x c,y c,z c ) t=1 P’=(x’,y’,z’) t=? z’ zpzp xpxp x’ h Scale by h

Perspective Divide Foreshortening - look at the x,y, and w values, and how they depend on how far away the object is. Modelview Matrix - describes how to move the world->camera coordinate system Perspective Matrix - describes the camera you are viewing the world with.

Let’s closely examine

What the Perspective Matrix means Note: Normalized Device Coordinates are a LEFT-HANDED Coordinate system

Graphics Pipeline So Far Object Object Coordinates Transformation Object -> World World World Coordinates Projection Xform World -> Projection Camera Projection Coordinates Screen Device Coordinates Normalize Xform & Clipping Projection -> Normalized Viewport Normalized Coordinates Viewport Transform Normalized -> Device

What happens to an object... Object Object Coordinates Transformation Object -> World World World Coordinates

What happens to an object... World World Coordinates Transformation - Modelview World -> Eye/Camera Viewport Viewport Coordinates

What happens to an object... Viewport Viewport Coordinates Rasterization Scan Converting Triangles Transformation - Projection (Includes Perspective Divide) Eye/Camera ->View Plane

Normalized Screen Coordinates

Let’s label all the vectors z nsc =0 z nsc =1

View Volume (View Frustum) Usually: View Plane = Near Plane Far Plane Think about: Clipping 3D Triangles View Frustum Culling M perspective_Matrix -1,1,1 1,-1,-1

Comparison with a camera

Let’s verbalize what’s going on Review: Pipeline Series of steps What we’ll do next: Hidden Surface Removal Depth Buffers Lighting Shading Blending (the elusive alpha) Textures