in Computer Graphics Jan Bender Miles Macklin Matthias Mller - - PowerPoint PPT Presentation

in computer graphics
SMART_READER_LITE
LIVE PREVIEW

in Computer Graphics Jan Bender Miles Macklin Matthias Mller - - PowerPoint PPT Presentation

T6: Position-Based Simulation Methods in Computer Graphics Jan Bender Miles Macklin Matthias Mller Jan Bender Organizer Professor at the Visual Computing Institute at Aachen University Research topics Rigid bodies,


slide-1
SLIDE 1

T6: Position-Based Simulation Methods in Computer Graphics

Jan Bender Miles Macklin Matthias Müller

slide-2
SLIDE 2

Jan Bender

  • Organizer
  • Professor at the Visual Computing Institute at Aachen University
  • Research topics

– Rigid bodies, deformable solids, fluids – Collision detection, fracture, real-time visualization – Position based methods

  • Maintains open source PBD code base

– github.com/InteractiveComputerGraphics/PositionBasedDynamics

slide-3
SLIDE 3

Miles Macklin

  • Principal engineer at NVIDIA
  • Inventor and author of FLEX

– Unified, particle based, position based solver, GPU accelerated – UE4 integration – developer.nvidia.com/flex

  • Research

– Position based fluids – Inventor of XPBD, making PBD truly physical with a simple trick!

slide-4
SLIDE 4

Matthias Müller

  • Leader of physics research group at NVIDIA
  • Co-initiator of PBD (with Thomas Jakobsen)
  • Co-founder of NovodeX which became physics group at NVIDIA
  • Research

– Co-rotational FEM, SPH – Position based methods: cloth, soft bodies, shape matching, oriented particles, air meshes

  • www.matthiasmueller.info
slide-5
SLIDE 5

Tutorial Outline

  • Matthias

– Motivation, Basic Idea – The solver – Constraint examples for solids – Solver accelerations

  • Miles

– Fluids – XPBD – Continuous materials – Rigid bodies

slide-6
SLIDE 6

Motivation

slide-7
SLIDE 7

Physical Simulations

  • Well studied problem

in the computational sciences (since 1940s)

  • Complement / replace real experiments
  • Extreme conditions, spatial scale, time scale
  • Accuracy most important factor
  • Low accuracy – useless result
slide-8
SLIDE 8

Computer Graphics

  • Early 1980s
  • Adopted methods: FEM, SPH, grid based fluids, ..
  • Applications

– Special effects in movies and commercials – Computer games – VR

  • Requirements

– Speed, stability, controllability – Only visual plausibility

  • New methods needed: e.g. PBD
slide-9
SLIDE 9

Funhouse

slide-10
SLIDE 10

Traditional Methods

  • Typically force based
  • Explicit integration

– Simple and fast – Only conditionally stable (bad for real time apps)

  • Implicit integration

– Expensive (multiple linearizations and solves per time step) – Numerical damping

slide-11
SLIDE 11

Basic Idea

slide-12
SLIDE 12

Force Based Update

  • Reaction lag
  • Small spring stiffness → squashy system
  • Large spring stiffness → stiff system, overshooting

penetration causes forces velocities change positions forces change velocities

slide-13
SLIDE 13

Position Based Update

  • Controlled position change
  • Only as much as needed → no overshooting
  • Velocity update needed to get 2nd order system!

penetration detection only move objects so that they do not penetrate update velocities!

slide-14
SLIDE 14

Position Based Integration

init x0, v0 x𝑜, v𝑜, p, u ∈ ℝ3𝑂 loop v𝑜 ← v𝑜 + ∆𝑢 ∙ f𝑓𝑦𝑢(x𝑜) velocity update p ← x𝑜 + ∆𝑢 ∙ v𝑜 prediction x𝑜+1 ← modify p position correction u ← (x𝑜+1 − x𝑜)/∆𝑢 velocity update v𝑜+1 ← modify u velocity correction end loop

slide-15
SLIDE 15

Position Correction

  • Example: Particle on circle

prediction correction new velocity

slide-16
SLIDE 16

Velocity Correction

  • External forces: v𝑜+1 = u + ∆𝑢 g

𝑛

  • Internal damping
  • Friction
  • Restitution

collision correction prediction restitution friction corrected velocity

slide-17
SLIDE 17

∆x1 = − 𝑥1 𝑥1 + 𝑥2 x1 − x2 − 𝑚0 x1 − x2 x1 − x2

Distance Constraint

  • Conservation of momentum
  • Stiffness: scale corrections by 𝑙 ∈ 0,1

– Easy to tune – Effect dependent on time step size and iteration count – Fixed! See XPBD

∆x2 = + 𝑥2 𝑥1 + 𝑥2 x1 − x2 − 𝑚0 x1 − x2 x1 − x2 𝑥𝑗 = 1 𝑛𝑗

𝑛1 𝑛2 ∆x1 ∆x2

𝑚0

slide-18
SLIDE 18

General Internal Constraint

  • Define constraint via scalar function:

𝐷𝑡𝑢𝑠𝑓𝑢𝑑ℎ x1, x2 = x1 − x2 − 𝑚0 𝐷𝑤𝑝𝑚𝑣𝑛𝑓 x1, x2, x3, x4 = x2 − x1 × x3 − x1 ∙ x4 − x1 − 6𝑤0

  • Find configuration for which 𝐷 = 0
  • Search along 𝛼𝐷

𝐷 = 0 rigid body modes

𝛼𝐷

slide-19
SLIDE 19

Constraint Projection

  • Linearization (equal for distance constraint)

𝐷 x + ∆x ≈ 𝐷 x + 𝛼𝐷 x 𝑈∆x = 0 ∆x = 𝜇 𝛼𝐷 x λ = − 𝐷 x 𝛼𝐷 x 𝑈𝛼𝐷 x λ = − 𝐷 x 𝛼𝐷 x 𝑈M−1 𝛼𝐷 x ∆x = 𝜇 M−1𝛼𝐷 x

M = 𝑒𝑗𝑏𝑕 𝑛1, 𝑛2, . . , 𝑛𝑜

  • Correction vectors

𝐷 x + ∆x = 0

slide-20
SLIDE 20

The Solver

slide-21
SLIDE 21

Constraint Solver

  • Gauss-Seidel

– Iterate through all constraints and apply projection – Perform multiple iterations – Simple to implement

  • Modified Jacobi

– Process all constraints in parallel – Accumulate corrections – After each iteration, average corrections [Bridson et al., 2002]

  • Both known for slow convergence
slide-22
SLIDE 22

Global Solver

  • Constraint vector

λ = − 𝐷 x 𝛼𝐷 x 𝑈M−1 𝛼𝐷 x ∆x = M−1𝛼𝐷 x 𝜇 C x = 𝐷1 x ⋯ 𝐷𝑁 x 𝛼C x = 𝛼𝐷1 x 𝑈 ⋯ 𝛼𝐷𝑁 x 𝑈 𝛼𝐷 x M−1𝛼C x 𝑈 λ = −C x ∆x = M−1𝛼C x 𝑈λ λ = 𝜇1 ⋯ 𝜇𝑁

[Goldenthal et al., 2007]

slide-23
SLIDE 23

Global vs. Gauss-Seidel

  • Gradients fixed
  • Linear solution ≠ true

solution

  • Multiple Newton

steps necessary

  • Current gradients at each

constraint projection

  • Solver converges

to the true solution

𝛼𝐷2 𝛼𝐷1 𝑚2 𝑚1 𝑚2 𝑚1

slide-24
SLIDE 24

Other Speedup Tricks

  • Use as smoother in a multi-grid method
  • Long range distance constraints (LRA)
  • Hierarchy of meshes
  • Shape matching

→ more details later

slide-25
SLIDE 25

Powerful Gauss-Seidel

  • Can handle inequality constraints trivially (LCPs, QPs)!

– Fluids: separating boundary conditions [Chentanez at al., 2012] – Rigid bodies: LCP solver [Tonge et al., 2012] – Deformable objects: Long range attachments [Kim et al., 2012]

  • Works on non-linear problem directly
  • Handles under and over-constrained problems
  • GS + PBD: garbage in, simulation out (almost )
  • Fine grained interleaved solver trivial
  • Easy to implement and parallelize
slide-26
SLIDE 26

Constraint Examples

slide-27
SLIDE 27

Bending

𝐷𝑐𝑓𝑜𝑒𝑗𝑜𝑕(𝐲1, 𝐲2, 𝐲𝟒, 𝐲𝟓) = 𝑏𝑑𝑝𝑡

𝐲2 − 𝐲1 × 𝐲3 − 𝐲1 𝐲2 − 𝐲1 × 𝐲3 − 𝐲1 ∙ 𝐲2 − 𝐲1 × 𝐲4 − 𝐲1 𝐲2 − 𝐲1 × 𝐲4 − 𝐲1 − 𝜒0

𝐲1 𝐲2 𝐲3 𝐲4 𝐨1 𝐨2

  • More expensive than constraint 𝐷𝑡𝑢𝑠𝑓𝑢𝑑ℎ(𝐲3, 𝐲4)
  • But: Orthogonal to stretching
slide-28
SLIDE 28

Stretching – Bending Independence

stretching resistance bending resistence

slide-29
SLIDE 29

Triangle Collision

𝐷𝑑𝑝𝑚𝑚(𝐲1, 𝐲2, 𝐲𝟒, 𝐲𝟓) = 𝐫 − 𝐲1 ∙ 𝐲2 − 𝐲1 × 𝐲3 − 𝐲1 𝐲2 − 𝐲1 × 𝐲3 − 𝐲1 − ℎ

𝐲1 𝐲2 𝐲3 𝐨 𝐫 𝐲1 𝐲2 𝐲3 𝐨 𝐫

slide-30
SLIDE 30

Cloth Example

King of Wushu

slide-31
SLIDE 31

Tetra Volume

𝐲1 𝐲2 𝐲3 𝐲4

𝐷𝑏𝑗𝑠 x1, x2, x3, x4 = 𝑒𝑓𝑢 x2 − x1, x3 − x1, x4 − x1 − 6𝑊

slide-32
SLIDE 32

Soft Body Example

slide-33
SLIDE 33

Global Volume - Balloons

𝐲1 𝐲2 𝐲3 𝐲4 𝐲5 𝐲6 𝐲7

  • rigin

𝐷𝑐𝑏𝑚𝑚𝑝𝑝𝑜(𝐲1, … , 𝐲𝑶) = 1 6

𝑗=1 𝑜𝑢𝑠𝑗𝑏𝑜𝑕𝑚𝑓𝑡

𝐲𝑢1

𝑗 × 𝐲𝑢2 𝑗

∙ 𝐲𝑢3

𝑗

− 𝑙𝑞𝑠𝑓𝑡𝑡𝑣𝑠𝑓𝑊

slide-34
SLIDE 34

Air Meshes

  • Triangulate air
  • Prevent volume

from inverting 𝐷𝑏𝑗𝑠 x1, x2, x3 = x2 − x1 × x3 − x1 ≥ 0

  • Add one unilateral constraint per cell:
slide-35
SLIDE 35

Locking

  • Solution: Mesh optimization (edge flips)
  • Elements can invert without collisions
slide-36
SLIDE 36

2D Boxes

slide-37
SLIDE 37

Boxes Recovery

slide-38
SLIDE 38

3D Air Meshes

𝐷𝑏𝑗𝑠 x1, x2, x3 = 𝑒𝑓𝑢 x2 − x1, x3 − x1, x4 − x1 ≥ 0

  • Mesh optimization more expensive!
  • Per tetra unilateral constraint:
slide-39
SLIDE 39

3D Air Meshes

  • Two cases that work well without optimization
  • Tissue collision
  • No large relative translations / rotations
  • Multi-layered clothing
slide-40
SLIDE 40

Multi-Layered Clothing

slide-41
SLIDE 41

Untangling

slide-42
SLIDE 42

High Resolution Air Mesh

slide-43
SLIDE 43

Tissue Collision Handling

slide-44
SLIDE 44

Position Based Fluids

  • Move particles in local neighborhood

such that density = rest density 𝐷 x1, . . , x𝑜 = 𝜍𝑇𝑄𝐼 x1, . . , x𝑜 − 𝜍0

  • Density constraint
  • Particle based
  • Pair-wise lower distance constraints

 granular behavior

[Macklin et al. 2013]

slide-45
SLIDE 45

Position Based Fluids

slide-46
SLIDE 46

Shape Matching

  • Global correction, no propagation needed
  • Optimally match rest with deformed shape
  • Only allow translation and rotation

p𝑗 ∆x𝑗

  • No mesh needed!
slide-47
SLIDE 47

2d Demo

slide-48
SLIDE 48

Optimal Translation

  • Given rest positions

𝐲𝑗, current positions 𝐲𝑗 and masses 𝑛𝑗

𝐝 = 1 𝑁

𝑗

𝑛𝑗 𝐲𝑗

  • Compute

𝐝 = 1 𝑁

𝑗

𝑛𝑗𝐲𝑗 𝑁 =

𝑗

𝑛𝑗

𝐮 = 𝐝 − 𝐝

𝐝 𝐝 𝐮 = 𝐝 − 𝐝

slide-49
SLIDE 49

Optimal Transformation

  • The optimal linear transformation is:

𝐁 =

𝑗

𝑛𝑗𝐬𝑗 𝐬𝑗

𝑈 𝑗

𝑛𝑗 𝐬𝑗 𝐬𝑗

𝑈 −1

= 𝐁𝑠𝐁𝑡

𝐝 𝐝

𝐬𝑗 r𝑗

𝐬𝑗 = 𝐲𝑗 − 𝐝 𝐬𝑗 = 𝐲𝑗 − 𝐝

slide-50
SLIDE 50

Optimal Rotation

  • 𝐁𝑡is symmetric →contains no rotation

𝐝 𝐝

  • Extract rotational part of 𝐁𝑠
  • Polar decomposition

𝐁 =

𝑗

𝑛𝑗𝐬𝑗 𝐬𝑗

𝑈 𝑗

𝑛𝑗 𝐬𝑗 𝐬𝑗

𝑈 −1

= 𝐁𝑠𝐁𝑡

slide-51
SLIDE 51

Region Based Shape Matching

  • Shape matching allows only small deviations from the rest shape.
  • Performing shape matching on several overlapping regions.
  • Each particle is part of multiple regions.
slide-52
SLIDE 52

Fast Summation

  • Compute prefix sum
slide-53
SLIDE 53

On Irregular Mesh

slide-54
SLIDE 54

Oriented Particles

  • For co-linear, co-planar or isolated particles
  • ptimal transformation is not unique

 Numerical instabilities

  • Add orientation information to particles!
slide-55
SLIDE 55

Oriented Particles

  • Orientation information can be used

– to stabilize simulation – to position anisotropic collision shapes – for robust skinning of visual mesh

slide-56
SLIDE 56

Generalized Shape Matching

𝐁𝑠 =

𝑗

𝑛𝑗𝐬𝑗 𝐬𝑗

𝑈 + 𝐁𝑗

  • Optimal translation is still

𝐮 = 𝐝 − 𝐝

  • Small modification in the calculation of 𝐁𝑠

where 𝐁𝑗

sphere = 1 5 𝑛𝑠2𝐒 and 𝐒 the particle’s rotation matrix

slide-57
SLIDE 57

Oriented Particles Demo

slide-58
SLIDE 58

Large Elasto-Plastic Deformation

  • Handle splits, merges, large deformations
  • Use explicit surface mesh to define object

– Explicit surface tracking for merges and splits – Move with particles using linear blend skinning

  • Dynamically add and remove particles

– Remove particles outside surface, resample under-sampled regions

  • Dynamically update clusters

– Control cluster sizes

slide-59
SLIDE 59

Doug Simulation

slide-60
SLIDE 60

Solver Accelerations

slide-61
SLIDE 61

Hierarchical PBD

  • Next coarser mesh:

– Subset of vertices – Each fine vertex is connected to at least k coarse vertices

  • Create hierarchical mesh
slide-62
SLIDE 62

Hierarchical Constraints

  • Constraints on coarse meshes

pk pi pj pk pj

  • Unilateral, upper bounds!
slide-63
SLIDE 63

Hierarchical Solver

  • Solve coarse → fine
  • Interpolate displacements

from next coarser level

slide-64
SLIDE 64

Hierarchical PBD

slide-65
SLIDE 65

Wrinkle Meshes

l0

n

rmax

  • 4 constraint types, geometric projection

base mesh wrinkle mesh

attachment points

slide-66
SLIDE 66

Wrinkle Meshes

slide-67
SLIDE 67

Long Range Attachments (LRA)

  • Very often cloth is attached

(curtain, flags, clothing)

  • Upper distance constraint

to closest attachment point

  • Only radial stretch resistance
slide-68
SLIDE 68

Long Range Attachments (LRA)

[Kim et al., 2012], 90k particles

slide-69
SLIDE 69

Follow The Leader (FTL)

attached 𝑚0 𝑚0 𝑚0

  • From top to bottom
  • Only move lower particle
  • All constraints satisfied!
slide-70
SLIDE 70

Follow The Leader (FTL)

  • Momentum not conserved!

attached

𝑚0 𝑚0 𝑚0

slide-71
SLIDE 71

Dynamic Follow The Leader (DFTL)

  • Update positions one-sided
  • Update velocities symmetrically
slide-72
SLIDE 72

Fur Demo