550 likes | 806 Views
Simulation and Animation. Soft Body Simulation. Motivation. Applications of Deformable Objects Entertainment Movies Pixar: Shrek, Nemo , The Incredibles … Computer games Virtual simulator Medicine Surgery, therapy, registration Computational science Buildings, bridges.
E N D
Simulation and Animation Soft Body Simulation
Motivation Applications of Deformable Objects • Entertainment • Movies • Pixar: Shrek, Nemo, The Incredibles… • Computer games • Virtual simulator • Medicine • Surgery, therapy, registration • Computational science • Buildings, bridges
Deformation Models • The first physically realistic model was introduced to computer graphics in 1987 • Mathematically deformation can be described as a time-varying vector valued function F(x, t) x is the material coordinate F is the world coordinate u is the displacement vector
Dynamic Simulations Lagrange Equation of Motion: External forces are in equilibrium with internal forces composed of elastic force, damping force and acceleration force. K : Stiffness C : Damping M : Mass
Mass-Spring systems Body is modeled by masses linearly linked by springs with freely rotation springs.
Mass-spring simulation • Spring Link • Edge = spring • Vertex = mass • Hooke´slaw • Scalar Spring stiffness D
Mass-spring simulation • Volume preservation • Introducevolumeforces • Scalar Volume stiffnessDv Fi Fv Fi Fi
Time Integration • Verlet Integration (per vertex) – explicit scheme • Easy & fast • Numericalaccuracyiscritical • Timestepshavetobesmall (explicit scheme) Fasteraccumulationofroundingerrors • Dampingnecessary
Positions Forces Algorithm Forever // Force calculation foreveryvertex calculateforce endfor // Time integration foreveryvertex update position endfor endfor
Mass-Spring systems • Body is modeled by masses linearly linked by springs • Advantage: • Simple • Disadvantages: • Realistic physical properties difficult to model • Unstable Explicit Integration for stiff materials
Data structures • Howtostore per-vertexadjacencyinformation? • IncidentEdges • Calculationofvolumeforcesproblematic • Incidenttetrahedra • Calculationof spring andvolumeforces • Store tetrahedra (edges) directly(not onlyindicesinto a sharededge/tetrahedralist) • Memory consuming, but avoids additional dependencylevel • Disadvantages • Tetrahedraarestored multiple times • #Neighborsis not constant
Data structures (cont.) • Sort vertices according to their valence • Stack of textures thatgets smaller to the top • Reduces memory overhead • Further optimization • Early z-test
Force calculation forevery point p0 forevery tetrahedron t incident on p0 // via four texture fetches get center vertex coordinate p0 get corner indices i1-3, get element stiffness es get rest spring lengths l1-3, get rest volume v // via three dependent fetches get coordinates of p1-3 through i1-3 calculate force on p0 add to total force on p0 endfor endfor
Finite difference method FDM Remember FDM from CFD
CFD – Computational Fluid Dynamics • Discretization • Layout ofgridpoints on a grid • Locationofdiscretepointsacrossthedomain • Arbitrarygridscanbeemployed • Structured orunstructuredgrids • Implicitor explicit representationoftopology (adjacencyinformation) • Uniform grids: uniform spacingofgridpoints in x and y y Pij+1 Pi-1j+1 Pi+1j+1 y Pij Pi-1j Pi+1j y = x Pij-1 Pi-1j-1 Pi+1j-1 x x
CFD – Computational Fluid Dynamics • Finite differences • Approximate partial derivatives by finite differencesbetweenpoints • Derivedbyconsideringthe Taylor expansion
CFD – Computational Fluid Dynamics • Finite differences for higher order and mixed partial derivatives
CFD – Computational Fluid Dynamics • Differenceequations - example • The 2D waveequation Partial Differential Equation Discretization on a 2D CartesiangridsyieldsDifferenceEquation
FEM • FEM is a method used for finding approximate solution of partial differential equations (PDE) • Method: split the domain into a (possibly large) but finite number of elements (triangles, rectangles, tetrahedra, hexahedra, etc.) • Good for • complex domains (cars, planes, parts) • Dynamic domains (soft bodies, moving boundaries) • when the desired precision varies over the entire domain
FEM • Split into the domain into a finite number of elements • Define shape functions (Interpolations- funktionen) in elements (e.g. barycentric interpolation) • Approximate PDE solution between the sample points by the shape function with the sample points as variables. • Compute partial derivative based on interpolated solution
FEM • Multiply PDE with “test function” • Spacial Integration (over p) over partial derivatives within finite element • Result: element equation (not dependent on p anymore) • Combine element equations into a single global equation system (via shared sample points) • Solve this (possibly non linear) system
FEM vs. FDM • FDM is an approximation to the differential equation; the finite element method is an approximation to its solution. • FEM is its able to handle complex geometries (and boundaries), FDM in its basic form is restricted to handle rectangular shapes and simple alterations thereof • FDM can be very easy to implement. • FDM can be seen as a special case of the FEM approach • there are reasons to consider the mathematical foundation of the FEM more sound, for instance, because the quality of the approximation between grid points is poor in FDM. • The quality of a FEM approximation is often higher than in the corresponding FDM approach, but this is extremely problem dependent and several examples to the contrary can be provided
Mass-spring systems • Pros • Fast • No pre-process • GPU Implementation • Cons • Volume not considered • Physical laws violated! • Material Properties hard tochoose • Spring constants vs. elastic modulus • Stable simulation requires very small time steps • performance gets worse than expected • almost impossible for stiff material
Elasticity theory • : Total energy • u(x) : Displacement field • f(x) : External (surface) forces • g(x) : Volumetric forces (e.g. gravity) • (u) : Linearized notation strain tensor E • D : Material law (Hooke‘s law)
Elasticity theory: Terms • 2nd Term: (Distant) Volume Forcese.g. Gravity, Linear/Angular Momentum, magnetic/electric fields • 3rd Term: (Direct) Surface Forcese.g. push/pull, collision/contact
Now consider only the first part … Elastic Energy:
Elasticity theory cont. Strain (Dehnung) Tensor Edescribes elongations ofinfinitesimal small volumeelement along coordinates axes y Eyy Eyx Exy Eyz Ezy Exx x Exz Ezx Ezz z
Elasticity theory cont. Stress (Spannung) Tensor internal forces acting on coordinate planes y yy yx xy yz zy xx x xz zx zz z
Elasticity theory cont. Material Law • Strain Tensor E and Stress Tensor arecoupled via Hooke‘s law • , : Lamé coefficients “deformation” “elongation along axes”
Elasticity theory cont. Lamé coefficients • derived from elasticity modulus Emand Poisson‘s ratio (Querkontraktion)
Elastic Modulus Em… … is a measure of the stiffness of a given material, not of a given part.
Linearized Notation • E is a symmetric tensor using only upper triangular part is sufficient
Intuition: Elastic Energy • We haveyou can think if this integral as
Strain Formulations • Cauchy strain (linear, constant matrix) • BroNielsen ’96 • Corotated Cauchy strain (linear, dynamic matrix) • Rankin ’88, Müller ’02, Hauth ’04 • Green strain (non-linear, dynamic matrix)
Linear approximation of Strain • Cauchy Strain • ignores non linear part • looses rotational invariance
Linear approximation of Strain Linear vs. non-linear vs. co-rotational strain
Back to FEM So far: • considered continuous elasticity Now: • discretize to a finite number of cells/elements Remember: • We are looking primarily for u (displacement vector)
FEM Consider the continuous u as: • a set of supporting points (FEM vertices) • a continuum in between the supporting points generated from the interpolation of u at the supporting points big difference to finite differences here!!
Considering a single element Can use tetrahedron barycentric interpolation
Remember this slide? • Split into the domain into a finite number of elements • Define shape functions in elements • Approximate PDE solution between the sample points by the shape function with the sample points as variables. • Compute partial derivative based on interpolated solution