Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

29
Chenney/Forsyth Paper Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416

Transcript of Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Page 1: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Chenney/Forsyth PaperChenney/Forsyth PaperChenney/Forsyth PaperChenney/Forsyth Paper

Chenney & Forsyth, 2000

AICS 416

Page 2: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Basic goal

To generate animations that both natural To generate animations that both natural and satisfy other goalsand satisfy other goalsTo generate animations that both natural To generate animations that both natural and satisfy other goalsand satisfy other goals

Page 3: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Animations

Physical simulationsPhysical simulations• A vector describes “state” of the worldA vector describes “state” of the world

• Transition from one state vector to another according Transition from one state vector to another according to laws of physicsto laws of physics

– ppt+1t+1 = p = ptt + v + vtt * dt * dt

– vvt+1t+1 = v = vtt + a + att * dt * dt

– aatt = f = ftt / m / m

– fftt = func (p = func (ptt, v, vtt))

Physical simulationsPhysical simulations• A vector describes “state” of the worldA vector describes “state” of the world

• Transition from one state vector to another according Transition from one state vector to another according to laws of physicsto laws of physics

– ppt+1t+1 = p = ptt + v + vtt * dt * dt

– vvt+1t+1 = v = vtt + a + att * dt * dt

– aatt = f = ftt / m / m

– fftt = func (p = func (ptt, v, vtt))

Given (f0, v0, p0) this is aninitial value problem and iseasily simulated/animated

Page 4: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Animations

Forward simulationsForward simulations

• Guarantee realismGuarantee realism

– Explicitly follow rules of worldExplicitly follow rules of world

Forward simulationsForward simulations

• Guarantee realismGuarantee realism

– Explicitly follow rules of worldExplicitly follow rules of world

Page 5: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Animations

Inverse simulation much harderInverse simulation much harder

• Given (pGiven (ptt, v, vtt) what is f) what is ft-1t-1

• I see the ball here, but how did it get here?I see the ball here, but how did it get here?

Inverse simulation much harderInverse simulation much harder

• Given (pGiven (ptt, v, vtt) what is f) what is ft-1t-1

• I see the ball here, but how did it get here?I see the ball here, but how did it get here?

Page 6: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Likelihood of an animation

ppww (A) (A) = probability ball bounce animation = probability ball bounce animation

A is observed in A is observed in world, wworld, w

• A ball bounces on flat table A ball bounces on flat table ii times with times with

– normal vector controlling bouncenormal vector controlling bounce

– Gaussian (mean at 0Gaussian (mean at 0ºº, std. dev. 10 deg, std. dev. 10 degº)º)

ppww (A) (A) = probability ball bounce animation = probability ball bounce animation

A is observed in A is observed in world, wworld, w

• A ball bounces on flat table A ball bounces on flat table ii times with times with

– normal vector controlling bouncenormal vector controlling bounce

– Gaussian (mean at 0Gaussian (mean at 0ºº, std. dev. 10 deg, std. dev. 10 degº)º)

Omitting normalization constant,

Page 7: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Constraints

We want We want ppww(A | C)(A | C)

• ExamplesExamples

We want We want ppww(A | C)(A | C)

• ExamplesExamples

• The ball must start here and land thereThe ball must start here and land there

• The ball must go through this pointThe ball must go through this point

• The initial acceleration must be fooThe initial acceleration must be foo

• The ball must start here and land thereThe ball must start here and land there

• The ball must go through this pointThe ball must go through this point

• The initial acceleration must be fooThe initial acceleration must be foo

Page 8: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Constraints

Force the constraints to be trueForce the constraints to be trueForce the constraints to be trueForce the constraints to be true

Page 9: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Bayes’ Rule

A = an animation is naturalA = an animation is natural

C = an animation satisfies constraintsC = an animation satisfies constraints

• Chenney ignores denominator because it is the same for all Chenney ignores denominator because it is the same for all animations and washes outanimations and washes out

• P(C|A) becomes a new function PP(C|A) becomes a new function Pcc(A)(A)

• P(A|C) becomes P(A)… prob of satisfying A and CP(A|C) becomes P(A)… prob of satisfying A and C

A = an animation is naturalA = an animation is natural

C = an animation satisfies constraintsC = an animation satisfies constraints

• Chenney ignores denominator because it is the same for all Chenney ignores denominator because it is the same for all animations and washes outanimations and washes out

• P(C|A) becomes a new function PP(C|A) becomes a new function Pcc(A)(A)

• P(A|C) becomes P(A)… prob of satisfying A and CP(A|C) becomes P(A)… prob of satisfying A and C

Page 10: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

How do we compute P(A|C)

Could generate lots of examples…Could generate lots of examples…

• Select those that satisfy CSelect those that satisfy C

• In all those that satisfy C, how likely is AIn all those that satisfy C, how likely is A

Generates many useless examples of Generates many useless examples of bouncing ball that do not satisfy Cbouncing ball that do not satisfy C

Could generate lots of examples…Could generate lots of examples…

• Select those that satisfy CSelect those that satisfy C

• In all those that satisfy C, how likely is AIn all those that satisfy C, how likely is A

Generates many useless examples of Generates many useless examples of bouncing ball that do not satisfy Cbouncing ball that do not satisfy C

Rejection Sampling

Page 11: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

How do we compute

Generate any example animation, AGenerate any example animation, A

• Evaluate how likely is it in the real worldEvaluate how likely is it in the real world

• Evaluate how well it satisfies the (soft) constraintsEvaluate how well it satisfies the (soft) constraints

Generate any example animation, AGenerate any example animation, A

• Evaluate how likely is it in the real worldEvaluate how likely is it in the real world

• Evaluate how well it satisfies the (soft) constraintsEvaluate how well it satisfies the (soft) constraints

Page 12: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Ball example

ppww(A)(A)

ppcc(A)(A)

ppww(A)(A)

ppcc(A)(A)

Gaussian function definedon final position of ball, d

Page 13: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

We’re onto something here

Our goal is to find animations that are likely and satisfy constraints

• Animations with high P(A|C)Animations with high P(A|C)

Because it’s hard to find animations that satisfy constraints exactly, we’ll be satisfied with animations that are likely and come close to satisfying constraints

• Animations with high P(A)PAnimations with high P(A)Pcc(A)(A)

Animations with high P(A)PAnimations with high P(A)Pcc(A) are likely to (A) are likely to

also have high P(A|C) so let’s search…also have high P(A|C) so let’s search…

Our goal is to find animations that are likely and satisfy constraints

• Animations with high P(A|C)Animations with high P(A|C)

Because it’s hard to find animations that satisfy constraints exactly, we’ll be satisfied with animations that are likely and come close to satisfying constraints

• Animations with high P(A)PAnimations with high P(A)Pcc(A)(A)

Animations with high P(A)PAnimations with high P(A)Pcc(A) are likely to (A) are likely to

also have high P(A|C) so let’s search…also have high P(A|C) so let’s search…

Page 14: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Searching for likely candidates

SamplingSampling

• Given an animation, A, how “good” is itGiven an animation, A, how “good” is it

• Could a simple change to A make it better?Could a simple change to A make it better?

SamplingSampling

• Given an animation, A, how “good” is itGiven an animation, A, how “good” is it

• Could a simple change to A make it better?Could a simple change to A make it better?

Page 15: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Markov Chain Monte Carlo

Markov chainMarkov chain• Given a sequence of events, the present state is only Given a sequence of events, the present state is only

dependent on the preceding state and independent of dependent on the preceding state and independent of the previous statesthe previous states

– Only the present influences the futureOnly the present influences the future

– The past doesn’t influence the futureThe past doesn’t influence the future

Monte CarloMonte Carlo• Using random numbers to solve a problemUsing random numbers to solve a problem

Markov chainMarkov chain• Given a sequence of events, the present state is only Given a sequence of events, the present state is only

dependent on the preceding state and independent of dependent on the preceding state and independent of the previous statesthe previous states

– Only the present influences the futureOnly the present influences the future

– The past doesn’t influence the futureThe past doesn’t influence the future

Monte CarloMonte Carlo• Using random numbers to solve a problemUsing random numbers to solve a problem

Page 16: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

MCMC Algorithm

Compute p(A0)

Use markov model to perturbdegree-of-freedom values from Ai

Compute p(Ac)

Page 17: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

MCMC Algorithm

How likely is proposal of Ai

given Ac

How likely is proposal of Ac

given Ai

Page 18: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Ball example

Transition probability, qTransition probability, q

• First term = prob of choosing particular set of degrees First term = prob of choosing particular set of degrees of freedom to change of freedom to change

• Second term = prob of choosing any particular value Second term = prob of choosing any particular value for a degree of freedom for a degree of freedom

Transition probability, qTransition probability, q

• First term = prob of choosing particular set of degrees First term = prob of choosing particular set of degrees of freedom to change of freedom to change

• Second term = prob of choosing any particular value Second term = prob of choosing any particular value for a degree of freedom for a degree of freedom

n ball bounces, k were changed

10 values for normal (+/- 5)

Page 19: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

MCMC Algorithm

Key componentKey component

• propose (Apropose (Acc, A, Aii))

– ““designed through intuitive reasoning and designed through intuitive reasoning and experimentation”experimentation”

– ““use past experience as a guide”use past experience as a guide”

Key componentKey component

• propose (Apropose (Acc, A, Aii))

– ““designed through intuitive reasoning and designed through intuitive reasoning and experimentation”experimentation”

– ““use past experience as a guide”use past experience as a guide”

Page 20: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

MCMC Algorithm

Provable feature of algorithmProvable feature of algorithm

• As iAs i inf, samples are true reflection of probability inf, samples are true reflection of probability distribution of modeldistribution of model

• Sampling animation from the set of samples produces Sampling animation from the set of samples produces well-understood plausibilitywell-understood plausibility

Provable feature of algorithmProvable feature of algorithm

• As iAs i inf, samples are true reflection of probability inf, samples are true reflection of probability distribution of modeldistribution of model

• Sampling animation from the set of samples produces Sampling animation from the set of samples produces well-understood plausibilitywell-understood plausibility

Page 21: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

2D Ball

Solving for ballSolving for ball

Keep p(A) small, take the logKeep p(A) small, take the log

Solving for ballSolving for ball

Keep p(A) small, take the logKeep p(A) small, take the log

Page 22: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

2D Ball

Lesson learned about standard devLesson learned about standard dev too small too small most animations are improbable most animations are improbable

because they don’t land in correct placebecause they don’t land in correct place

too large too large most animations are probable because most animations are probable because they land within landing region but they miss the they land within landing region but they miss the exact spotexact spot

Tuning probability function, p(A) is trickyTuning probability function, p(A) is tricky

Lesson learned about standard devLesson learned about standard dev too small too small most animations are improbable most animations are improbable

because they don’t land in correct placebecause they don’t land in correct place

too large too large most animations are probable because most animations are probable because they land within landing region but they miss the they land within landing region but they miss the exact spotexact spot

Tuning probability function, p(A) is trickyTuning probability function, p(A) is tricky

Page 23: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Bowling

Degrees of freedomDegrees of freedom• Ball (diameter, initial position, initial velocity, initial angular Ball (diameter, initial position, initial velocity, initial angular

velocity)velocity)

• Pin (initial position)Pin (initial position)

ConstraintsConstraints• Initial pins up, final pins downInitial pins up, final pins down

• Gibb’s DistributionGibb’s Distribution

Lesson learnedLesson learned• If constraints are too strict, iterative perturbations will not If constraints are too strict, iterative perturbations will not

frequently “jump” from one legal animation to another frequently “jump” from one legal animation to another

Degrees of freedomDegrees of freedom• Ball (diameter, initial position, initial velocity, initial angular Ball (diameter, initial position, initial velocity, initial angular

velocity)velocity)

• Pin (initial position)Pin (initial position)

ConstraintsConstraints• Initial pins up, final pins downInitial pins up, final pins down

• Gibb’s DistributionGibb’s Distribution

Lesson learnedLesson learned• If constraints are too strict, iterative perturbations will not If constraints are too strict, iterative perturbations will not

frequently “jump” from one legal animation to another frequently “jump” from one legal animation to another

Correctly up/down

Haven’t moved much

Page 24: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Rolling Dice

Normal function (for tabletop)Normal function (for tabletop)

• Example from bouncing ball won’t workExample from bouncing ball won’t work

– Nearby points should have similar normals (not Nearby points should have similar normals (not independent)independent)

– Object bouncing in same place should use same normal Object bouncing in same place should use same normal each timeeach time

• Create “surface” using b-splinesCreate “surface” using b-splines

– Degrees of freedom are control point heights, initial posDegrees of freedom are control point heights, initial pos

– Also use restitution and friction values at control pointsAlso use restitution and friction values at control points

Normal function (for tabletop)Normal function (for tabletop)

• Example from bouncing ball won’t workExample from bouncing ball won’t work

– Nearby points should have similar normals (not Nearby points should have similar normals (not independent)independent)

– Object bouncing in same place should use same normal Object bouncing in same place should use same normal each timeeach time

• Create “surface” using b-splinesCreate “surface” using b-splines

– Degrees of freedom are control point heights, initial posDegrees of freedom are control point heights, initial pos

– Also use restitution and friction values at control pointsAlso use restitution and friction values at control points

Page 25: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Rolling Dice

Lessons learnedLessons learned

• Creating a good proposal algorithm is difficultCreating a good proposal algorithm is difficult

• Algorithm finds first constraint satisfying animation (in Algorithm finds first constraint satisfying animation (in one hour) and has hard time jumping to another one hour) and has hard time jumping to another satisfying animation (“many” hours)satisfying animation (“many” hours)

Lessons learnedLessons learned

• Creating a good proposal algorithm is difficultCreating a good proposal algorithm is difficult

• Algorithm finds first constraint satisfying animation (in Algorithm finds first constraint satisfying animation (in one hour) and has hard time jumping to another one hour) and has hard time jumping to another satisfying animation (“many” hours)satisfying animation (“many” hours)

Page 26: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Rolling Dice

ConstraintsConstraints

• Any position/orientation at any timeAny position/orientation at any time

ConstraintsConstraints

• Any position/orientation at any timeAny position/orientation at any time

Page 27: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Review

What’s easy about this?What’s easy about this?

• Getting a simulationGetting a simulation

• Selecting some degrees of freedomSelecting some degrees of freedom

• Building the MCMC algorithmBuilding the MCMC algorithm

What’s easy about this?What’s easy about this?

• Getting a simulationGetting a simulation

• Selecting some degrees of freedomSelecting some degrees of freedom

• Building the MCMC algorithmBuilding the MCMC algorithm

Page 28: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Review

What’s difficult?What’s difficult?

• Building p(A|C) functionBuilding p(A|C) function

– Tuning bouncing ball standard deviationTuning bouncing ball standard deviation

– Authors used Gibbs distribution function to assistAuthors used Gibbs distribution function to assist

• Building proposal functionBuilding proposal function

– Dice example had simple proposal algorithmDice example had simple proposal algorithm

What’s difficult?What’s difficult?

• Building p(A|C) functionBuilding p(A|C) function

– Tuning bouncing ball standard deviationTuning bouncing ball standard deviation

– Authors used Gibbs distribution function to assistAuthors used Gibbs distribution function to assist

• Building proposal functionBuilding proposal function

– Dice example had simple proposal algorithmDice example had simple proposal algorithm

Page 29: Chenney/Forsyth Paper Chenney & Forsyth, 2000 AI CS 416.

Review

What’s difficultWhat’s difficult

• This is a search problemThis is a search problem

– Global vs. local searchGlobal vs. local search

– Requires infinite samples to be perfectRequires infinite samples to be perfect

² Simulation time and search space size are Simulation time and search space size are realistic constraints on feasibilityrealistic constraints on feasibility

What’s difficultWhat’s difficult

• This is a search problemThis is a search problem

– Global vs. local searchGlobal vs. local search

– Requires infinite samples to be perfectRequires infinite samples to be perfect

² Simulation time and search space size are Simulation time and search space size are realistic constraints on feasibilityrealistic constraints on feasibility