DOC PREVIEW
CMU CS 15462 - Wrap-up on Transformations 3D Viewing

This preview shows page 1-2-15-16-31-32 out of 32 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Computer Graphics 15-462AnnouncementsAssignment 1 is due Thursday at midnightTurnin space:/afs/andrew/scs/cs/15-462/turninYou should be able to create files there but not read or removeUse a directory name of the format: assignment1_jkh TA hours Tuesday 3-5 (Joel—cluster) and Thursday 3-5 (Michael—Wean 8121)Or send any of us emailQuestions on Assignment 1?Written Assignment #1 out this afternoonWrap-up on Transformations3D ViewingPerspective projectionViewing transformationPerspective projectionViewing transformationShirley Chapter 73Computer Graphics 15-462Example: ModelingModeling with primitive shapes4Computer Graphics 15-462Example: AnimationSetting up a scene and animating5Computer Graphics 15-462Example: Modeling DeformationsIncorporating deformations into a modeling system6Computer Graphics 15-462Example: Viewing TransformationWORLDOBJECTCAMERA7Computer Graphics 15-4628Computer Graphics 15-462Question about rotating about an arbitrary axischalkboard9Computer Graphics 15-462Implementing Transformation Sequences• Calculate the matrices and cumulatively multiply them into a global Current Transformation Matrix• Postmultiplication is more convenient in hierarchies -- multiplication is computed in the opposite order of function application• The calculation of the transformation matrix, M,– initialize M to the identity– in reverse order compute a basic transformation matrix, T– post-multiply T into the global matrix M, M ← MT• Example - to rotate by θ around [x,y]:• Remember the last T calculated is the first applied to the points– calculate the matrices in reverse orderglLoadIdentity() /* initialize M to identity mat.*/glTranslatef(x, y, 0) /* LAST: undo translation */glRotatef(theta,0,0,1) /* rotate about z axis */glTranslatef(-x, -y, 0) /* FIRST: move [x,y] to origin. */10Computer Graphics 15-462Column Vector Convention• The convention in the slides–transformation is by matrix times vector, Mv–textbook uses this convention, 90% of the world too• The composite function A(B(C(D(x)))) is the matrix-vector product ABCDxx'y'1⎡ ⎣ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ =m11m12m13m21m22m23m31m32m33⎡ ⎣ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ xy1⎡ ⎣ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥11Computer Graphics 15-462Beware: Row Vector Convention• The transpose is also possible• How does this change things?–all transformation matrices must be transposed–ABCDx transposed is xTDTCTBTAT– pre- and post-multiply are reversed• OpenGL uses transposed matrices!– You’ll only notice this if you DIRECTLY pass matrices as arguments to OpenGL subroutines, e.g. glLoadMatrix.– Most routines take only scalars or vectors as arguments.x' y'1[]= xy1[]m11m21m31m12m22m32m13m23m33⎡ ⎣ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥3D ViewingCanonical View VolumeOrthographic ProjectionPerspective ProjectionCanonical View VolumeOrthographic ProjectionPerspective ProjectionShirley Chapter 713Computer Graphics 15-462Getting Geometry on the Screen• Transform to camera coordinate system• Transform (warp) into canonical view volume• Clip • Project to display coordinates•RasterizeGiven geometry positioned in the world coordinate system, how do we get it onto the display?14Computer Graphics 15-462Perspective and Orthographic Projection15Computer Graphics 15-462Orthographic Projectionthe focal point is at infinity, the rays are parallel, and orthogonal to the image planegood model for telephoto lens. No perspective effects.when xy-plane is the image plane (x,y,z) -> (x,y,0) front orthographic view16Computer Graphics 15-462Simple Perspective CameraCanonical case:–camera looks along the z-axis–focal point is the origin–image plane is parallel to the xy-plane at distance d– (We call d the focal length, mainly for historical reasons)Image Planeyxz[0,0,d]F=[0,0,0]17Computer Graphics 15-462Viewing and Projection• Our eyes collapse 3-D world to 2-D retinal image(brain then has to reconstruct 3D)• In CG, this process occurs by projection• Projection has two parts:–Viewing transformations: camera position and direction–Perspective/orthographic transformation: reduces 3-D to 2-D• Use homogeneous transformations (of course…)18Computer Graphics 15-462Viewing and ProjectionBuild this up in stages• Canonical view volume to screen• Orthographic projection to canonical view volume• Perspective projection to orthographic space19Computer Graphics 15-462Canonical View VolumeWhy this shape?–Easy to clip to–Trivial to project from 3D to 2D image plane chalkboard20Computer Graphics 15-462Orthographic ProjectionX=l left planeX=r right planeY=b bottom planeY=t top planeZ=n near planeZ=f far planechalkboardWhy near plane? Prevent points behind the camera being seenWhy far plane? Allows z to be scaled to a limited fixed-point value (z-buffering)21Computer Graphics 15-462Arbitrary View PositionsEye position: eGaze direction: gview-up vector: tchalkboard22Computer Graphics 15-462Perspective Projection23Computer Graphics 15-462Perspective Projection of a Pointy_s = d/z y24Computer Graphics 15-462Perspective ProjectionWarping a perspective projection into and orthographic oneLines for the two projections intersect at the view planeHow can we put this in matrix form? Need to divide by z—haven’t seen a divide in our matrices so far…Requires our w from last time (or h in the book)chalkboard25Computer Graphics 15-462ClippingSomething is missing between projection and viewing...Before projecting, we need to eliminate the portion of scene that is outside the viewing frustumxyzimage planenearfarclipped lineNeed to clip objects to the frustum (truncated pyramid)Now in a canonical position but it still seems kind of tricky...26Computer Graphics 15-462Normalizing the Viewing FrustumSolution: transform frustum to a cube before clippingxyznear farclipped line1110xyzimage planenearfarclipped lineConverts perspective frustum to orthographic frustumYet another homogeneous transform!27Computer Graphics 15-46228Computer Graphics 15-462Camera Control Values• All we need is a single translation and angle-axis rotation (orientation), but...• Good animation requires good camera control--we need better control knobs• Translation knob - move to the lookfrom point• Orientation can be specified in several ways:– specify camera rotations– specify a lookat point (solve for camera rotations)29Computer Graphics 15-462A Popular View Specification Approach• Focal length, image


View Full Document

CMU CS 15462 - Wrap-up on Transformations 3D Viewing

Download Wrap-up on Transformations 3D Viewing
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Wrap-up on Transformations 3D Viewing and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Wrap-up on Transformations 3D Viewing 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?