animation from bvh andrew slatton. biovision hierarchy (bvh) contains motion capture data 2 major...

15
Animation from BVH Andrew Slatton

Upload: hortense-mckinney

Post on 18-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Animation from BVH

Andrew Slatton

Page 2: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Biovision Hierarchy (BVH)

• Contains motion capture data

• 2 Major Components:– Hierarchy

• Formatted like a scene graph with parents, children, etc.

– Motion data• Number of frames, frame time• A list of floating point values associated with

“channels” of the hierarchy nodes

Page 3: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

BVH• Example of Hierarchy:

HIERARCHYROOT Hips{ OFFSET -0.347901 96.7718 1.79791 CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation JOINT LeftUpLeg { OFFSET 8.91 -6.27 -2.145 CHANNELS 3 Zrotation Xrotation Yrotation JOINT LeftUpLegRoll { OFFSET 0 -22.7323 0 CHANNELS 3 Zrotation Xrotation Yrotation }…}

Page 4: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

BVH

• Motion data example:

MOTIONFrames: 119Frame Time: 0.0416667-0.347901 96.7718 1.79791 3.45611 -6.10769 -4.18959 -

9.22955 -11.0645 -5.78911 6.6312e-019 -6.8208e-017 1.11403 -8.04373e-008 27.9673 4.94512 1.63315e-017 -3.38117e-016 5.53064 1.94131 -9.21066 0.156389 1.74467e-007 -1.06026e-007 3.22852e-016 -6.86092 -9.75453 -1.61311 8.22385e-018 -2.40073e-016 3.92388 -7.54458e-006 75.9784 0.826967 …

Page 5: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

BVH Motion Data

• List of values• Each value corresponds to a rotation or

translation channel• Listed in same order as hierarchy was

parsed• [Joint0, Channel0] [Joint0, Channel1]

[Joint1, Channel0] [Joint1, Channel1] [Joint1, Channel2] …

• [X, Y, Z] x [Rotation, Translation]

Page 6: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Project Steps

• BVH Parser– Needs to read in and handle hierarchy,

motion data– Similar to writing any other parser, so no need

to discuss

• Skeleton drawing– Could handle this mostly in CPU or mostly in

GPU– I chose GPU

Page 7: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Drawing the Skeleton

• High level implementation:– On CPU:

• Send skeleton object a time• Skeleton object computes what frame should be

displayed at that time• Skeleton object sends appropriate data to shader

– Shaders handle everything else

Page 8: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Drawing the Skeleton

• Vertex Shader– Given motion and hierarchy data– Computes positions of joints for the desired frame

• Geometry Shader– Given joint locations– Computes vertex positions and normals for limbs

• Fragment Shader– Phong illumination of limbs

Page 9: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Drawing the Skeleton

• Shader uniform variables:– Motion data for desired frame– Joint offsets– Channel ordering

• Could be Xrot, Yrot, Zrot, OR Zrot, Yrot, Xrot (or any other order)

– Parent pointers• Must apply ancestors’ transforms to find a joint’s location

– Motion data pointers• Some joints span six indices of motion data, some three, and

some zero

Page 10: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Drawing the Skeleton

• Generating Limbs:– Simplest Method:

• Draw a sphere at the location of each joint

• Doesn’t give a vivid picture of the motion

Page 11: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Drawing the Skeleton

• Generating Limbs:– Could make a cylinder about each

ParentJoint-ChildJoint segment– Notice the discontinuities at joints. This is

ugly.

Page 12: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Drawing the Skeleton

• Generating Limbs:– Quick fix for final result

• Rotate y = x*x – 1 about each limb axis

Page 13: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Odds and Ends

• Could implement animation as loop that stops only when animation is complete:

while(!skel.last_frame()) {skel.set_frame(elapsed_time);DrawScene(); }

• This locks up CPU• No good if we want to allow keyboard/mouse inputs

during animation

• Also, won’t work with glutPostRedisplay() because we must exit the loop before glutMainLoop can call glutDisplayFunction

Page 14: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Odds and Ends

• Use glutTimerFunc !Animate(int delay){

skel.set_frame(elapsed_time);

glutPostRedisplay();

if(!skel.last_frame()) {

glutTimerFunc(delay,Animate,delay); }}

• Will call Animate once every delay milliseconds until we reach end of animation

• Allows glutMainLoop to continue execution during this delay time

Page 15: Animation from BVH Andrew Slatton. Biovision Hierarchy (BVH) Contains motion capture data 2 Major Components: –Hierarchy Formatted like a scene graph

Thank You!