3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

Similar documents
Transformations Week 9, Lecture 18

Transformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Objectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations

XPM 2D Transformations Week 2, Lecture 3

XPM 2D Transformations Week 2, Lecture 3

CS 445 / 645 Introduction to Computer Graphics. Lecture 21 Representing Rotations

Intro to Curves Week 4, Lecture 7

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala)

Computer Graphics: Geometric Transformations

Part II: OUTLINE. Visualizing Quaternions. Part II: Visualizing Quaternion Geometry. The Spherical Projection Trick: Visualizing unit vectors.

Quaternions and Rotations

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11

Quaternions and Rotations

3D Modeling: Surfaces

Quaternions and Rotations

12.1 Quaternions and Rotations

Animating orientation. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

Hierarchical Modeling. CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

3D Representation and Solid Modeling

Advanced Computer Graphics Transformations. Matthias Teschner

Outline. The de Casteljau Algorithm. Properties of Piecewise Linear Interpolations. Recall: Linear Interpolation

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

Outline. Properties of Piecewise Linear Interpolations. The de Casteljau Algorithm. Recall: Linear Interpolation

IMAGE-BASED RENDERING AND ANIMATION

Computer Graphics 7: Viewing in 3-D

Quaternions and Rotations

Geometric Transformations

Computer Science 336 Fall 2017 Homework 2

Computer Animation II

3D Modeling: Solid Models

Visual Recognition: Image Formation

B-Splines and NURBS Week 5, Lecture 9

Motivation. Parametric Curves (later Surfaces) Outline. Tangents, Normals, Binormals. Arclength. Advanced Computer Graphics (Fall 2010)

UNIT 2 2D TRANSFORMATIONS

Translation. 3D Transformations. Rotation about z axis. Scaling. CS 4620 Lecture 8. 3 Cornell CS4620 Fall 2009!Lecture 8

CS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Computer Graphics: Viewing in 3-D. Course Website:

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Computer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL

2D/3D Geometric Transformations and Scene Graphs

Transforms. COMP 575/770 Spring 2013

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

Overview. Affine Transformations (2D and 3D) Coordinate System Transformations Vectors Rays and Intersections

Transformations: 2D Transforms

3D Kinematics. Consists of two parts

Vector Algebra Transformations. Lecture 4

2D TRANSFORMATIONS AND MATRICES

Object Representation Affine Transforms. Polygonal Representation. Polygonal Representation. Polygonal Representation of Objects

Homogeneous Coordinates

Fundamentals of Computer Animation

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

2D transformations: An introduction to the maths behind computer graphics

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

Quaternions & Rotation in 3D Space

3D Computer Graphics. Jared Kirschner. November 8, 2010

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

2D and 3D Transformations AUI Course Denbigh Starkey

Quaternion properties: addition. Introduction to quaternions. Quaternion properties: multiplication. Derivation of multiplication

Modeling Transformations

Animation and Quaternions

Last week. Machiraju/Zhang/Möller/Fuhrmann

Lecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009

Projection Lecture Series

Transformations. Questions on Assignment 1? Announcements

Jorg s Graphics Lecture Notes Coordinate Spaces 1

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Autonomous Navigation for Flying Robots

CS184: Using Quaternions to Represent Rotation

Rotations (and other transformations) Rotation as rotation matrix. Storage. Apply to vector matrix vector multiply (15 flops)

CS354 Computer Graphics Rotations and Quaternions

Coordinate Transformations. Coordinate Transformation. Problem in animation. Coordinate Transformation. Rendering Pipeline $ = $! $ ! $!

N-Views (1) Homographies and Projection

2D and 3D Coordinate Systems and Transformations

Lecture 4. Viewing, Projection and Viewport Transformations

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

Graphics Pipeline 2D Geometric Transformations

Affine Transformations in 3D

Aalto CS-C3100 Computer Graphics, Fall 2016

Animations. Hakan Bilen University of Edinburgh. Computer Graphics Fall Some slides are courtesy of Steve Marschner and Kavita Bala

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

CS612 - Algorithms in Bioinformatics

CSC 305 The Graphics Pipeline-1

Intro to Curves Week 1, Lecture 2

Homogeneous Coordinates and Transformations of the Plane

Today. Parity. General Polygons? Non-Zero Winding Rule. Winding Numbers. CS559 Lecture 11 Polygons, Transformations

CS230 : Computer Graphics Lecture 12: Introduction to Animation. Tamar Shinar Computer Science & Engineering UC Riverside

Image warping , , Computational Photography Fall 2017, Lecture 10

Coordinate Frames and Transforms

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Camera Model and Calibration

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

Computer Vision Projective Geometry and Calibration. Pinhole cameras

CS 475 / CS 675 Computer Graphics. Lecture 16 : Interpolation for Animation

For each question, indicate whether the statement is true or false by circling T or F, respectively.

CS 4204 Computer Graphics

Transcription:

CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory Department of Computer Science Drexel University http://gicl.cs.drexel.edu 1

Outline World window to viewport transformation 3D transformations Coordinate system transformation 2

The Window-to-Viewport Transformation Problem: Screen windows cannot display the whole world (window management) How to transform and clip: Objects to Windows to Screen 3 Pics/Math courtesy of Dave Mount @ UMD-CP

Window-to-Viewport Transformation Given a window and a viewport, what is the transformation from WCS to VPCS? Three steps: Translate Scale Translate 4 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Transforming World Coordinates to Viewports 3 steps 1. Translate 2. Scale 3. Translate Overall Transformation: P'= M wv P 5 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Clipping to the Viewport Viewport size may not be big enough for everything Display only the pixels inside the viewport Transform lines in world Then clip in world Transform to image Then draw Do not transform pixels 6 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Scan-converted Lines Polygons Text Fill regions Clip regions for display Another Example 7 1994 Foley/VanDam/Finer/Huges/Phillips ICG

3D Transformations 9

Representation of 3D Transformations Z axis represents depth Right Handed System When looking down at the origin, positive rotation is CCW Left Handed System When looking down, positive rotation is in CW More natural interpretation for displays, big z means far (into screen) 10 1994 Foley/VanDam/Finer/Huges/Phillips ICG

3D Homogenous Coordinates Homogenous coordinates for 2D space requires 3D vectors & matrices Homogenous coordinates for 3D space requires 4D vectors & matrices [x,y,z,w] 11

3D Transformations: Scale & Translate Scale Parameters for each axis direction Translation 12

3D Transformations: One rotation for each world coordinate axis Rotation 13

Rotation Around an Arbitrary Axis The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again. Rotate a point P around axis n (x,y,z) by angle θ # tx 2 + c txy + sz txz " sy 0& % ( txy " sz ty 2 + c tyz + sx 0 R = % ( % txz + sy tyz " sx tz 2 + c 0( % ( $ 0 0 0 1' c = cos(θ) s = sin(θ) t = (1 - c) Graphics Gems I, p. 466 & 498 14

Rotation Around an Arbitrary Axis Also can be expressed as the Rodrigues Formula P rot = P cos(" ) + (n # P)sin(" ) + n(n$ P)(1% cos(" )) 15

Improved Rotations Euler Angles have problems How to interpolate keyframes? Angles aren t independent Interpolation can create Gimble Lock, i.e. loss of a degree of freedom when axes align Solution: Quaternions! 16

17

18

p = (0,! x ) 19

20

21

A & B are quaternions slerp Spherical linear interpolation Need to take equals steps on the sphere 22

What about interpolating multiple keyframes? Shoemake suggests using Bezier curves on the sphere Offers a variation of the De Casteljau algorithm using slerp and quaternion control points See K. Shoemake, Animating rotation with quaternion curves, Proc. SIGGRAPH 85 23

3D Transformations: Reflect & Shear Reflection: about x-y plane Shear: (function of z) 24

3D Transformations: Shear " X' % $ ' $ Y' ' $ Z' ' $ ' # 1 & = " $ $ $ $ # y z 1 Sh x Sh x 0% " X% z ' $ ' 1 Sh y 0' ( $ Y ' y Sh z 1 0' $ Z' ' $ ' 0 0 0 1& # 1 & Sh y x Sh z x X ' = X + Sh x y Y + Sh x z Z Y ' = Sh y x X +Y + Sh y z Z Z ' = Sh z x X + Sh z y Y + Z 25

Example 26 Pics/Math courtesy of Dave Mount @ UMD-CP

Example: Composition of 3D Transformations Goal: Transform P 1 P 2 and P 1 P 3 27 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Example (Cont.) Process 1. Translate P 1 to (0,0,0) 2. Rotate about y 3. Rotate about x 4. Rotate about z (4) (1) (2-3) 28 1994 Foley/VanDam/Finer/Huges/Phillips ICG

What we ve really done is transform the local coordinate system R x, R y, R z to align with the origin x,y,z Final Result 29 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Example 2: Composition of 3D Transformations Airplane defined in x,y,z Problem: want to point it in Dir of Flight (DOF) centered at point P Note: DOF is a vector Process: Rotate plane Move to P 30 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Example 2 (cont.) Z p axis to be DOF X p axis to be a horizontal vector perpendicular to DOF y x DOF Y p, vector perpendicular to both Z p and X p (i.e.z p x X p ) 31 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Transformations to Change Coordinate Systems Issue: the world has many different relative frames of reference How do we transform among them? Example: CAD Assemblies & Animation Models 32

Transformations to Change Coordinate Systems 4 coordinate systems 1 point P M M M 1! 2 2! 3 3! 4 = T (4,2) = T (2,3) S(0.5,0.5) = T (6.7,1.8) R(45! ) 33 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Coordinate System Example (1) Translate the House to the origin M 1"2 = T(x 1, y 1 ) M 2"1 = ( M 1"2 ) #1 = T(#x 1,#y 1 ) P 1 The matrix M ij that maps points from coordinate system j to i is the inverse of the matrix M ji that maps points from coordinate system j to coordinate system i. 34 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Coordinate System Example (2) Transformation Composition: M 5"1 = M 5"4 M 4"3 M 3"2 M 2"1 35 1994 Foley/VanDam/Finer/Huges/Phillips ICG

World Coordinates and Local Coordinates To move the tricycle, we need to know how all of its parts relate to the WCS Example: front wheel rotates on the ground wrt the front wheel s z axis: Coordinates of P in wheel coordinate system: P (wo) = T("r,0,0) # R z (") # P (wh ) P' (wh) = R z (") # P (wh ) 36 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Questions about Homework 1? Go to web site 37