1 KIPA Game Engine Seminars Jonathan Blow Seoul, Korea December 7, 2002 Day 11.

Slides:



Advertisements
Similar presentations
Animation in Video Games presented by Jason Gregory
Advertisements

Arc-length computation and arc-length parameterization
Blending & State Machines CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Lecture Notes #11 Curves and Surfaces II
INNER WORKINGS OF UNITY 3D. WHAT WE ARE GOING TO COVER Intro to Unity Physics & Game Objects Cameras & Lighting Textures & Materials Quaternions and Rotation.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Chapter 3. Interpolation and Extrapolation Hui Pan, Yunfei Duan.
1 Characters. 2Introduction The Characters are the Actors of the Games. The Characters are the Actors of the Games. Three Types of Characters : Three.
Animation Following “Advanced Animation and Rendering Techniques” (chapter 15+16) By Agata Przybyszewska.
Chapter 5.2 Character Animation. 2 Overview Fundamental Concepts Animation Storage Playing Animations Blending Animations Motion Extraction Mesh Deformation.
3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.
Section 4: Implementation of Finite Element Analysis – Other Elements
1Notes  Handing assignment 0 back (at the front of the room)  Read the newsgroup!  Planning to put 16mm films on the web soon (possibly tomorrow)
1Notes  Assignment 0 marks should be ready by tonight (hand back in class on Monday)
Animation. Outline  Key frame animation  Hierarchical animation  Inverse kinematics.
Modelling: Curves Week 11, Wed Mar 23
Midterm Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
Rotation and Orientation: Affine Combination Jehee Lee Seoul National University.
1cs426-winter-2008 Notes  SIGGRAPH crunch time - my apologies :-)
CSE 473 Dr. Charles B. Owen Fundamentals of 3D Game Development1 Skeletons and Skinning Bones and Skeletons Mesh Skinning.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Characters.
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
05/09/02(c) 2002 University of Wisconsin Last Time Global illumination algorithms Grades so far.
Chapter 5.2 Character Animation. CS Overview Fundamental Concepts Animation Storage Playing Animations Blending Animations Motion Extraction Mesh.
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 4, 2002 Day 8.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Kinematic Linkages.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
Erin Catto Blizzard Entertainment Numerical Integration.
This Week Week Topic Week 1 Week 2 Week 3 Week 4 Week 5
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16.
Simulation and Animation
© 2012 Adobe Systems Incorporated. All Rights Reserved. Copyright 2012 Adobe Systems Incorporated. All rights reserved. ® INTRODUCTION TO FLASH ANIMATION.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Computer Graphics 2 In the name of God. Outline Introduction Animation The most important senior groups Animation techniques Summary Walking, running,…examples.
Arrays Tonga Institute of Higher Education. Introduction An array is a data structure Definitions  Cell/Element – A box in which you can enter a piece.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
SE 313 – Computer Graphics Lecture 6: Transformations Lecturer: Gazihan Alankuş Please look at the last three slides for assignments (marked with TODO)
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10.
Maths & Technologies for Games Animation: Practicalities CO3303 Week 3.
March 23 & 28, Hashing. 2 What is Hashing? A Hash function is a function h(K) which transforms a key K into an address. Hashing is like indexing.
1cs426-winter-2008 Notes  Will add references to splines on web page.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
Fall 2015, Kevin Quinn CSE373: Data Structures & Algorithms Lecture 25: Problem Solving CSE373: Data Structures and algorithms1.
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Artificial Intelligence in Game Design Lecture 20: Hill Climbing and N-Grams.
1 Lecture 8 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Animation Animation is about bringing things to life Technically: –Generate a sequence of images that, when played one after the other, make things move.
2014 Animation Programming for Music Video Games Jessica Scott Harmonix Music Systems, Inc. October 10, 2014 #GHC
CGDD 4003 Character Animation. The Skeletal Hierarchy (aka the “rig”) Based on the concept of bones Each bone has exactly one parent Each bone has a transform.
By: Krista Hass. You don’t have to be Einstein to pass this test. Just follow these simple steps and you’ll be on your way to great success on the ACT.
Introduction to Parametric Curve and Surface Modeling.
Character Animation Forward and Inverse Kinematics
UW Extension Certificate Program in Game Development 2nd quarter: Advanced Graphics Animation.
© University of Wisconsin, CS559 Spring 2004
Skeletons and Skinning
Computer Animation and Visualisation Lecture 4. Skinning
Objective of This Course
Chapter 5.2 Character Animation
INTRODUCTION TO FLASH ANIMATION
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Introduction to Parametric Curve and Surface Modeling
Rotation and Orientation: Affine Combination
Game Programming Algorithms and Techniques
CSE 326: Data Structures Lecture #14
Computer Graphics Matrix Hierarchies / Animation
Emerging Technologies for Games Review & Revision Strategy
Presentation transcript:

1 KIPA Game Engine Seminars Jonathan Blow Seoul, Korea December 7, 2002 Day 11

2 Character Animation The goal: let artists make animation, and get it into the game Usually animation is made in a separate tool –Maya / MAX Made out of hierarchical transforms Probably we need to write an exporter plugin and some game-engine import code –Unless we use a licensed character animation system (like Granny)

3 Goals for in-engine reproduced animation As much like the art package’s version of the animation as possible But small (low memory) and fast

4 How animations are authored The artist sets up a bunch of keyframes for transform data –Usually separated into translation, rotation, scale The art tool interpolates between these keyframes at runtime Maybe we should export the keyframes and interpolate them in the engine

5 Why you don’t want to export the keyframes (1) They can be in weird formats that require confusing code to interpolate –3DS max TCB curves They can be in formats that are slow to interpolate –Euler angles They are not necessarily well-compressed –Keyframes get fragmented over time –What happens when you import an animation from another package

6 Why you don’t want to export the keyframes (2) Artists use IK tools to help create animations You would have to reconstruct all this IK functionality exactly for the animation to look right –Footstep controller –Guy grabbing something from a table

7 A better solution: Sample the transforms Don’t worry about the original keyframe data, just evaluate the transforms at some sampling interval Save those transforms out, interpolate them at runtime –Sample at perhaps 30Hz

8 Interpolating transforms? We don’t want to interpolate a 4x3 matrix –It will denormalize, introduce shear Break it into intuitive pieces (translation, rotation, scale) –By matrix decomposition –But… which decomposition you choose matters! Shear easily confused with rotation Use the polar decomposition

9 Interpolating transforms? (2) If samples are close together, our interpolation will not diverge much from the art tool’s –Euler vs slerp for small angles But those samples take a lot of memory! –Example of how much

10 Want to compress those samples Hopefully at export time (small file size) How to compress? –Fourier / Wavelet compression –Curve fitting Performance ramifications of each method

11 Compression Probably, curve fitting is the best choice Each curve stored as an array of unevenly spaced knots At runtime we just evaluate a simple polynomial to reconstruct values –For linear values like translation and scale –What about rotation?

12 Rotation interpolation For interpolation between two rotations, slerp is the “right answer” This may be too slow –Review of slerp code Can we do something else

13 Different kinds of rotation interpolation slerp exponential map lerp –lerp approximates slerp for small angles sin(x) = x as x -> 0 –It’s not that bad for large angles either

14 Re-derivation of slerp in 2D Did this once before, but will do it again quickly, as an introduction to the lerp derivation

15 What happens when we lerp two quaternions? Assuming they don’t differ by more than 90 degrees –double cover! We can analytically quantify the distoritions in angle and length

16 Using lerp as a substitution for slerp Probably we have to renormalize Maybe we have to compensate for the angle Discussion of fast unit vector normalization –Newton-raphson approximation to 1/sqrt(x) in the neighborhood near 1 –Walk-through of code

17 How to compensate for the angle Discussion of approximating the inverse of the angular distortion

18 Maybe we don’t have to compensate for the angle When curve-fitting, we measure our error with respect to the lerped/normalized reconstruction of a spline (not the ideal slerp solution) This causes us to insert more knots in the curve when we might need better angle accuracy So maybe there is a trade-off here, memory for runtime speed

19 Fitting algorithm (discussion on whiteboard, including quirks)

20 Data structures An animation structure contains: –Number of nodes, names of the nodes –Keyframe data for compressed curves –Information about how to blend in/out of animation, when to start/stop Explanation of some different ways you might want to arrange things

21 Data structures A mesh contains: –Number of nodes, names of the nodes –Vertex data –Vertex weight information

22 Binding data structures A lot of systems work by building a table that cross-references between node names in the animations, and node names in the mesh –Animations might not be stored in the same order node-wise –Some might have nodes that the others don’t This is called the “bind step”

23 I don’t like the bind step It means that you can’t have animation playback without a mesh attached I want animations to be meaningful without meshes yet, i.e. I want to be able to play them back and mix them –Though there are bone length assumptions built into the animations Lately I rewrote my animation system to not use a bind step

24 What I do An “animation player” class handles animation playing One “channel” per animation on the same figure (so, 2 channels for upper/lower body) The player has a string hash table that keeps track of values, and maps each channel’s nodes to a central node array To animate an object, we map that object’s node names through the hash table (every frame, potentially)

25 Structuring node order by dependency So you can compose a bunch of relative transforms into object-space transforms in one pass –Only constraint is that any node’s parent has to have an index less than its own If you mix two arrays like this, it is easy to maintain this constraint –So the player’s central animation array will be correctly ordered

26 Mixing Animations Sometimes you want to play back two different animations on various nodes of the body –Description of how this reduces data size and artist time This will produce inappropriate results for some actions –Because the meanings of various rotations depend on what’s higher up in the hierarchy –Example: Guy swinging a sword

27 Mixing Animations Interpolate transforms relative to a common root between the two animations Put these into the relative transform slots during animation playback –Or else interpolate in object space, but that might be inconvenient

28 Brief discussion: quaternion splines Very hard to precompute, not cheap to evaluate either Though Casey says you can do a de Casteljau-like formulation, using slerp instead of lerp I am not sure if this is the “right answer” but it seems to work in many cases So if lerp is not good enough, think about using this layered slerp technique

29 Mixing IK with playing animations Evaluate the animations first Solve IK given those object-space coordinates Mix the IK back in as though it were an animation channel

30 Putting sound effects in animation data Only robust way to generate sound cues at appropriate times! Put tag names in the animation; these tags are later converted to sound effect names –based on material contacted, etc… (example of footsteps)

31 Putting other auxiliary data in animations Example of “attack strength” in swordfighting game Advantage: Easy for animator to change this without programmers, easy to keep in sync with animation Disadvantage: Maybe animator should not be in charge of this; might be better to have a separate specification system

32 Instead of IK for aiming things… Blending between pre-generated animations (Example of aiming a gun) Can do an iterated search through the animation space until you find something “close enough”

33 Reasons you still might want IK Example of two-handed weapon –Shows why requiring a tree hierarchy is bad

34 Facial Animation Probably should use morph targets, not a bone system Each facial expression is probably a short animation (not a frozen mask)

35 Code Inspection

36 Questions?