Assignment # 1 � Which is something you may wish to do So You Want to Write a Key Framing System since it is Assignment # 1 Assignment # 1 Assignment # 1 � 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 # 1 Assignment # 1 � Interpolation rules: � Infile – Describes keyframes. � Translation may be interpolated using: � Very simple formatted text file � Basic linear interpolation � 1 line per keyframe definition � Rotation may be interpolated using: � t, x, y, z, xa, ya, za, θ � Spherical linear interpolation of quaternions � Where � Will need to convert axis/angle -> quaternions � t is the time (sec) at which the object should be in � Make camera track object the given position/orientation � Set lookat when moving object OR � (x,y,z) is the position � (xa, yz, za, θ ) is the orientation in axis/angle format � Place camera so object will not move off screen 1
Assignment # 1 Quaternions � Can assume that u varies linearly with t. � Quaternions essentially encodes the info of an axis/angle rotation � I.e. No slow-in/fast-out � R θ , (x,y,z) = [ cos( θ /2), sin ( θ /2) • (x, y, z) ] Interpolating Quaternions Quaternions � Spherical Linear Interpolation � Conversions: Quaternion -> Rotation Matrix − θ θ sin(( 1 ) ) sin( ) � q = [s, x, y, z] , q normalized = u + u slerp ( , ) q q u q q 1 2 , 1 θ 2 θ sin sin ⎡ ⎤ − − − + 2 2 1 2 2 2 2 2 2 y z xy sz xz sy ⎢ ⎥ + − − − 2 2 2 2 1 2 2 2 2 � where ⎢ ⎥ xy sz x z yz sx ⎢ ⎥ − + − − 2 2 θ = • = + • 2 2 2 2 1 2 2 ⎣ ⎦ xz sy yz sx x y cos ( ) q q s s v v 1 2 1 2 1 2 Rotation representation Note on real time animation � t in file represents actual time NOT number of display loops generated. Do interpolation here � For real time applications � Simulate a constant frame rate Axis/angle quaternion � Calculate time past since last “update” to Rotation determine t. matrix To render 2
Questions? Assignments � Grading � Each assignment is worth 25 points: � 5 points – for something that compiles � 15 points – for something that runs incorrectly � 25 points – for something that runs correctly � Bonus points for extras… Extras Due dates � 5 points � Due � Interpolate translation using Catmull-Rom curve � Wednesday, January 11 th � 5 points � Submission � Allow for user defined t -> u mapping. � posted on mycourses (dropbox keyframe) � 10 points � Please include documentation on � Interpolate rotation using Bezier curve with De Casteljau construction of control points (algorithm in Shomake � how to run your app paper/text) � How to build your app � Note � Makefile � Visual Studio (.dws, and .dsp files) � Organize your code well as you will be using these routines � Mac (Xcode files) (at least translational interpolation) in future assignments! � Renderer used if batch � Platform (sun/Windows/Mac) Questions? � Next time: � Physics 101: � Intro to Physically based motion � Questions? 3
Recommend
More recommend