1 animation & java3d ©anthony steed 2002. 2 overview n introduction to animation kinematics...

20
Animation & Java3D ©Anthony Steed 2002

Upload: marybeth-tyler

Post on 16-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

1

Animation & Java3D

©Anthony Steed 2002

Page 2: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

2

Overview

Introduction to Animation• Kinematics • Dynamics• Boids

Java3D• Scene graph• Animation• Vehicles

Page 3: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

3

Animation

Kinematics• Position, velocity and acceleration only

Dynamics• Based on forces, masses

Page 4: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

4

Kinematics

Two forms• Forward – specify each joint in hierarchy

by hand• Inverse – specify position of end-effector

and compute joint steps

Page 5: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

5

Forward Kinematics

Two joints S and E can be rotated.

End position is determined by rotational angle of S and E

Point p can be calculated from the matrices SE (and H, B which are fixed)

S

E

p

Page 6: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

6

Inverse Kinematics

End effector (point p) is specified

E and S must be calculated

This is simple in this situation

S

E

p

Page 7: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

7

Inverse Kinematics

For complex situations where more degrees of freedom in joints that required to specify p

Solve using a non-linear optimiser and further constraints• Energy minimisation

p

Page 8: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

8

Kinematics

Key-framing• Specify transformations of individual joints

or transformation of end-effectors at fixed points (key-frames)

• Interpolate between them Interpolation

• Linear interpolation will look jerky, so use a spline interpolation

Page 9: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

9

Dynamics

Solve for a set of forces acting on a number of bodies

Discrete time-step integration • Car dynamics• Human gait patterns• Boids

Page 10: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

10

Boids

Boids• Avoid each other• Head in the same direction• Gravitate towards each other

Emergent behaviour is very complex

Page 11: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

11

Avoid Close Neighbours

Page 12: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

12

Head Toward Centre of Group

Page 13: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

13

Turn Towards Group Direction

Page 14: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

14

In Code

For each boid• Keep position and

velocity

On each frame for group• Find centre• Find average

velocity

On each frame for each boid• Forces are

– Attraction towards centre

– Attraction towards average velocity

– Repulse neighbours

• Calculate new velocity

• Calculate new position

Page 15: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

15

Java3D Summary

Java3D is a 3D API for Java Broad support across 3D graphics layers

• immediate mode rendering through to HMD and free space tracker support

No built-in support for any file format• Limited VRML97 file reader available promised in

near future Not 100% Pure Java (currently)

• relies on native bindings to graphics library for acceptable speed

Page 16: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

16

Nodes

Similar basic components to VRML• Geometry, Attributes, Groups, Sounds

Super-structure• Canvas3D, View, VirtualUniverse, Locale

Behaviors• Scheduling bound - scope for action potential• WakeUpConditions - triggers for behaviour

– time / frames elapsed

Input Devices

Page 17: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

17

Scene Graph Actions

Designed so that parts of scene graph can be compiled to lower layers

Capability bits determine access to internals of scene graph

Support for copying scene graphs Supports immediate mode rendering pre/postRender for background/overlay

graphics

Page 18: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

18

Example - Boid SetExample - Boid Set

Scene GraphScene Graph

RunTime CallsRunTime Calls

Event SourceEvent Source

BoidBoid

BoidBoid

BoidBoidLocaleLocale

BoidSetBoidSet(BranchGroup)(BranchGroup)

FlockBehaviour FlockBehaviour (Behavior)(Behavior)

WakeupOnFramesElapsed(0)WakeupOnFramesElapsed(0)

setTransformsetTransform

Page 19: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

19

Example - BoidExample - Boid

Scene GraphScene Graph

Run Time CallRun Time Call

ReferenceReference

Boid Boid (TransformGroup)(TransformGroup)

MorphMorph

FlapBehaviour FlapBehaviour (Behavior)(Behavior)

WakeupOnTransformChangedWakeupOnTransformChanged

ShapeShape

ShapeShape

ShapeShape

AlphaAlpha

TriangleTriangleArrayArray

TriangleTriangleArrayArray

TriangleTriangleArrayArray

Page 20: 1 Animation & Java3D ©Anthony Steed 2002. 2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles

20

Recap

Kinematics • Motion independent of force• Used in “traditional” key-frame animation

Dynamics• Boids

Java3D• Scene graph