1 / 116

CSCE 590E Spring 2007

CSCE 590E Spring 2007. Animation. By Jijun Tang. Rendering Primitives. Strips, Lists, Fans Indexed Primitives The Vertex Cache Quads and Point Sprites. Strips, Lists, Fans. Triangle strip. 4. 2. 4. 1. 2. 6. 8. 5. 2. 1. 2. 3. 6. 7. 1. 5. 3. 3. 9. 8. 4. 3.

prentice
Download Presentation

CSCE 590E Spring 2007

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCE 590E Spring 2007 Animation By Jijun Tang

  2. Rendering Primitives • Strips, Lists, Fans • Indexed Primitives • The Vertex Cache • Quads and Point Sprites

  3. Strips, Lists, Fans Triangle strip 4 2 4 1 2 6 8 5 2 1 2 3 6 7 1 5 3 3 9 8 4 3 Triangle list 1 3 5 4 2 7 4 5 6 5 6 Line list 1 Line strip 6 Triangle fan

  4. Strips vs. Lists 32 triangles, 25 vertices 4 strips, 40 vertices 25 to 40 vertices is 60% extra data!

  5. Indexed Primitives • Vertices stored in separate array • No duplication of vertices • Called a “vertex buffer” or “vertex array” • Triangles hold indices, not vertices • Index is just an integer • Typically 16 bits • Duplicating indices is cheap • Indexes into vertex array

  6. Textures • Texture Formats • Texture Mapping • Texture Filtering • Rendering to Textures

  7. Texture Formats • Textures made of texels • Texels have R,G,B,A components • Often do mean red, green, blue colors • Really just a labelling convention • Shader decides what the numbers “mean” • Not all formats have all components • Different formats have different bit widths for components • Trade off storage space and speed for fidelity

  8. Common formats • A8R8G8B8 (RGBA8): • 32-bit RGB with Alpha • 8 bits per comp, 32 bits total • R5G6B5: 5 or 6 bits per comp, 16 bits total • A32f: single 32-bit floating-point comp • A16R16G16B16f: four 16-bit floats • DXT1: compressed 4x4 RGB block • 64 bits • Storing 16 input pixels in 64 bits of output • Consisting of two 16-bit R5G6B5 color values and a 4x4 two bit lookup table

  9. MIP Map 4x4 cube map (shown with sides expanded) 8x8 2D texture with mipmap chain

  10. Texture Filtering for Resize Point sampling enlarges without filtering • When magnified, texels very obvious • When minified, texture is “sparkly”

  11. Bilinear filtering • Used to smooth textures when displayed larger or smaller than they actually are • Blends edges of texels • Texel only specifies color at centre • Magnification looks better • Minification still sparkles a lot

  12. Trilinear Filtering • Trilinear can over-blur textures • When triangles are edge-on to camera • Especially roads and walls • Anisotropic filtering solves this • Takes multiple samples in one direction • Averages them together • Quite expensive in current hardware

  13. Lighting and Approaches • Processes to determine • the amount and direction of light incident on a surface • how that light is absorbed, reemitted, and reflected • which of those outgoing light rays eventually reach the eye • Approaches: • Forward tracing: trace every photon from light source • Backward tracing: trace a photon backward from the eye • Middle-out: compromise and trace the important rays

  14. Hemisphere lighting • Three major lights: • Sky is light blue • Ground is dark green or brown • Dot-product normal with “up vector” • Blend between the two colors • Good for brighter outdoor daylight scenes

  15. Example

  16. Lightmap Example

  17. Normal Mapping Example

  18. Specular Material Lighting • Light bounces off surface • How much light bounced into the eye? • Other light did not hit eye – so not visible! • Common model is “Blinn” lighting • Surface made of “microfacets” • They have random orientation • With some type of distribution

  19. Example

  20. Environment Maps • Blinn used for slightly rough materials • Only models bright lights • Light from normal objects is ignored • Smooth surfaces can reflect everything • No microfacets for smooth surfaces • Only care about one source of light • The one that reflects to hit the eye

  21. Example

  22. Character Animation

  23. What is animation? • Animation is from the latin “anima” or soul • To give motion • Means to give life Anything you can do in your game to give it more “life” through motion (or lack of motion).

  24. Animation Example • MSTS

  25. Overview • Fundamental Concepts • Animation Storage • Playing Animations • Blending Animations • Motion Extraction • Mesh Deformation • Inverse Kinematics • Attachments & Collision Detection • Conclusions

  26. Animation Roles • Programmer – loads information created by the animator and translates it into on screen action. • Animator – Sets up the artwork. Provides motion information to the artwork.

  27. Different types of animation • Particle effects • Procedural / Physics • “Hard” object animation (door, robot) • “Soft” object animation (tree swaying in the wind, flag flapping the wind) • Character animation

  28. 2D Versus 3D Animation • Borrow from traditional 2D animation • Understand the limitations of what can be done for real-time games • Designing 3D motions to be viewed from more than one camera angle • Pace motion to match game genre Image courtesy of George T. Henion.

  29. Animation terms • frame – A image that is displayed on the screen, usually as part of a sequence. • pose – a orientation of an objects or a hierarchy of objects that defines extreme or important motion. • keyframe – a special frame that contains a pose. • tween – the process of going “between” keyframes. • secondary motion – An object motion that is the result of its connection or relationship with another object. • Baking – setting every Nth frame as a key frame.

  30. Fundamental Problems • Volume of data, processor limitations • Mathematical complexity, especially for rotations. • Translation of motion

  31. Fundamental Concepts • Skeletal Hierarchy • The Transform • Euler Angles • The 3x3 Matrix • Quaternions • Animation vs Deformation • Models and Instances • Animation Controls

  32. Skeletal Hierarchy • The Skeleton is a tree of bones • Often flattened to an array in practice • Top bone in tree is the “root bone” • May have multiple trees, so multiple roots • Each bone has a transform • Stored relative to its parent’s transform • Transforms are animated over time • Tree structure is often called a “rig”

  33. Example

  34. The Transform • “Transform” is the term for combined: • Translation • Rotation • Scale • Shear • Can be represented as 4x3 or 4x4 matrix • But usually store as components • Non-identity scale and shear are rare • Optimize code for common trans+rot case

  35. Examples

  36. Three rotations about three axes Intuitive meaning of values Euler Angles

  37. Euler Angles • This means that we can represent an orientation with 3 numbers • A sequence of rotations around principle axes is called an Euler Angle Sequence • Assuming we limit ourselves to 3 rotations without successive rotations about the same axis, we could use any of the following 12 sequences: XYZ XZY XYX XZX YXZ YZX YXY YZY ZXY ZYX ZXZ ZYZ

  38. Using Euler Angles • To use Euler angles, one must choose which of the 12 representations they want • There may be some practical differences between them and the best sequence may depend on what exactly you are trying to accomplish

  39. Interpolating Euler Angles • One can simply interpolate between the three values independently • This will result in the interpolation following a different path depending on which of the 12 schemes you choose • This may or may not be a problem, depending on your situation • Interpolating near the ‘poles’ can be problematic • Note: when interpolating angles, remember to check for crossing the +180/-180 degree boundaries

  40. Problems • Euler Angles Are Evil • No standard choice or order of axes • Singularity “poles” with infinite number of representations • Interpolation of two rotations is hard • Slow to turn into matrices • Use matrix rotation

  41. Rotation Matrix

  42. 3x3 Matrix Rotation • Easy to use • Moderately intuitive • Large memory size - 9 values • Animation systems always low on memory • Interpolation is hard • Introduces scales and shears • Need to re-orthonormalize matrices after

  43. Quaternions • Quaternions are an interesting mathematical concept with a deep relationship with the foundations of algebra and number theory • Invented by W.R.Hamilton in 1843 • In practice, they are most useful to us as a means of representing orientations • A quaternion has 4 components

  44. Quaternions on Rotation • Represents a rotation around an axis • Four values <x,y,z,w> • <x,y,z> is axis vector times sin(angle/2) • w is cos(angle/2) • No singularities • But has dual coverage: Q same rotation as –Q • This is useful in some cases! • Interpolation is fast

  45. Quaternions (Imaginary Space) • Quaternions are actually an extension to complex numbers • Of the 4 components, one is a ‘real’ scalar number, and the other 3 form a vector in imaginary ijk space!

  46. Quaternions (Scalar/Vector) • Sometimes, they are written as the combination of a scalar value s and a vector value v where

  47. Unit Quaternions • For convenience, we will use only unit length quaternions, as they will be sufficient for our purposes and make things a little easier • These correspond to the set of vectors that form the ‘surface’ of a 4D hypersphere of radius 1 • The ‘surface’ is actually a 3D volume in 4D space, but it can sometimes be visualized as an extension to the concept of a 2D surface on a 3D sphere

  48. Quaternions as Rotations • A quaternion can represent a rotation by an angle θ around a unit axis a: • If a is unit length, then q will be also

  49. Quaternions as Rotations

  50. Quaternion to Matrix • To convert a quaternion to a rotation matrix:

More Related