Physically-based Animation - Informatics Homepages...

Preview:

Citation preview

Physically-based Animation

Computer Animation and Visualisation

Lecture 10-11

Taku Komura

Overview • Particle System

– Modelling fuzzy objects – Modelling fire– Modelling liquid

• SPH• Visualization by implicit surface

– Modelling cloth, hair – Integration :

– Euler– Verlet integration– implicit integration,

– Rigid body dynamics by particle systems• Advanced character physics

Particle Systems• Modelling objects by a

number of small particles • We can model fuzzy

objects such as – fire, – fireworks– clouds, – smoke, – water, etc.

But we can also model

cloth

hair

rigid objects

Modelling fuzzy objects with particle system

• Initially developed by Reeves to create scenes for Star Trek II.

http://www.youtube.com/watch?v=13b7TSiidaM&feature=channel_page

Reeves ’83,’85

Particle Dynamics

• A particle's position in each succeeding frame can be computed by its velocity

• This can be modified by an acceleration force for more complex movements, e.g., gravity simulation.

Modelling Fire

- Define an emitter circle- The particles are launched in a random

direction within a predefined range

• number of particles generated :

Modelling Fire (2)

- Forces are added to the particles such that they move towards the goal position

- The goal is controlled randomly to add wobbling effect

goal[0][0] = 7*sin(rand()%360*PI/180);goal[0][2] = 7*cos(rand()%360*PI/180);goal[0][1] = getRandomValue(25,5);

https://www.youtube.com/watch?v=7LbtpmFSKF4&list=UU0ITEfzrLiblxtsImEfE08w&index=3

Modelling Fire (3)

- The color is adjusted such that they are bright when close to the centre and darker when farther away

http://www.youtube.com/watch?NR=1&feature=endscreen&v=gS_koVukVzE

Advantages of simulating fuzzy objects by particle systems

• Complex systems can be created with little human effort.

• The level of detail can be easily adjusted.– If a particle system object is in the distance, then it

can be modelled to low detail (few particles) – If it is close to the camera, then it can be modelled

in high detail (many particles)

Level-of-Detail

– A particle in low resolution can correspond to a set of particles in high resolution

– The position and velocity of the particle in low resolution becomes the means of the positions and velocities of the high resolution set

Fluid Simulation

– Simulating things like • Water, • Air flow

Fluid Simulation (2)

– Two approaches • Lagrangian (today)

– Particle-based method– i.e. SPH

• Eulerian– Uniform grid, vector field – i.e. Stable Fluids

Smoothed-particle hydrodynamics (SPH)

● A Lagrangian method developed for initially for astrophysical problems. ● Modelling the fluid by a set of particles● The particles have a spatial distance over which properties are smoothed by a kernel function https://www.youtube.com/watch?v=POnmzzhc5E0

SPH Kernel Function

●The particle properties are smoothed by a kernel function to simulate the continuous nature of fluid by finite set of particles

SPH Kernel Function

●The value of the kernel function at the position of particle j whose center is at particle I is computed by

j

i● The kernel function must integrate to 1

SPH Kernel Function

●Kernel function: Should be close to a Gaussian function● Better have a finite support●Also polynomial function is preferred

●Example:

SPH Kernel Attributes

●Properties of the fluid are interpolated using the kernel function

●Density

Mass of particle j i

j

SPH Kernel Attributes

●Properties such as velocity, pressure are computed by the following function

Kernel functioni

j

SPH Kernel Attributes (2)

● The spatial derivatives can be easily computed by deriving the kernel function

i

j

Pressure

For liquid, the pressure is modelled such that they are cohesive when the particles are far, and repulsive when close

Pressure (2)

Pressure force(with some modification to work well)

Using the kernel function

Particle acceleration due to pressure differences

Viscosity Force

Acceleration due to friction forces between particles with difference velocities

vj vi

Navier Stokes Equation (Lagrangian)

Other forces:

Gravity, surface tension, etc.

SPH Algorithm

Rendering liquid

• Two ways can be considered– rendering individual particles, or – rendering the surface of the entire liquid

• Rendering individual particles works well for modelling waterfalls or spray

• A surface rendering will give a more accurate description but is generally much slower

http://www.youtube.com/watch?v=n5lOjME8B6M http://www.youtube.com/watch?v=isXNkTiiAYQ

Rendering Liquid by Blobs (metaballs)

• Create an implicit function similar to the electron density maps

• We can define the surface where F(x,y,z)=0 Blinn ‘92

Cloth Simulation

• Need to generate animations of cloth of the characters appearing in the games

• Can use particles for this purpose

Cloth • We model the cloth by mass-spring

models (particles connected with springs)– Mass pulled by the interconnecting

springs

Hair

• Linear set of particles• Length structural force• Deformation forces proportional to the

angle between segments

http://www.youtube.com/watch?v=gj2UdZ-G0vg&feature=related

Integration for Simulation Euler Method

• h : time step

• M : mass matrix,

• fo : external force

• pos, vel of particles

Problem with Euler Method

• When the time step is too large, the system can blow up (diverge) very quickly

Verlet integration (Jakobsen ’02)

Directly computing the next position from the acceleration

• x : current position

• x’ : updated position

• x*: The position in the previous step

• Δ t : time step,

• a : acceleration

• Used intensely when simulating molecular dynamics. It is quite stable since the velocity is implicitly given

• Directly computing the next location from the current acceleration

x'=2x−x+aΔt2

x=x

*

*

Implicit Integration (Baraff ’98)

• Very stable

• Assuming the force in the next time step also results in the velocity increment at this time step

• Original Euler

(ΔxΔv )=Δt( v0

M−1 f (x0 ,v0 ))

Implicit Integration (Baraff ’98)

• Very stable

• Assuming the force in the next time step also results in the velocity increment at this time step

• Implicit Integration

(ΔxΔv )=Δt( v0+Δv

M−1 f ( x0+Δx,v0+Δv ))

Implicit Integration (Baraff ’98)

• Very stable

• Assuming the force in the next time step also results in the velocity increment at this time step

• Need to calculate that satisfies this equation

(ΔxΔv )=Δt( v0+Δv

M−1 f ( x0+Δx,v0+Δv ))

Taylor series expansion of the force

• Substituting this into the last equation, we get

Finally, computing the velocity update

• Substituting

We can finally compute by

Advantages

• We can update by using large time steps ( )

• Do not have to worry about blowing off

• The motions can be smoothened too much

Drawbacks

Advanced Character Physics (ACP):Multibody dynamics by particle system

Jakobsen, GDC `02

• Simulating articulated objects such as human bodies, robotic arms, cars by particle systems

• easy to implement• But slow when the particle number is very

large

ACP: How does it work?• Model rigid bodies by a collection of particles• Assume the distance between the particles will

remain the same if they belong to the rigid body• Each particle will move based on the free particle

dynamics• The 3D position will be modified according to the

distance constraints

ACP: Keeping the distance between the particles the same

• The two particles are simply translated along the line connecting them offline

• The traveling distance is inverse proportional to the mass

Algorithm1. Move the particles as free particles by physics

- Verlet integration 2. For each bone

Move each particle inverse proportional to their mass (as explained in last page)

3. Repeat 2 a few times until all the distance constraints are satisfied

4. Go back to 1

ACP: Modeling joints

It is possible to connect multiple rigid bodies by hinges, pin joints, and so on. Simply let two rigid bodies share a particle, and they will be connected by a pin joint. Share two particles, and they are connected by a hinge.

A 3DOF pin joint (left) and 1DOF hinge

joint (right)

ACP: Setting joint limits

• A method for restraining angles is to satisfy a dot product constraint

• Insert a virtual bone between the mass points temporarily

ACP: Modeling Characters • We can model human characters by this

system• Used for ragdoll physics in Hitman • http://www.teknikus.dk/tj/gdc2001.htm• Can apply for inverse kinematics

Figure 9. The particle/stick configuration used in Hitman for representing the human anatomy

ACP: Collision detection

• The collision detection will be done based on the points and the surfaces

• The colliding particle will be pushed out from the penetrating area

• The velocity term of the colliding particle perpendicular to the surface will be reduced to zero

How to resolve collisions?

• Find the closest face among all the faces• Move the particle in the direction of the

normal vector of the closest face

ACP: Friction Force• According to the Coulomb friction model,

friction force depends on the size of the normal force between the objects in contact.

• The penetration depth dp can be first measured when a penetration has occured (before projecting the penetration point out of the obstacle),

• and then, the tangential velocity vt is then reduced by an amount proportional to dp (the proportion factor being the friction constant).

Readings

• Blinn, “A Generalization of Algebraic Surface Drawing” ACM Transactions on Graphics, 1982

• Baraff and Witkin, “Large Steps in Cloth Simulation”, SIGGRAPH 98• SPH Fluids in Computer Graphics, EG2014, STAR Report• Muller et al. Particle-Based Fluid Simulation for Interactive Applications,

SCA03

• Jakobsen, “Advanced Character Physics”, GDC02

• W. T. Reeves, "Particle Systems - A Technique for Modeling a Class of Fuzzy Objects", Computer Graphics, vol. 17, no. 3, pp 359-376, 1983.

W. T. Reeves, "Approximate and Probabilistic Algorithms for Shading and Rendering Structured Particle Systems", Computer Graphics, vol. 19, no. 3, pp 313-322, 1985.

Steele et al., “Modeling and rendering viscous liquids”, CAVW 2004Implementing Particle System to Simulate Fire and Water Effects

Recommended