Behavioral animation CSE 3541 Matt Boggus.

Slides:



Advertisements
Similar presentations
Reactive and Potential Field Planners
Advertisements

7.2. AI E NGINE AND S TEERING B EHAVIOUR I Design of an AI Engine and introduction to steering in game AI.
Beyond the Centralized Mindset
IS660Z Programming Games Using Visual Basic Overview of Cannonball.
Chapter 3: Motion in 2 or 3 Dimensions
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Flocking and more.  NPC groups can move in cohesive groups not just independently ◦ Meadow of sheep grazing? ◦ Hunting flock of birds? ◦ Ants? Bees?
LOCOMOTION IN INTERACTIVE ENVIRONMENTS Navjot Garg.
Behavioral animation CSE 3541 Matt Boggus. Material recap and trajectory Geometric – Artist specifies translation and rotation over time Physically based.
Flocks, Herds, and Schools: A Distributed Behavioral Model By: Craig Reynolds Presented by: Stephanie Grosvenor.
1 CO Games Development 2 Week 22 Flocking Gareth Bellaby.
Rick Parent - CIS682 Flocking Geometric objects Many objects Simple motion - e.g., local rules, more physics, collision avoidance Consider other members.
PLANAR RIGID BODY MOTION: TRANSLATION & ROTATION
1 Reactive Pedestrian Path Following from Examples Ronald A. Metoyer Jessica K. Hodgins Presented by Stephen Allen.
1Notes  Assignment 2 is out  Flocking references  Reynolds, “Flocks, Herds, and Schools…”, SIGGRAPH’87  Tu and Terzopoulos, “Artificial Fishes…”, SIGGRAPH’94.
1Notes  Textbook: matchmove 6.7.2, B.9. 2 Match Move  For combining CG effects with real footage, need to match synthetic camera to real camera: “matchmove”
John S Gero Agents – Agent Simulations AGENT-BASED SIMULATIONS.
KAIST CS780 Topics in Interactive Computer Graphics : Crowd Simulation A Task Definition Language for Virtual Agents WSCG’03 Spyros Vosinakis, Themis Panayiotopoulos.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
1 Geometry A line in 3D space is represented by  S is a point on the line, and V is the direction along which the line runs  Any point P on the line.
Introduction What is this ? What is this ? This project is a part of a scientific research in machine learning, whose objective is to develop a system,
Steering Behaviors For Autonomous Characters
Virulent SophtWear Virul-Glider V1.0 Josh Smallman Mjumbe Poe Zach Clegg.
Physically Based Animation and Modeling
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
PLANAR RIGID BODY MOTION: TRANSLATION & ROTATION
Introduction Tracking the corners Camera model and collision detection Keyframes Path Correction Controlling the entire path of a virtual camera In computer.
1 Animation & Java3D ©Anthony Steed Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles.
Collision handling: detection and response
Flow Fields Hao Li and Howard Hamilton. Motivation for Flow Fields Multiple AI algorithms in a computer game can produce conflicting results. The AI must.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming.
CLASS 10 SCENE GRAPHS BASIC ANIMATION CS770/870. A scene Graph A data structure to hold components of a scene Usually a Tree of a Directed Acyclic Graph.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Artificial Intelligence in Game Design Complex Steering Behaviors and Combining Behaviors.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Behavioral Animation: Knowing the environment Flocking.
REFERENCES: FLOCKING.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Behavioral Animation.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Artificial Intelligence in Game Design Lecture 8: Complex Steering Behaviors and Combining Behaviors.
CSCI 4310 Lecture 5: Steering Behaviors in Raven.
Electric Field. The Concept of the Electric Field  In the force model of the electric field, the positive charge A exerts an attractive force on charge.
Advanced Computer Graphics Rigid Body Simulation
Crowds (and research in computer animation and games)
Computer Animation Algorithms and Techniques
Character Animation Forward and Inverse Kinematics
Flocking Geometric objects Many objects
CIS 488/588 Bruce R. Maxim UM-Dearborn
Chapter 4.2 Collision Detection and Resolution
Collision handling: detection and response
Rotation representation and Interpolation
Crowds (and research in computer animation and games)
Agenda (10/15) Pick-up guided notes (on front table)
Lighting.
CIS 488/588 Bruce R. Maxim UM-Dearborn
Physically Based Animation and Modeling
UMBC Graphics for Games
Week 6: Time and triggers!
Hierarchical Modeling & Constructive Solid Geometry
Computer Animation Displaying animation sequences raster animation
Computer Animation Algorithms and Techniques
VIRTUAL ENVIRONMENT.
Computer Graphics Lecture 15.
CO Games Concepts Week 12 Collision Detection
Hiroki Sayama NECSI Summer School 2008 Week 2: Complex Systems Modeling and Networks Agent-Based Models Hiroki Sayama
Game Programming Algorithms and Techniques
GPAT – Chapter 7 Physics.
Presentation transcript:

Behavioral animation CSE 3541 Matt Boggus

Material recap and trajectory Geometric Artist specifies translation and rotation over time Physically based Artist specifies forces acting on objects Motion equations dictate movement Behavioral Artist directs autonomous agents Interpolation Artist draws the scene at the beginning and end of an interval of time Intermediate positions are calculated

Behavioral Animation Control the motion of one or more objects using virtual actors Goal: realistic or believable motion so that the object appears to be autonomous Matt Lewis’ page on BA http://accad.osu.edu/~mlewis/Class/behavior.html Example videos 1 + 5

Actor properties (position only) Goal (xg, yg) V = Goal - Position Force based Next Position = Position + V * dt Position (x, y)

Problems with repulsive forces

A hierarchy of motion behaviors Action selection State logic Reflex agent Steering Position and orientation changing logic Locomotion Figure animation covered later in 3541 Keep using primitive shapes or non-animated meshes Figure source: Steering Behaviors For Autonomous Characters http://www.red3d.com/cwr/steer/gdc99/

Reflex agent Figure source: https://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_agents_and_environments.htm

Reflex agent – predator

Actor properties (position and orientation) Orientation (ox, oy) = transform.forward Rotate(θ) Determine which rotation (±θ) orients the actor closer to the goal using dot product Rotate(-θ) Goal (xg, yg) Vtarget = Goal - Position Steering based Position (x, y) In Unity, you can use RotateTowards()

Orientation vectors in Unity Image Image source: http://answers.unity3d.com/questions/211910/getting-object-local-direction.html

Sample starter code class OrientedAgent2D { // Data GameObject model; // Use this field for geometry, // position, and orientation // Methods Update(float deltaTime); TurnLeft(); TurnRight(); MoveForward(); MoveBackward(); }; For an agent moving in the x-z plane, its y position is and y component of transform.forward are both always zero

Behavioral animation Character or object motion based on: Knowledge of the environment Aggregate behavior Primitive behavior (Intelligent behavior) (Crowd management)

Knowing the environment Vision and other senses Information available from the current state of the scene Computed “fresh” each Update() Memory Information stored from the past Ex: lastKnownPlayerPosition field set at the end of an Update call where an enemy ai saw the player

Lab4 design note Predator class/objects/script must be able to access prey class/objects/script in order to get position for vision test Multiple options All objects are fields in one script Or, add methods that pass/take references to other objects or find objects by name

Vision Targeted vision General vision Can the actor see object X? Boolean CanSee(object X); General vision What is everything the actor can currently see? Brute force approach: loop over all objects, use targeted vision on each one, return arrayList of GameObjects “seen” Possible computation/accuracy tradeoff How much of an object needs to be seen to be identified? Do we need to model visual perception?

Omniscience Everything in the scene is known CanSee(object X) { return true };

Distance limited omniscience

Field of view

Field of view – example Orientation Vector (O) Vector from agent to vertex (V) The dot product logic doesn’t take into account occlusion. Remember to normalize V before doing dot product. If the agent cannot see far away, also check that the magnitude of the V vector doesn’t exceed the max distance it can see. Angle of cone = θ Inside the cone when the angle between O and V is less then or equal to θ/2

Field of view – sample code Vector3 agentPosition, orientation, objectPosition; float visionLimit; Vector3 agentToVertex = objectPosition – agentPosition; agentToVertex.Normalize(); if(Vector3.Dot(agentToVertex,orientation) > visionLimit) // objectPosition is in cone

Occluded Vision Ray casting with collision detection Sample the environment

How well can the actor see X? Target-testing vision (per object) How well can the actor see X? Use multiple rays Can the actor see X? Cast a ray

Target-testing vision (alternative) Sample the vision cone Cast multiple rays

Other senses Hearing Smell Sensors & signal propagation Spatial occupancy approach Applications

Spatial Occupancy

Memory What is recorded about the environment Spatial occupancy Transience of objects: time-stamps Memory hierarchy: short-term, long-term

Behavioral animation Character or object motion based on: Knowledge of the environment Aggregate behavior Primitive behavior Predator-Prey forces and movement Predator-Prey steering Intelligent behavior Crowd management

Lab4 – predator-prey simulation Unbalanced abilities Vision Distance Field of view Linear speed (moving forward) Angular or rotational speed (turning) (For stealth game concept, consider enemy AI agents as predators, player controls prey)

Predator Prey vision anatomy

Prey-Predator (vision)

Prey-Predator (movement – speed and turning)

Motion – force based Force = c * posprey - pospred Apply a force on the predator towards the prey when in view

Motion – kinematic based vnew vold Determine the closest prey in view then turn towards it and increase forward velocity

Prey-Predator – environment forces Using pure forces May not prevent object penetration Prey can be ‘hidden’ by environmental repulsive forces

Behavioral animation Character or object motion based on: Knowledge of the environment Aggregate behavior Emergence Primitive behavior Intelligent behavior Crowd management

Aggregate Behavior: Emergent Behavior Type Elements Physics Env/Others Typical qualities Type Elements Physics Env/Others Intelligence Particles 102-104 Much/none None Flocking 101-103 Some/some Limited Crowds 101-102 Little/much Little-much

Emergent behavior Complex systems and patterns arising out of simple rules Aints – AI ants http://www.youtube.com/watch?v=rsqsZCH36Hk

Flocking, Swarming, Flying Boids http://www.red3d.com/cwr/boids/

Local control Rules defined to stay with friends, but avoid bumping into each other Need additional rules for collision avoidance with obstacles

Local information

Other flocking issues Global control Negotiating the motion script flock leader global migratory urge Negotiating the motion Separation, alignment, and cohesion may compete/contradict Collision avoidance Once an object is in sight, start steering to avoid Splitting and rejoining (difficult) Collision avoidance too strong – flock may never rejoin after split Flock membership too strong – flock does not split and formation changes Modeling flight

Navigating using bounding sphere

Testing for being on a collision path with (bounding) sphere Navigating Testing for being on a collision path with (bounding) sphere Given: P, V, C, r

Finding closest non-colliding point Calculate s,t

Additional Slides, time permitting

Spatial Occupancy transiency doorway doorway wall

Negotiating the motion Forces Or “Reasoning” (e.g. rule-based)

Modeling flight – common in flocking

Modeling flight Geometric flight – dynamic, incremental rigid transformation of an object moving along a tangent to a three dimensional curve

Less pressure above wing = lift Modeling Flight – Lift Air passing above wing most travel longer than air below it. Less pressure above wing = lift

Modeling Flight – turn by rolling

Modeling Flight – summary Turning is effected by horizontal lift Increasing pitch increases drag Increasing speed increases lift