Lien de la note Hackmd
Animation in Computer Graphics
2 main ways to describe animation
- Kinematics
- Dynamics
Ways to genre animation
- Descriptive animation
- Motion tracking
- Procedural generation
- Physically based simulation
- Leaning-based synthesis
Descriptive Animation
The artist/an algorithm fully describes the motion and deformation
Pros | Cons |
---|---|
Full control on the result | May introduce un-physical effects |
History of CG Animation
First production of animated films (Disney)
Principle
- Animator in chief: create key frames
- Assistants: fill the in between (secondary drawings)
Key framing in CG
- Create manually a set of key frames
- Interpolate positions
Production pipeline: Interpolate position
- Given a set of key positions (pos + time), we want to find an interpolating space-time curve
- Input:
Linear Interpolation
Pros | Cons |
---|---|
Simple | Non smooth trajectory |
Constant speed between keyframes | Generates straight segments |
Smooth curve
- polynomial basis function of degree
Which polynomial/degree choose ?
Lagrange polynomial interpolation
Interpolate all points at once
Degree of polynomial:
Comparison
En pratique, on n’utilise jamais cette interpolation
Spline
Idea
- Define each part a polynomial
- Smooth junctions between them
How to choose the polynomial
- Sufficiently high degree to be smooth
- Sufficiently low degree to avoid oscillations
In Graphics, cubic polynomials are often used
Allow up to junctions
Hermite interpolation
Cubic curve interpolationg points and derivatives at extermities
Interpolating curve
Initial problem: set of multiple keyframes position+time
2 solutions:
- Set explicitely derivatives for each keyframe - teadious
- Compute automatically plausible derivatives from surrounding samples - often used
Cardinal spline:
Set:
- curve tension
- is commonly used
- Catmull Rom Spline
Wrap-up algorithm
Compute as a cubic spline interpolation
- Given keyframes
- Given time
- find such that
- Compute and
- Compute
- with
Limitation of cubic curve interpolation
- Only , but not at junctions: curvature/acceleration discontinuity
- Non-constant peed along each polynomial
Curve editing
- Animation software (Maya, 3DSMax, Blender, etc) always come with a curve editor
- Artists can manually ajust their position, time, and derivatives on curve editor
- One curve for each scalar parameter
- position
- scaling
- rotation/quaternion
- One curve for each scalar parameter
- Can also use a wrapper function to change time
Usage of keyframes interpolation
Interpolate every vertex of multiple meshes
Multi-target blending
Interpolate between multiple key poses
Interesting for facial animation
Per-vertez formulation
Blend shapes
Physically-based simulation
When physically based simulation is needed
- Accurate dynamics
- Teadious to model by hand or procedurally
- Multiple interacting elements
- Complex animated geometry
Material model
- Elasticity
- Purely elastic models don’t loose energy when deformed
- Plasiticity
- Ductile material: can allow large amout of plastic deformation without breaking (plastic)
- Brittle - Opposite (glass)
- Viscosity
- Resistance to flow (usually for fluid, ex:honey)
In reality
- Elasto-plastic materials
- Allow elastic behavior for small deformation, and plastic at larger one
- Visco-elastic materials
- Elastic properties with delay
Rigid spheres
System modeling
Particles modeling the center of hard spheres
- Spheres can collide with surrounding obstacles
- Spheres can collide with each others
System: particles with position , speed , mass , modeling a sphere of radius
- initial conditions:
Forces:
Collision with a plane
Plane : parameterized using a point and its normal
- Sphere above plane:
- Sphere in collision:
1
2
3
4
5
6
for (int i = 0; i < N; ++i) {
float detection = dot(p[i]-a, n);
if (detection <= r[i]) {
// ... collision response
}
}
Collision response with plane
What should we do when a collision is detected ?
On decompose la vitesse selon 2 composantes: la tangente et la normale
Collision response = Update speed
Result
Applying collision response on speed only
Les boules tombent en-dessous du plan
Quand notre sphere rebondit, il est possible qu’une partie passe au travers du plan, donc on considere en collision, donc on inverse sa vitesse, donc en collision, etc
Comment on contre ca ?
Si ma sphere est dans le sol, on s’arrange pour qu’elle ne soit pas dans le sol On la “repousse” pour qu’elle soit en contact avec la surface
Collision response with a plane: position
Three possibilities:
- Correct position in projecting on the constraint
- Pros: simple to implement
- Cons: Physically incorrect position
- Approximate the correct position
- Go backward in time to find exact instant of collision
- Continuouse collision detectino
- Pros: physically correct
- Cons: Computationally heavy
Result
Ca marche !
Collision between speheres
Given 1 spheres
Collision when
What will happen with speeds ?
Notion of impulse
An impulse is the integrted force over time
Result in a sudden change of speed (momentum) in a discrete case
For a particle with a constant mass
2 spheres in collision
J’ecris pas ca vous etes fous
Summary
- Detect collision
- if collision (relative speed)
- Elastic collision (bouncing)
- If static contact (relative speed )
- Friction
- Avoids jittering
- Correct position (project on contact surface)
- : collision depth
- For small impacts, can use position based dynamics
Note on collision stack
Optimiser ne pas avoir a simuler les spheres sur le sol et immobiles
- Faire des graphes des solides et les traiter comme des solides rigides
Modeling elastic shapes with particles
Spring mass systems
- Particles: samples on shape
- Springs: link closed-by particles in the reference shape
Spring structure
How to model spring connectivity ?
- Structutal springs
- 1-ring neighbors springs ( mesh edges)
- Pros: limit elongation/contraction
- Cons: Allows shearing, and bending
- Add extra springs connectivity
- Shearing springs
- Diagonal links
- Bending springs
- 2-ring neighborhood
Cloth simulation
Mass-spring cloth simulation
- Particles are sampled on a grid
- Each particle has a mass
- Set structural, shearing and bending springs
Forces
- On each particle: gravity + drag + spring forces
- : neighborhood of particle
- : rest length of spring
Associated ODE