physics-based modeling ming c. lin department of computer science university of north carolina lin...

68
Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina http:// www.cs.unc.edu/~lin

Post on 19-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Physics-Based Modeling

Ming C. Lin Department of Computer Science

University of North Carolinahttp://www.cs.unc.edu/~lin

http://www.cs.unc.edu/[email protected]

Page 2: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

New Needs

Add more realistic and higher fidelity simulations, especially for urban simulations/scenarios.

Physics-based computations: weather effects, explosions, entity simulation, spatialized sound effects, shadows, environmental effects, etc.

Require modeling/simulation of civilians: “heterogeneous crowds”

Page 3: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Some Issues

Performance vs. FidelityValidation and VerificationAssessment & Evaluation

– “Correct training”– Performance enhancement– Cost saving

Page 4: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Speed vs. Fidelity/Accuracy

Multiresolution framework Perception-basedData driven + Physics + New Math

Page 5: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

High Energy Fluid-Elastic Interaction

Fluid phenomena everywhere in real worldSource of interesting phenomena – from

interaction and fluid itself

Page 6: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Introduction

Fluid notoriously difficult to simulate– Mathematically:

• Nonlinear• Characteristics travel with high or infinite

speed

– Computationally:• Volume discretization• Stability problems• Resists paralleization

Page 7: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Introduction

Fluid-solid interaction difficult:– Fluid typically Eulerian– Solid objects typically Lagrangian

Interaction introduces severe meshing problems

Page 8: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Our Approach

We want to simulate interaction of fluids & solids– Do it at high fluid energy levels– “Solid” bodies enter elastic regime

We want a method that is fast and capable of handling high-energy fluids

We need to handle meshing issues

Page 9: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Our Approach

Fast -> parallel– Parallel means local operators

Residual distribution schemes (RDS)– A technique developed in aeronautical

community for simulating the Euler equations. [Roe '81]

Very simple, local stencils based on wave models of problem equation.

Page 10: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Residual Distribution Schemes

Consider simple 1D passive advection:

t1

t0

ut=au

x

Page 11: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Residual Distribution Schemes

Each discrete cell moves along a characteristic

Think of the characteristic as a “signal” that is

sent to the next cell

At each timestep, each cell sends a portion of

its value to the next cell

Page 12: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Residual Distribution SchemesIn RDS, each signal is derived from the residual

(or fluctuation) of the equation over each cell.

This example is very simple – we have

constant-speed advection

Page 13: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Burger's Equation

Nonlinear extension to linear advection– Characteristics depend on unknowns

ut=uu

x

Page 14: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

RDS Procedure

For each cell:– Compute fluctuation, decompose into

waves– Distribute waves to incident nodes

• Accumulate updates

For each node:– Time-integrate updates

Page 15: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

RDS Procedure

Lends itself to parallelization:– Perform cell computation in parallel

• Atomic node accumulation

– Barrier– Perform node integration in parallel– Barrier

Page 16: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Elasticity

We use a standard FEM model of linear elasticity for solid objects.

Iterative solve (conjugate gradient) for new displacements– Parts of CG amenable to parallelization

RDS-based elasticity (in progress)

Page 17: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Mesh Wrangling

Elastic solve does not take fluid domain mesh into account– Elastic deformations likely to invert fluid

tetrahedra. We use a weakly stiff elasticity on the

fluid tetrahedra to enforce postive volumes

Practical and cheap

Page 18: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Mesh Refinement

Semi-regular refinement splits tets into 8 children– 4 similar– 4 others

Currently only static in use – Suitable for multigrid, etc.

Dynamic in progress

Page 19: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Results

Page 20: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Results

Page 21: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Results

Page 22: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Results - Timing

Interactive fluid solution speeds.Finite element method elasticity

bottleneck

Page 23: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Results - Scaling

RDS very scalable - residuals can be computed and distributed independently.

Multi-core scaling

of RDS solve for

skyscraper scene

Page 24: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Ongoing/Future Efforts

RDS for elasticity solves – clean solution, parallelizable.

GPU implementation of RDS.More advanced mesh management

for topological changes in domain.

Page 25: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Modeling of Soft Articulated Bodies in Contact Using Dynamic Deformation Textures

Page 26: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Motivation

Global deformations Detailed deformations

Müller et al. ‘05Barbič & James ‘05 Ours

Page 27: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Motivation

Dynamic simulation of deformable solids Highly detailed surface geometry Large contact area: objects bounce, roll, slide,…

Page 28: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Layered Models Motivation

Detailed, small-scale deformationsGlobal (skeletal) deformationsDynamic interplay between skeletal

motion and surface deformation during contact

Page 29: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Layered Models

Overview– Dynamic Deformation Textures

Fast Coupled Layered DynamicsFast Condensed Skeleton Dynamics

Page 30: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Layered Models

Overview– Dynamic Deformation Textures

Fast Coupled Layered DynamicsFast Condensed Skeleton Dynamics

Page 31: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Layered Models

S

C

S

C

Page 32: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Layered ModelsDynamic Deformation Textures

Dynamic DeformationTexture

S

C

Page 33: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Layered Models

Overview– Dynamic Deformation Textures

Fast Coupled Layered DynamicsFast Condensed Skeleton Dynamics

Page 34: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Fast Coupled Layered Dynamics

Generalized Lagrangian frameworkLinear elasticity in moving frame of

reference [Terzopoulos&Witkin’88]

FEM discretizationImplicit integrationPhysically based approximations

Page 35: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Dynamic FormulationDecoupled Solution

1. Project surface forces to update core velocity

2. Distribute core velocity to update surface velocities

Page 36: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Motion interaction Heterogeneous material

Cylinder: 161K tetrahedra

Page 37: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Fast & Responsive Contact

Hierarchical Collision Queries– Texture-based Collision Detection

Responsive Contact HandlingFast Coupled Contact Response

– Skeleton Response Anticipation

Page 38: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Texture-based Collision Detection

Page 39: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Texture-based Collision DetectionStage 1: Low-resolution

Fast proximity tests between proxiesContact plane D per contact region

D

Page 40: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Surface projection onto contact plane DIdentify contacts in D from separation

distances

D

Texture-based Collision DetectionStage 2: Detailed Surface Interference

D

GPU-based

Page 41: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Texture-based Collision DetectionCollision Information Transfer

Contact response in dynamic deformation texture

Transfer collision information

D

DGPU Texture Mapping

T

Page 42: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Hierarchical Pruning

Exploit skeletal nature of deformation– Locality

Page 43: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Robust 2-stage collision detection

Gear: 173K tetrahedra Cylinder: 161K tetrahedra

Page 44: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Articulated Contact Response

Snake: 3,102 surface points 16 bones

Page 45: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Highly detailed, dynamic deformations

Head: 240K tetrahedra 40K vertices

Page 46: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Highly detailed, dynamic deformations

Page 47: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Exploiting Parallelism

All surface-related computations on GPUCommunication between core and

surface computations minimizedDynamic deformation textures for

immediate rendering

Page 48: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Fast Contact Modeling for Soft Characters

Deer: 2,755 surface points 34 bones 10 FPS

Page 49: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Sound in Nature

Collisions lead to surface vibrationsVibrations create pressure waves in airPressure waves are sensed by ear

Vibration Pressure Wave Perception

Page 50: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Physically Based Sound Synthesis

Aim: Generate Sounds directly from physical principles

Current: Recorded SoundsProblems with recorded sounds:

– Difficult, expensive or dangerous to record (eg. Explosions)

– Repetitiveness

* Image taken from: http://www.marblehead.net/foley/index.html

A typical foley studio*

Page 51: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Perceptually Based Acceleration

Brute force physical simulation infeasible Use analytical solution for surface dynamics Exploit human auditory perception

– Mode Compression– Mode Truncation– Quality Scaling

Page 52: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Key Characteristics

Discretized physically-based representation Simplicity of formulation and ease of

implementation; No assumptions about the input mesh topology

– Surface meshes used for physics can be used directly for sound

Capable of yielding both impact and rolling sounds Enables rich environments consisting of numerous

sounding objects, with insignificant difference in the overall audio quality

Page 53: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

System Demonstration

Video

[Raghuvanshi & Lin; I3D 2006]

Page 54: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Motivation: Acoustics

The acoustics of a scene contribute a lot to the immersion and realism

More generally, wave propagation has applications in diverse areas:

- Radio waves (Electromagnetic)

- Sonar

- Seismic Waves (Earthquakes)

Page 55: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Problem Statement

Given: An arbitrary scene in 3D, the locations and sounds for many moving sound sources and the location of the listener (dynamic)

Evaluate the sound heard by the listener as efficiently as possible

Page 56: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Challenges

Need full time-domain solutionMultiple reflections (>10) are

perceptually relevantAudible sounds (20-22000 Hz) have

wavelengths ~cm: Diffraction is important

Sound is coherent: Interference is also important

Page 57: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Approaches

Mainly two types of approaches:– Ray/Beam-based–Wave-based

Ray-based approaches motivated from light simulation– Trace sound rays/packets of rays/beams– Compute-intensive for higher order reflections– Integrating diffraction accurately is tough

Page 58: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Approaches (contd..)

Wave-based approaches directly solve the underlying physical equations

Discretize the equations using an FEM/FDM based approach

Capture reflection, interference and diffraction accurately

Computationally Intractable, especially for high frequencies– Most current methods limited to ~100 Hz

Page 59: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Our approach

Wave-based approach: Solve the Wave Equation:

is the laplacian operator in 3D = 340m/s is the speed of sound is the pressure field to solve for

The RHS is the forcing term, corrsponding to sound sources in the scene

Page 60: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Our approach (contd..)

We discretize the Laplacian Operator using an FDM-based approach, giving a discrete set of equations in time:

Observation: This set of equations can be solved analytically by diagonalizing the Discrete Laplacian Matrix, K

Page 61: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Our approach (contd..)

Main Computational Challenge: Diagonalization has complexity O(n3)

For a typical scene in 3D:

n ~ (lvmax/c)3

l: Diameter of the scene, vmax: Maximum simulated frequency, c: speed of sound

That is, the running time:

T ~ (lvmax/c)9 !!

Page 62: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Our approach (contd..)

Divide and conquer Divide the scene into many partitions Employ analytical solution within

partitions (very efficient at runtime) Apply perceptually based optimizations to

further increase performance Use a simple explicit scheme between

partitions

Page 63: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Performance Benchmark

A typical training environmentRuns at near-real-time performance Simulation frequencies upto 1KHzSystem: Intel Core 2 Duo 2.33 GHz, 2

GB RAM, Nvidia 7950 GTX Graphics

Page 64: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Demo

Visualization of the sound field on the same game environment

The pressure amplitude is color-codedThe input sound is a 200 Hz sine pulseNote the heavy amount of diffraction,

interference and reflection in the simulation

Page 65: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Ongoing/Future Efforts

Increase efficiency to handle 3D scenes in real time– Exploit recent advances in

many-core/parallel hardwareEmploy perceptually based techniques

to make approach more scalableExtend approach to handle dynamic

scenes

Page 66: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Hardware Acceleration

Programmable GPUMany-Core Architecture

Page 67: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

Portable Simulation in a Box

Integrate physics-based simulation and develop embedded systems– e.g. On a 30GB flash card, squeeze all

simulation technologies into it and integrated with applications.

Page 68: Physics-Based Modeling Ming C. Lin Department of Computer Science University of North Carolina lin geom lin@cs.unc.edu

The End

Questions?