Upload
ada-wilkins
View
213
Download
1
Tags:
Embed Size (px)
Citation preview
CS 551Computer Animation
Lecture 15Lecture 15
Evolved Virtual CreaturesEvolved Virtual Creatures
Lecture 15Lecture 15
Evolved Virtual CreaturesEvolved Virtual Creatures
For next week
Video Textures: Schodl et al.Video Textures: Schodl et al.
Retargeting Motion to New Characters: GleicherRetargeting Motion to New Characters: Gleicher
Video Textures: Schodl et al.Video Textures: Schodl et al.
Retargeting Motion to New Characters: GleicherRetargeting Motion to New Characters: Gleicher
Karl Sims
Panspermia (1990)Panspermia (1990)
Particle Dreams (1988)Particle Dreams (1988)
Panspermia (1990)Panspermia (1990)
Particle Dreams (1988)Particle Dreams (1988)
Karl Sims
Evolved Virtual Creatures (SIGGRAPH 1994)Evolved Virtual Creatures (SIGGRAPH 1994)
Evolving 3D Morphology and Behavior by Evolving 3D Morphology and Behavior by Competition (ALIFECompetition (ALIFE1994)1994)
Evolved Virtual Creatures (SIGGRAPH 1994)Evolved Virtual Creatures (SIGGRAPH 1994)
Evolving 3D Morphology and Behavior by Evolving 3D Morphology and Behavior by Competition (ALIFECompetition (ALIFE1994)1994)
MotivationMotivation
Automatically generate physically simulated Automatically generate physically simulated characters without fully understanding the characters without fully understanding the procedures used to build and control themprocedures used to build and control them
• MorphologyMorphology
• ControlControl
Automatically generate physically simulated Automatically generate physically simulated characters without fully understanding the characters without fully understanding the procedures used to build and control themprocedures used to build and control them
• MorphologyMorphology
• ControlControl
Creating animation from scratch
Typical ScenarioTypical Scenario
• 20 seconds of animation20 seconds of animation
• 17 controlled DOFs17 controlled DOFs
• (20 * 30 * 17) = 10,200 torque values to determine(20 * 30 * 17) = 10,200 torque values to determine
• No approximations to best answer are knownNo approximations to best answer are known
– Spacetime constraints would use initial guess to find local Spacetime constraints would use initial guess to find local maximummaximum
Typical ScenarioTypical Scenario
• 20 seconds of animation20 seconds of animation
• 17 controlled DOFs17 controlled DOFs
• (20 * 30 * 17) = 10,200 torque values to determine(20 * 30 * 17) = 10,200 torque values to determine
• No approximations to best answer are knownNo approximations to best answer are known
– Spacetime constraints would use initial guess to find local Spacetime constraints would use initial guess to find local maximummaximum
Creating animation from scratch
Searching for 10,2000 unknownsSearching for 10,2000 unknowns
• We cannot prescribe initial values with confidenceWe cannot prescribe initial values with confidence
• We can prescribe some behaviors and principles we think We can prescribe some behaviors and principles we think the motion will demonstratethe motion will demonstrate
– The movements at some DOFs are functions of The movements at some DOFs are functions of movements at other DOFsmovements at other DOFs
Sun and Metaxas – Automating Sun and Metaxas – Automating Gait Generation, SIGGRAPH 01Gait Generation, SIGGRAPH 01
Searching for 10,2000 unknownsSearching for 10,2000 unknowns
• We cannot prescribe initial values with confidenceWe cannot prescribe initial values with confidence
• We can prescribe some behaviors and principles we think We can prescribe some behaviors and principles we think the motion will demonstratethe motion will demonstrate
– The movements at some DOFs are functions of The movements at some DOFs are functions of movements at other DOFsmovements at other DOFs
Sun and Metaxas – Automating Sun and Metaxas – Automating Gait Generation, SIGGRAPH 01Gait Generation, SIGGRAPH 01
So we’re not really working from scratch
Searching for 10,200 unknownsSearching for 10,200 unknowns
• How to incorporate our motion heuristics into search?How to incorporate our motion heuristics into search?
– Simulated annealing?Simulated annealing?
– Neural networks?Neural networks?
– Spacetime constraints?Spacetime constraints?
– Genetic algorithms?Genetic algorithms?
Searching for 10,200 unknownsSearching for 10,200 unknowns
• How to incorporate our motion heuristics into search?How to incorporate our motion heuristics into search?
– Simulated annealing?Simulated annealing?
– Neural networks?Neural networks?
– Spacetime constraints?Spacetime constraints?
– Genetic algorithms?Genetic algorithms?
But we don’t know the morphology
The previous example assumed a known The previous example assumed a known morphologymorphology
• We’re searching for best architecture AND best control We’re searching for best architecture AND best control simultaneously!simultaneously!
Our search space just grew to an unknown degree!Our search space just grew to an unknown degree!
The previous example assumed a known The previous example assumed a known morphologymorphology
• We’re searching for best architecture AND best control We’re searching for best architecture AND best control simultaneously!simultaneously!
Our search space just grew to an unknown degree!Our search space just grew to an unknown degree!
Imitate the processes of evolution and natural Imitate the processes of evolution and natural selection in biological world to generate/evolve selection in biological world to generate/evolve the best solutionthe best solution
Imitate the processes of evolution and natural Imitate the processes of evolution and natural selection in biological world to generate/evolve selection in biological world to generate/evolve the best solutionthe best solution
Genetic Algorithms
(not to scale)
Genetic Algorithms
Inject user knowledgeInject user knowledge
• Objective function Objective function
• Genetic representationGenetic representation
– Let’s search for collection of jointsLet’s search for collection of joints
– Let’s not search for n * 30 * 20 unknown joint torquesLet’s not search for n * 30 * 20 unknown joint torques
– Instead, search for n equations that are logical combinations of Instead, search for n equations that are logical combinations of virtual sensors of creature statevirtual sensors of creature state
– These equations are reused for all timestepsThese equations are reused for all timesteps
• Genetic operatorsGenetic operators
– Recombination and mutationRecombination and mutation
Inject user knowledgeInject user knowledge
• Objective function Objective function
• Genetic representationGenetic representation
– Let’s search for collection of jointsLet’s search for collection of joints
– Let’s not search for n * 30 * 20 unknown joint torquesLet’s not search for n * 30 * 20 unknown joint torques
– Instead, search for n equations that are logical combinations of Instead, search for n equations that are logical combinations of virtual sensors of creature statevirtual sensors of creature state
– These equations are reused for all timestepsThese equations are reused for all timesteps
• Genetic operatorsGenetic operators
– Recombination and mutationRecombination and mutation
Sensibility of GA for this problem
Motion principles described as heuristicsMotion principles described as heuristics• Minimize angular disturbances by swinging legs in opposite Minimize angular disturbances by swinging legs in opposite
directionsdirections
• Maximize balance by keeping center of mass above platform Maximize balance by keeping center of mass above platform of supportof support
• Kinematics of arm are similar to kinematics of legKinematics of arm are similar to kinematics of leg
So let’s find those heuristics and permit them to So let’s find those heuristics and permit them to be shared across limbsbe shared across limbs
Motion principles described as heuristicsMotion principles described as heuristics• Minimize angular disturbances by swinging legs in opposite Minimize angular disturbances by swinging legs in opposite
directionsdirections
• Maximize balance by keeping center of mass above platform Maximize balance by keeping center of mass above platform of supportof support
• Kinematics of arm are similar to kinematics of legKinematics of arm are similar to kinematics of leg
So let’s find those heuristics and permit them to So let’s find those heuristics and permit them to be shared across limbsbe shared across limbs
Related work
Ngo and Marks – Spacetime Constraints Revisited Ngo and Marks – Spacetime Constraints Revisited (SIGGRAPH 88)(SIGGRAPH 88)
van de Panne and Fiume – Sensor-actuator van de Panne and Fiume – Sensor-actuator Networks (SIGGRAPH 93)Networks (SIGGRAPH 93)
Dr. P’s L-system trees –Dr. P’s L-system trees – published everywhere published everywhere
Ngo and Marks – Spacetime Constraints Revisited Ngo and Marks – Spacetime Constraints Revisited (SIGGRAPH 88)(SIGGRAPH 88)
van de Panne and Fiume – Sensor-actuator van de Panne and Fiume – Sensor-actuator Networks (SIGGRAPH 93)Networks (SIGGRAPH 93)
Dr. P’s L-system trees –Dr. P’s L-system trees – published everywhere published everywhere
Juan Buhler
Genetic Algorithms
• [Start] Generate random population of n suitable solutions for the problem
• [Fitness] Evaluate the fitness of each solution in the population by running physical simulation
• [New population] Create a new population• [Replace] Replace current population with newly
generated population • [Test] If the end condition is satisfied, stop, and
return the best
• [Start] Generate random population of n suitable solutions for the problem
• [Fitness] Evaluate the fitness of each solution in the population by running physical simulation
• [New population] Create a new population• [Replace] Replace current population with newly
generated population • [Test] If the end condition is satisfied, stop, and
return the best
Create a new populationCreate a new population
• [Selection][Selection] Select two parents solutions according to their Select two parents solutions according to their fitnessfitness
• [Recombination][Recombination] Combine parents to form offspring Combine parents to form offspring
• [Mutation][Mutation] Potentially new offspring at each position Potentially new offspring at each position
Create a new populationCreate a new population
• [Selection][Selection] Select two parents solutions according to their Select two parents solutions according to their fitnessfitness
• [Recombination][Recombination] Combine parents to form offspring Combine parents to form offspring
• [Mutation][Mutation] Potentially new offspring at each position Potentially new offspring at each position
Genetic Algorithms
Application of Genetic Algorithm
• Objective function Objective function
• Genetic representationGenetic representation
• Genetic operatorsGenetic operators
• Objective function Objective function
• Genetic representationGenetic representation
• Genetic operatorsGenetic operators
Objective Function
• To create realistic looking and acting To create realistic looking and acting creaturescreatures
• Fitness functions used to help evaluate if Fitness functions used to help evaluate if the objective function is satisfiedthe objective function is satisfied
• To create realistic looking and acting To create realistic looking and acting creaturescreatures
• Fitness functions used to help evaluate if Fitness functions used to help evaluate if the objective function is satisfiedthe objective function is satisfied
Genetic Representation
Defined by creature morphology and neurologyDefined by creature morphology and neurology
Morphology:Morphology: “The form and structure of an “The form and structure of an organism or one of its parts”organism or one of its parts”
Neurology Neurology (Nervous system): “The system of (Nervous system): “The system of cells, tissues, and organs that regulates the cells, tissues, and organs that regulates the body's responses to internal and external body's responses to internal and external stimuli”stimuli”
Defined by creature morphology and neurologyDefined by creature morphology and neurology
Morphology:Morphology: “The form and structure of an “The form and structure of an organism or one of its parts”organism or one of its parts”
Neurology Neurology (Nervous system): “The system of (Nervous system): “The system of cells, tissues, and organs that regulates the cells, tissues, and organs that regulates the body's responses to internal and external body's responses to internal and external stimuli”stimuli”
Creature MorphologyCreature Morphology
Articulated three-dimension Articulated three-dimension rigid body partsrigid body parts
Represented as a directed Represented as a directed graph of nodes and graph of nodes and connectionsconnections
Each node describes one Each node describes one body partbody part
• Many parameters to a nodeMany parameters to a node
Articulated three-dimension Articulated three-dimension rigid body partsrigid body parts
Represented as a directed Represented as a directed graph of nodes and graph of nodes and connectionsconnections
Each node describes one Each node describes one body partbody part
• Many parameters to a nodeMany parameters to a node
Creature Neurology
Comprised of:Comprised of:
• Sensors Sensors
• NeuronsNeurons
• EffectorsEffectors
Comprised of:Comprised of:
• Sensors Sensors
• NeuronsNeurons
• EffectorsEffectors
SensorsSensors
Each sensor is at a different part of the bodyEach sensor is at a different part of the body
MeasureMeasure
• That body partThat body part
• The world relative to that body partThe world relative to that body part
Different types of sensorsDifferent types of sensors
• Joint angle sensorJoint angle sensor
• Contact sensorsContact sensors
• Photo sensorsPhoto sensors
Each sensor is at a different part of the bodyEach sensor is at a different part of the body
MeasureMeasure
• That body partThat body part
• The world relative to that body partThe world relative to that body part
Different types of sensorsDifferent types of sensors
• Joint angle sensorJoint angle sensor
• Contact sensorsContact sensors
• Photo sensorsPhoto sensors
NeuronsNeurons
Virtual brain: Function based on sensor input Virtual brain: Function based on sensor input
Provides output effector valuesProvides output effector values
Virtual brain: Function based on sensor input Virtual brain: Function based on sensor input
Provides output effector valuesProvides output effector values
EffectorsEffectors
Each effector controls a degree of freedom in Each effector controls a degree of freedom in a jointa joint
Each effector’s value is applied as forces or Each effector’s value is applied as forces or torquestorques
Only exert simulated muscle forceOnly exert simulated muscle force
Connected to neuron or sensorConnected to neuron or sensor
Each effector controls a degree of freedom in Each effector controls a degree of freedom in a jointa joint
Each effector’s value is applied as forces or Each effector’s value is applied as forces or torquestorques
Only exert simulated muscle forceOnly exert simulated muscle force
Connected to neuron or sensorConnected to neuron or sensor
Neural SystemNeural System
Local neural system:Local neural system:
• Neural system generated along with morphological systemNeural system generated along with morphological system
• Connection allowed between local neural systemsConnection allowed between local neural systems
Global neural system:Global neural system:
• Neurons not associated with a specific nodeNeurons not associated with a specific node
– Useful heuristic for creating global timing mechanismsUseful heuristic for creating global timing mechanisms
• Can be connected with local neural systemsCan be connected with local neural systems
Local neural system:Local neural system:
• Neural system generated along with morphological systemNeural system generated along with morphological system
• Connection allowed between local neural systemsConnection allowed between local neural systems
Global neural system:Global neural system:
• Neurons not associated with a specific nodeNeurons not associated with a specific node
– Useful heuristic for creating global timing mechanismsUseful heuristic for creating global timing mechanisms
• Can be connected with local neural systemsCan be connected with local neural systems
Neural System
• Sum, product, divide, threshold, Sum, product, divide, threshold, >, sign, min, abs, if, interpolate, >, sign, min, abs, if, interpolate, sine, cosine, atan, log, exponent, sine, cosine, atan, log, exponent, sigmoid, integrate, differentiate, sigmoid, integrate, differentiate, smooth, memory, wave, sawtoothsmooth, memory, wave, sawtooth
• Sum, product, divide, threshold, Sum, product, divide, threshold, >, sign, min, abs, if, interpolate, >, sign, min, abs, if, interpolate, sine, cosine, atan, log, exponent, sine, cosine, atan, log, exponent, sigmoid, integrate, differentiate, sigmoid, integrate, differentiate, smooth, memory, wave, sawtoothsmooth, memory, wave, sawtooth
Physical Simulation
• Featherstone’s articulated body methodFeatherstone’s articulated body method
• Runge-Kutta-FehlbergRunge-Kutta-Fehlberg
– Adaptive timestep typically 1-5 steps per 1/30 secondAdaptive timestep typically 1-5 steps per 1/30 second
• Bounding boxes to reduce collision checksBounding boxes to reduce collision checks
– Connected pairs can interpenetrate but cannot rotate Connected pairs can interpenetrate but cannot rotate entirely through one anotherentirely through one another
• Impulses and springs used for collision correctionsImpulses and springs used for collision corrections
• Viscosity used for underwaterViscosity used for underwater
• Featherstone’s articulated body methodFeatherstone’s articulated body method
• Runge-Kutta-FehlbergRunge-Kutta-Fehlberg
– Adaptive timestep typically 1-5 steps per 1/30 secondAdaptive timestep typically 1-5 steps per 1/30 second
• Bounding boxes to reduce collision checksBounding boxes to reduce collision checks
– Connected pairs can interpenetrate but cannot rotate Connected pairs can interpenetrate but cannot rotate entirely through one anotherentirely through one another
• Impulses and springs used for collision correctionsImpulses and springs used for collision corrections
• Viscosity used for underwaterViscosity used for underwater
Genetic Operators: Mutation Alter internal node parameters
Dimensions- determine the physical shape of the partDimensions- determine the physical shape of the part
Joint type- number of DOF for each joint and movement Joint type- number of DOF for each joint and movement allowed for each DOFallowed for each DOF
Joint limits- point where spring forces will be exerted for Joint limits- point where spring forces will be exerted for each DOFeach DOF
Recursive limitRecursive limit
Set of local neuronsSet of local neurons
Set of connections to other nodesSet of connections to other nodes• Position, orientation, scale and reflection relative to parent Position, orientation, scale and reflection relative to parent
Dimensions- determine the physical shape of the partDimensions- determine the physical shape of the part
Joint type- number of DOF for each joint and movement Joint type- number of DOF for each joint and movement allowed for each DOFallowed for each DOF
Joint limits- point where spring forces will be exerted for Joint limits- point where spring forces will be exerted for each DOFeach DOF
Recursive limitRecursive limit
Set of local neuronsSet of local neurons
Set of connections to other nodesSet of connections to other nodes• Position, orientation, scale and reflection relative to parent Position, orientation, scale and reflection relative to parent
Genetic Operators: Mutation Add a new node at random
Leg Segment
BodySegment
Head Segment
Genetic Operators: MutationParameter of each connection can change
Leg Segment
BodySegment
9045
Genetic Operators: MutationAdd/remove connections
Leg Segment
BodySegment
Head Segment
Genetic Operators: Mutation Delete unconnected nodes
Leg Segment
BodySegment
Head Segment
Genetic Operators: Crossover
Genetic Operators: Grafting
StartStart
Generate random population of Generate random population of nn
suitable solutions for the problemsuitable solutions for the problem • Random generation of nodes and connectionsRandom generation of nodes and connections
• Use existing genotype to seed functionUse existing genotype to seed function
• Create genotype manually to seed functionCreate genotype manually to seed function
Generate random population of Generate random population of nn
suitable solutions for the problemsuitable solutions for the problem • Random generation of nodes and connectionsRandom generation of nodes and connections
• Use existing genotype to seed functionUse existing genotype to seed function
• Create genotype manually to seed functionCreate genotype manually to seed function
Fitness
Swimming, walking, jumping Swimming, walking, jumping • Distance traveled by COM/unit of timeDistance traveled by COM/unit of time
FollowingFollowing• Speed at which creature moves towards targetSpeed at which creature moves towards target
CompetitionCompetition• Pairs of individuals compete for control over a cubePairs of individuals compete for control over a cube• Final distance of the creature from cube and opponents Final distance of the creature from cube and opponents
final distance from cubefinal distance from cube
Swimming, walking, jumping Swimming, walking, jumping • Distance traveled by COM/unit of timeDistance traveled by COM/unit of time
FollowingFollowing• Speed at which creature moves towards targetSpeed at which creature moves towards target
CompetitionCompetition• Pairs of individuals compete for control over a cubePairs of individuals compete for control over a cube• Final distance of the creature from cube and opponents Final distance of the creature from cube and opponents
final distance from cubefinal distance from cube
New population
• Survival ratio: 1/5 of 300Survival ratio: 1/5 of 300
• 40% mutation, 30% crossover, 30% grafting40% mutation, 30% crossover, 30% grafting
• Children from crossover and grafting are Children from crossover and grafting are sometimes mutatedsometimes mutated
• Survival ratio: 1/5 of 300Survival ratio: 1/5 of 300
• 40% mutation, 30% crossover, 30% grafting40% mutation, 30% crossover, 30% grafting
• Children from crossover and grafting are Children from crossover and grafting are sometimes mutatedsometimes mutated
ResultsResults
Different runs converged on characters with Different runs converged on characters with different evolved characteristicsdifferent evolved characteristics
Specify a User Preference using the AlgorithmSpecify a User Preference using the Algorithm
• User can specify a preference over multiple runs of the User can specify a preference over multiple runs of the simulationsimulation
• User can perform the natural selectionUser can perform the natural selection
Different runs converged on characters with Different runs converged on characters with different evolved characteristicsdifferent evolved characteristics
Specify a User Preference using the AlgorithmSpecify a User Preference using the Algorithm
• User can specify a preference over multiple runs of the User can specify a preference over multiple runs of the simulationsimulation
• User can perform the natural selectionUser can perform the natural selection
Results
VideoVideoVideoVideo
AdvantagesAdvantages
Generate characters without specification or Generate characters without specification or knowledge about exactly how they workknowledge about exactly how they work
Less likely to get stuck on a local solution Less likely to get stuck on a local solution since we are searching on an encodingsince we are searching on an encoding
Easy to parallelizeEasy to parallelize
Generate characters without specification or Generate characters without specification or knowledge about exactly how they workknowledge about exactly how they work
Less likely to get stuck on a local solution Less likely to get stuck on a local solution since we are searching on an encodingsince we are searching on an encoding
Easy to parallelizeEasy to parallelize
DisadvantagesDisadvantages
The characters could produce incorrect behavior that The characters could produce incorrect behavior that could go undetected because of the lack of could go undetected because of the lack of understanding of the underlying algorithmunderstanding of the underlying algorithm
Process is not very reusableProcess is not very reusable
• Can reuse some of the components of the implementation, for Can reuse some of the components of the implementation, for example, the neuron languageexample, the neuron language
Genetic Algorithms sometimes require a lot of Genetic Algorithms sometimes require a lot of tweaking to work righttweaking to work right
The characters could produce incorrect behavior that The characters could produce incorrect behavior that could go undetected because of the lack of could go undetected because of the lack of understanding of the underlying algorithmunderstanding of the underlying algorithm
Process is not very reusableProcess is not very reusable
• Can reuse some of the components of the implementation, for Can reuse some of the components of the implementation, for example, the neuron languageexample, the neuron language
Genetic Algorithms sometimes require a lot of Genetic Algorithms sometimes require a lot of tweaking to work righttweaking to work right
DisadvantagesDisadvantages
Difficult to obtain ideal size for the neuron language, Difficult to obtain ideal size for the neuron language, node types and parameters (joint types and node types and parameters (joint types and parameters and connection parameters), sensor parameters and connection parameters), sensor and effector types and effector types
i.e. Difficult to obtain best size for the search spacei.e. Difficult to obtain best size for the search space • If the size is too small, then there aren't enough variations in the If the size is too small, then there aren't enough variations in the
populationpopulation
• If the size is too large, then changes in isolated parts of the If the size is too large, then changes in isolated parts of the creature do not have a big effect on the behavior or structurecreature do not have a big effect on the behavior or structure
Difficult to obtain ideal size for the neuron language, Difficult to obtain ideal size for the neuron language, node types and parameters (joint types and node types and parameters (joint types and parameters and connection parameters), sensor parameters and connection parameters), sensor and effector types and effector types
i.e. Difficult to obtain best size for the search spacei.e. Difficult to obtain best size for the search space • If the size is too small, then there aren't enough variations in the If the size is too small, then there aren't enough variations in the
populationpopulation
• If the size is too large, then changes in isolated parts of the If the size is too large, then changes in isolated parts of the creature do not have a big effect on the behavior or structurecreature do not have a big effect on the behavior or structure
Additional References
http://www.genetic-programming.com/http://www.genetic-programming.com/
http://lancet.mit.edu/~mbwall/presentations/http://lancet.mit.edu/~mbwall/presentations/IntroToGAs/IntroToGAs/
http://cs.felk.cvut.cz/~xobitko/ga/http://cs.felk.cvut.cz/~xobitko/ga/
http://www.genetic-programming.com/http://www.genetic-programming.com/
http://lancet.mit.edu/~mbwall/presentations/http://lancet.mit.edu/~mbwall/presentations/IntroToGAs/IntroToGAs/
http://cs.felk.cvut.cz/~xobitko/ga/http://cs.felk.cvut.cz/~xobitko/ga/