Download presentation
Presentation is loading. Please wait.
Published byMarybeth Tyler Modified over 9 years ago
1
1 Animation & Java3D ©Anthony Steed 2002
2
2 Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles
3
3 Animation n Kinematics Position, velocity and acceleration only n Dynamics Based on forces, masses
4
4 Kinematics n Two forms Forward – specify each joint in hierarchy by hand Inverse – specify position of end-effector and compute joint steps
5
5 Forward Kinematics n Two joints S and E can be rotated. n End position is determined by rotational angle of S and E n Point p can be calculated from the matrices SE (and H, B which are fixed) S E p
6
6 Inverse Kinematics n End effector (point p) is specified n E and S must be calculated n This is simple in this situation S E p
7
7 Inverse Kinematics n For complex situations where more degrees of freedom in joints that required to specify p n Solve using a non- linear optimiser and further constraints Energy minimisation p
8
8 Kinematics n Key-framing Specify transformations of individual joints or transformation of end-effectors at fixed points (key-frames) Interpolate between them n Interpolation Linear interpolation will look jerky, so use a spline interpolation
9
9 Dynamics n Solve for a set of forces acting on a number of bodies n Discrete time-step integration Car dynamics Human gait patterns Boids
10
10 Boids n Boids Avoid each other Head in the same direction Gravitate towards each other n Emergent behaviour is very complex
11
11 Avoid Close Neighbours
12
12 Head Toward Centre of Group
13
13 Turn Towards Group Direction
14
14 In Code n For each boid Keep position and velocity n On each frame for group Find centre Find average velocity n On each frame for each boid Forces are –Attraction towards centre –Attraction towards average velocity –Repulse neighbours Calculate new velocity Calculate new position
15
15 Java3D Summary n Java3D is a 3D API for Java n Broad support across 3D graphics layers immediate mode rendering through to HMD and free space tracker support n No built-in support for any file format Limited VRML97 file reader available promised in near future n Not 100% Pure Java (currently) relies on native bindings to graphics library for acceptable speed
16
16 Nodes n Similar basic components to VRML Geometry, Attributes, Groups, Sounds n Super-structure Canvas3D, View, VirtualUniverse, Locale n Behaviors Scheduling bound - scope for action potential WakeUpConditions - triggers for behaviour –time / frames elapsed n Input Devices
17
17 Scene Graph Actions n Designed so that parts of scene graph can be compiled to lower layers n Capability bits determine access to internals of scene graph n Support for copying scene graphs n Supports immediate mode rendering n pre/postRender for background/overlay graphics
18
18 Example - Boid Set Scene Graph RunTime Calls Event Source Boid Boid Boid Locale BoidSet(BranchGroup) FlockBehaviour (Behavior) WakeupOnFramesElapsed(0) setTransform
19
19 Example - Boid Scene Graph Run Time Call Reference Boid (TransformGroup) Morph FlapBehaviour (Behavior) WakeupOnTransformChanged Shape Shape Shape Alpha TriangleArray TriangleArray TriangleArray
20
20 Recap n Kinematics Motion independent of force Used in “traditional” key-frame animation n Dynamics Boids n Java3D Scene graph
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.