Physical Based Animation/Simulation Particle Systems Particle systems offer a solution to modeling amorphous, dynamic and fluid objects like clouds, smoke, water, explosions and fire. Representing Objects with Particles • An object is represented as clouds of primitive particles that define its volume rather than by polygons or patches that define its boundary. • A particle system is dynamic, particles changing form and moving with the passage of time. • Object is not deterministic, its shape and form are not completely specified. Instead Basic Model of Particle Systems 1) New particles are generated into the system. 2) Each new particle is assigned its individual attributes. 3) Any particles that have existed past their prescribed lifetime are extinguished. 4) The remaining particles are moved and transformed according to their dynamic attributes. 5) An image of the particles is rendered in the frame buffer, often using special purpose algorithms. Particle Attributes • Initial position • Initial velocity • Initial size – • • • • InitialSize = MeanSize + Rand() X VarSize Initial color Initial transparency Shape Lifetime Alias|Wavefront’s Maya Particle Dynamics A particle’s position is found by simply adding its velocity vector to its position vector. This can be modified by forces such as gravity. Other attributes can vary over time as well, such as color, transparency and size. These rates of change can be global or they can be stochastic for each particle. Particle Extinction • When generated, given a lifetime in frames. • Lifetime decremented each frame, particle is killed when it reaches zero. • Kill particles that no longer contribute to image (transparency below a certain threshold, etc.). Particle Rendering • Particles can obscure other objects behind them, can be transparent, and can cast shadows on other objects. The objects may be polygons, curved surfaces, or other particles. Star Trek II: The Wrath of Khan Particle Hierarchy Particle system such that particles can themselves be particle systems. The child particle systems can inherit the properties of the parents. Grass • Entire trajectory of a particle over its lifespan is rendered to produce a static image. • Green and dark green colors assigned to the particles which are shaded on the basis of the scene’s light sources. • Each particle becomes a blade of grass. white.sand by Alvy Ray Smith (he was also working at Lucasfilm) Soft Bodies • Particle system deforms the surface of a NURBS or polygonal object. chewing gum soft body Physical Based Animation/Simulation Flocking • Schooling or swarming or herding • Relate to groups of characters • Craig W. Reynolds, “Flocks, herds and schools: A distributed behavioral model”, SIGGRAPH 87 • Three simple rules (steering behavior): – Separation, Alignment, Cohesion Birds plus -oids – Together gives groups of autonomous agents (boids) a realistic form of group behavior similar to flocks of birds, schools of fish, or swarms of bees. ex1, ex2 – The steering behavior determines how a character reacts to other characters in its local neighborhood. Emergent Behaviors • Combination of three flocking rules results in emergence of fluid group movements • Emergent behavior – Behaviors that aren’t explicitly programmed into individual agent rules • Ants, bees, schooling fishes Three Rules (Steering Behaviors) 1. Separation: steer to avoid crowding local flockmates 2. Alignment: steer toward the average heading of local flockmates 3. Cohesion: steer to move toward the average position of local flockmates Three Rules (Steering Behaviors) • In each rule, the steering behavior determines how a character reacts to other characters in its local neighborhood. • Characters outside of the local neighborhood are ignored. • The neighborhood is specified by a distance which defines when two characters are “nearby”, and an angle which defines the character’s perceptual “field of view.” Separation steer to avoid crowding local flockmates Gives a character the ability to maintain a certain separation distance from others nearby. How to Compute Steering for Separation? • First a search is made to find other characters within the specified neighborhood (exhaustive, spatial partitioning, caching scheme) • For each nearby character, a repulsive force is computed by subtracting the positions of our character and the nearby character, normalizing, and then applying a 1/r weighting. (That is, the position offset vector is scaled by 1/r 2.) • These repulsive forces for each nearby character are summed together to produce the overall steering force. Alignment steer toward the average heading of local flockmates Gives an character the ability to align itself with (that is, head in the same direction and/or speed as) other nearby characters How to Compute Steering for Alignment? • Find all characters in the local neighborhood (as described for separation) • Average together the velocity (or alternately, the unit forward vector) of the nearby characters. • This average is the “desired velocity,” and so the steering vector is the difference between the average and our character’s current velocity (or alternately, its unit forward vector). • This steering will tend to turn our character so it is aligned with its neighbors. Cohesion steer to move toward the average position of local flockmates Gives an character the ability to cohere with (approach and form a group with) other nearby characters How to Compute Steering for Cohesion? • Find all characters in the local neighborhood (as described for separation) • Computing the “average position” (or “center of gravity”) of the nearby characters. • The steering force can applied in the direction of that “average position” (subtracting our character position from the average position, as in the original boids model), or it can be used as the target for seek steering behavior. Separation, Alignment and Cohesion • In some applications it is sufficient to simply sum up the three steering force vectors to produce a single combined steering for flocking • However for better control it is helpful to: 1. normalize the three steering components 2. scale them by three weighting factors before summing them. • As a result, boid flocking behavior is specified by nine numerical parameters: – a weight (for combining), – a distance and an angle (to define the neighborhood) for each of the three component behaviors. Combined Behaviors and Groups • Flocking (combining: separation, alignment, cohesion) • • • • Crowd Path Following Leader Following Unaligned Collision Avoidance Queuing (at a doorway) Physical Based Animation/Simulation Cognitive Modeling Use AI to allow for planning and learning Control Algorithms Simplified control loop User Control Simulation Frame Use feedback to maintain: balance velocity (speed and direction) etc. State Machines Separate the motion or behavior into several simple states Simple states allow us to generate laws State transitions are triggered by events Example: fall forward until foot hits the ground Running State Machine Overview • • • • • • • Virtual Creatures Creature Representation Creature Control Physical Simulation Behavior Evolution Results Virtual Creatures • Complexity vs. Control • Genetic Algorithms – Darwin (fitness) – Differs from previous work Creature Representation • Genotype • Phenotype Creature Representation • Directed Graph – Nodes • Information – – – – – – Dimensions Joint-type Joint-limits Recursive-limit Neurons Connections » Child Node » Position » Orientation Creature Control • Brain – A directed graph of “neurons” • Effectors – Applied at Joints as Forces or Torques • Muscle Pairs Creature Control • Neurons – Provide different functions • Sum, product, abs, max, sin, cos, oscillators, etc… – Output vs. Input • Number of inputs dependant on function • Output dependant on input and maybe previous state Combining Control and Representation Physical Simulation • Collision Detection – Bounding Box + Pair Specific • Collision Response – Impulses + penalty springs • Friction • Viscosity – For simulating underwater Behavior • Evolution for a specific behavior – Swimming – Walking – Jumping – Following (Land/Water) • Fitness function evaluated at each step – Weights for more preferred methods Evolution • Recipe for a successful evolution 1. Create initial genotypes 1. From scratch 2. 3. 4. 5. Calculate survival ratio Evaluate fitness and kill off the weaklings Reproduce the most fit Evolve, and proceed to step 3. Evolution Mating: CrossOver & Mutation • Reproductive Method – – – 40% Asexual 30% Crossover 30% Grafting Performance • CM-5 with 32 processors – 3 Hours – Population of 300 – 100 Generations Results • Homogeneity • Swimmers – Paddlers – Tail-waggers • Walkers – Lizard-like – Pushers/Pullers – Hoppers • Followers – Steering Fins – Paddlers Overview of vBeluga • Virtual belugas are shown in a wild pod context • Incorporates research on beluga behavior and vocalization conducted at aquarium UBC Zoology • Flow: scientist – game – visitors : wild belugas : captive wild • Simulation : AI architecture - belugas can learn and alter their behavior based on changes in their environment – updatable: new scientific thinking • Physically-based system allows for natural whale locomotion and realistic water – game research • Realistic graphics : use of actuators (virtual bones and muscles) - game research Beluga Behavior System NNet, Action Selection DiPaola,Akai,Kraus 06 "Experiencing Belugas: Developing an Action SelectionBased Aquarium Interactive", Journal of Adaptive Behavior Foundation AI (NSERC) DiPaola,Akai 06 “Designing Adaptive Multimedia Interactives to Support Shared Learning Experiences", ACM Siggraph Education Design HCI / Informal Learning (SAGE) DiPaola,Akai 06 "Blending Science Knowledge and AI Gaming Techniques for Experiential Learning", CA Game Studies Assoc. Gaming/Learning DiPaola,Akai 05 “Shifting Boundaries: the Ontological Implications of Simulating Marine Mammals”, NewForms, Museum of Anthropology IT/Society Vancouver Aquarium: Adv. Layer Neural Net Layer Flexibility of use • Decouple Display with UI (tabletop) – Control crowd by related placement • • • • Main gallery Summer camp Beluga encounters Corporate gathering full ui: tabletop, projection, signage simple ui: on every system guided system main system, ambient mode Physical Based Animation/Simulation