CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

12
CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE

Transcript of CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

Page 1: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

CS 450: COMPUTER GRAPHICS

ANIMATIONSPRING 2015

DR. MICHAEL J. REALE

Page 2: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

CREDIT WHERE CREDIT IS DUE

• An excellent tutorial on computer animation and bones: http://what-when-how.com/advanced-methods-in-computer-graphics/skeletal-animation-advanced-methods-in-computer-graphics-part-1/ Many of the images from this slide deck come from this tutorial

Page 3: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

INTRODUCTION

• Hitherto, our objects/primitives have more or less stayed put

• At most, the camera has moved around

• However, when simulating a real-world 3D scene, objects should move around we need to animate them

• Animation of objects can happen for two broad reasons:

• Object is performing an action

• E.g., a human walking, a car driving

• Object is acted upon by outside forces

• E.g., an apple falling, collision of two objects

Page 4: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

ARTICULATED CHARACTER MODELS

• If an object is completely rigid with no moving parts, we can use matrix transformations to translate, rotate, etc. the object as we see fit

• E.g., every time step, apply a transformation matrix downwards to make an apple fall to the ground

• However, a lot of objects have moving parts (e.g., human models)

• We’re going to focus on articulated character models

• Basically a model that has limbs of some description

• Has vertices for object itself + skeleton

Page 5: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

SKELETONS AND BONES

• Bone = affects certain vertices on a model

• Bone moves affected vertices move

• Skeleton = set of all bones and how they are dependent on each other

• Contains hierarchy of bones

• E.g., leg bone connected to the thigh bone

• One can create a model with a skeleton in two ways:

• a) Make separate, unconnected parts each bone just affects each part

• b) Make a single mesh each bone affects certain vertices (some more than others)

Page 6: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

VERTEX BLENDING

• The problem with using separate parts is what happens to vertices at joints:

• Bending at joints produces a gap and/or folding into itself

• Solution: vertex blending

• Also called skinning, enveloping, or skeleton-subspace deformation

• Basic idea: separate moveable parts slightly, then fill gap with additional geometry

• Can also be implemented by having bones only affect certain vertices in mesh by a certain weight

Page 7: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

BONE ANIMATION

• Given a skeleton, an animation will transform one or more bones using matrix transformations:

• p = original vertex

• u(t) = transformed vertex at time t

• wi = weight of bone i for vertex p

• Mi-1 = transforms from world to bone’s initial coordinate system

• Bi(t) = ith bone’s world transform that changes with time to animation object

• Both M and B matrices are typically concatenation of matrices hierarchy of previous bone transforms and local animation matrix

0 ,1 where)()(1

0

1

0

1

i

n

i

n

iiiii wwpMtBwtu

Page 8: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

ANIMATION BLENDING

• Animation blending = when more than 1 animation is applied to a given model

• Implementing by using different weights per vertex for each animation

Page 9: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

PROBLEMS WITH VERTEX BLENDING

• Two issues can come up with vertex blending:

• a) Collapsing elbow effect = angle of bend at joint is very large

• b) Candy-wrapper effect = one bone is twisted while the other is not

Page 10: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

KEYFRAMES

• Usually, when creating an animation, you won’t define every single frame of that animation

• Lots of work

• Doesn’t allow you to make the animation arbitrarily slower or faster

• Alternative: create keyframes (target positions/transforms for each animation), then interpolate intermediate frames

Page 11: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

4 keyframes for a walking animation

Page 12: CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.

INTERPOLATING KEYFRAME VALUES

• There are different ways you can interpolate the keyframe values in an animation sequence:

• Step – sudden, results not natural

• Linear – better, but sudden changes in direction at keyframes

• Spline – much smoother