assignment 2
play

Assignment #2 Which is something you may wish to do So You Want to - PDF document

Assignment #2 Which is something you may wish to do So You Want to Write a Key Framing System since it is Assignment #2 Assignment #2 Assignment #2 Program may be: Write a simplified key framing system that will translate and rotate


  1. Assignment #2  Which is something you may wish to do So You Want to Write a Key Framing System since it is Assignment #2 Assignment #2 Assignment #2  Program may be:  Write a simplified key framing system that will translate and rotate a single  Interactive – show the animation in window on the screen object based on a set of key frames.  Batch – create an app that will produce a set of input files for a renderer.  In either case, program should be involved:  keyframe infile <outfile>  Outfile required only for batch applications. Assignment #2 Interpolating Quaternions  Normalized Quaternions are defined on the  Infile – Describes keyframes. unit 4D sphere  Very simple formatted text file  Linear interpolation generates unequal  1 line per keyframe definition spacing when projected onto circle  t, x, y, z, xa, ya, za, θ  Where  t is the time (sec) at which the object should be in the given position/orientation  (x,y,z) is the position  (xa, yz, za, θ ) is the orientation in axis/angle format 1

  2. Interpolating Quaternions Interpolating Quaternions  Spherical Linear Interpolation  Note:  Spherical Linear Interpolation has the same problem as sin(( 1 u ) ) sin( u ) � � � linear interpolation (no tangential continuity) slerp ( q , q u ) q q = + 1 2 , 1 2  For smooth interpolation, Shomake recommends: sin sin � �  Bezier curves using DeCasteljau construction  Use slerp in constructing these points  where  See SHOMAKE paper or text for details. cos � = q 1 q 2 = w 1 w 2 + ( v 1 • v 2 ) Assignment #2 Assignment #1  Interpolation rules:  Can assume that u varies linearly with t.  Translation may be interpolated using:  I.e. No slow-in/fast-out  Basic linear interpolation  Rotation may be interpolated using:  Spherical linear interpolation of quaternions  Will need to convert axis/angle -> quaternions  Make camera track object  Set lookat when moving object OR  Place camera so object will not move off screen Quaternions Interpolating Quaternions  Spherical Linear Interpolation  Quaternions essentially encodes the info of an axis/angle rotation sin(( 1 u ) ) sin( u ) � � � slerp ( q , q u ) q q = + 1 2 , 1 2 sin sin � �  R θ , (x,y,z) = [ cos( θ /2), sin ( θ /2) • (x, y, z) ]  where cos � = q 1 q 2 = w 1 w 2 + ( v 1 • v 2 ) 2

  3. Quaternions Rotation representation  Conversions: Quaternion -> Rotation Matrix  q = [w, x, y, z] , q normalized Do interpolation here 1 � 2 y 2 � 2 z 2 � � 2 xy � 2 wz 2 xz + 2 wy � � 1 � 2 x 2 � 2 z 2 Axis/angle quaternion 2 xy + 2 wz 2 yz � 2 wx Rotation � � 1 � 2 x 2 � 2 y 2 � � 2 xz � 2 wy 2 yz + 2 wx � � matrix To render Note on real time animation Questions?  t in file represents actual time NOT number of display loops generated.  For real time applications  Simulate a constant frame rate  Calculate time past since last “update” to determine t. Assignments Extras  Grading  5 points  Interpolate translation using Catmull-Rom curve  Each assignment is worth 20 points:  5 points  5 points – for something that compiles  Allow for user defined t -> u mapping.  15 points – for something that runs incorrectly  10 points  20 points – for something that runs correctly  Interpolate rotation using Bezier curve using De Casteljau construction (algorithm in Shomake paper/text)  Bonus points for extras…  Note  Organize your code well as you will be using these routines (at least translational interpolation) in future assignments! 3

  4. Due dates Questions?  Due  Next time:  Friday, January 12 th  Sampling and Animation.  Submission  posted on mycourses (dropbox keyframe)  Please include documentation on  Questions?  how to run your app  How to build your app  Makefile  Visual Studio (.dws, and .dsp files)  Mac (Xcode files)  Renderer used if batch  Platform (sun/Windows/Mac) 4

Recommend


More recommend