+ All Categories
Home > Documents > Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ......

Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ......

Date post: 17-Sep-2018
Category:
Upload: phungtuong
View: 218 times
Download: 0 times
Share this document with a friend
81
Particle Based Simulations Using GPUs Yalmar Ponce Claudio Esperança
Transcript
Page 1: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Particle Based Simulations Using GPUs

Yalmar Ponce

Claudio Esperança

Page 2: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Outline

• Environment configuration

– Linux, Windows, OSX (if necessary)

• Particles simulation

– Collision detection

• Rigid bodies simulation

– From particles to bodies

– Collision detection

– From bodies to particles

• Soft bodies simulation (similar to rigid bodies)

• SPH

Page 3: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

ENVIRONMENT CONFIGURATION

Page 4: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

C++ and CUDA

• Currently C++ and CUDA are supported by the most popular operating systems

– Linux

– Windows

– OSX

Page 5: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

What is required in Linux?

• Suppose we have a NVIDIA card (ATI must be similar)

– Fedora

• Install gcc compiler (4.8 or later)

• Download driver from NVIDIA

• Run Fedora on runlevel 3

• Install the driver and restart

• Download and install CUDA SDK and ToolKit

• A good source code editor like Geany is recommended

Page 6: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

What is required in Windows?

• Similar to Linux but more easy

– Download NVIDIA driver and install it

– Download and install CUDA SDK and Toolkit

– A good source code editor or IDE will be required

• All CUDA samples have Ms Visual Studio Projects

• Therefore, will be necessary to have installed the Ms Visual Studio 2008 or a later version

Page 7: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

What about OpenCL?

• Notice that, so far, only OpenCL 1.1 is supported by NVIDIA hardware.

• On Linux, it is required to install the drivers from NVIDIA web page. Other drivers (from yum repositories) have no support for OpenCL

– Check if the libs libOpenCL .so.* have been copied to the correct libs directory

• For Windows there are no problems

Page 8: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

FREE PARTICLES SIMULATION

Page 9: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Particles representation

• Particles typically are represented by small spheres with properties:

– Position

– Velocity

– Radius

– Mass

• Ideal for simulating granular materials

Page 10: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Collision Detection

• Particles are represented by small spheres

• Brute force

– n(n-1)/2 O(n2)

• Particles interact in a small region

– Well suited to spatial subdivision methods

• Using an uniform grid

– World is a cubical grid

– Grid cells store particles

– Collision occurs only between particles on neighbor Grid cells (3d-1)

Page 11: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Collision Detection

• Spatial Subdivision

– Uniform Grid

– Collision test only if the objects belong the same cell or adjacent cells

– A particle can be involved in more than one collision

– Cells must be processed in parallel

– NVIDIA CUDA is made for that

Page 12: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Uniform grid

• Particles are mapped onto cells based on their centers

• Cell size = particle diameter

– For equal sized particles, assuming no inter-penetration, up to 4 particles per cell

• Collision test examines a neighborhood of 33 cells

– O(n)

Page 13: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

GPU Collision detection

• Sorting (radix sort)

• Grid is updated efficiently using sorting and search

• Supports unlimited number of particles per cell

• 3 stages

– Cell hash for each particle

– Sort particles based on hash, and

– Search sorted list of each cell

Page 14: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

GPU Collision detection

Page 15: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

GPU Collision detection

Page 16: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

GPU Collision detection

Page 17: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Collision response

• Compute forces between collided particles

• Update positions and velocities

Page 18: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Results

Page 19: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

RIGID BODIES SIMULATION

Page 20: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Rigid Bodies on GPU

• Introduced by Takahiro Harada

• All operations computed on GPU (FBO-R2Tex)

– Particle dynamics

– Grid generation

– Collision detection

– Momenta computations

– Body dynamics

Page 21: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

From bodies to particles

• The goal

– Discretize the mesh body on small boxes and place a particle at each box

Page 22: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

From bodies to particles

• There are many methods

– Octree based

• Build an octree for the 3D mesh

• Can be implemented on GPUs

• Query for occupied voxels

– Image based

• Define image resolution

• Suitable for GPU

• Ray casting for getting the ocuppied voxels

Page 23: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

From bodies to particles

Ray casting technique

Page 24: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Free particles

Page 25: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

But for Rigid Bodies?

• Particles depend on rigid body attributes

– Position and orientation

Page 26: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Collision detection

• Similar to free particles

– First, the particles attributes are computed by using the rigid bodies positions and orientations

– Here, collision detection is done in the same way as free particles, generating repulsion forces

– Finally, these forces are added to compute a total force and total torque.

Page 27: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Momenta computation

• Using the forces and torques compute the linear and angular velocities

• Next, compute the new positions and orientations

Page 28: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Rigid bodies positions

Rigid bodies orientations

Particles positions

Particles velocities

Particles relative positions

Computes particle values

Uniform Grid

Forces on particles

Collision detection

Update the grid

Rigid bodies linear momentum

Rigid bodies linear momentum

Momenta computation

Update rigid bodies positions and orientations

Page 29: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Rigid bodies formulae

• Update particle’s properties

• Compute forces on particles

• Compute forces on bodies

• Momenta computation

• Update rigid bodies’ properties

Page 30: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Results

Page 31: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

SOFT BODIES SIMULATION

Page 32: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Motivation

• Soft bodies' simulation opens a huge range of solid objects for many applications like games.

Page 33: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Soft deformations

• Simulate soft bodies deformations in a computationally efficient and plausible way

Page 34: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Simple model

• Shape matching [Muller 05]

– Solids represented by particles

– No conectivity information is needed

Page 35: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

• Given n point with positions , which represents a soft body

• Animate these points considering ext forces and it becomes deformed

• At every time step, match the current configuration to the original shape yielding goals

Basic algorithm

Page 36: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Basic algorithm

• Pull the actual points (black) towards the goal positions (red)

Page 37: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Basic algorithm

• It’s like applying a translation and a rotation

• In fact, we need to compute a transformation matrix

f(R,t)

Page 38: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Algorithm

1. Find the optimal transformation matrix in order to compute the goal points.

– This is shape matching

2. Move the particles towards those goal points

Page 39: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Shape matching

• Given and , the original shape points and the actual shape points, respectively.

• Find the rigid transform minimizing

• Optimal is center of mass of the

• Optimal is center of mass of the

Page 40: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Optimal transformation

• Define and

• Minimize

• With optimal linear transform

Page 41: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Optimal transformation

• Extract the rotational part

– can be precomputed

– Get the optimal R from polar decomposition of

– R is the rotation matrix

– S is a symmetric matrix

Page 42: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Extracting R

• R is related with A

• How to find S?

– First, sqrt computation can’t be applied to matrices directly

– Then, we need diagonalize the matrix for computing the matrix sqrt

– D is a diagonal matrix and have the eigenvalues and U have the eigenvectors of the decomposition process (diagonalization)

Page 43: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Matrix diagonalization

• Authors suggests to use Jacobi rotations

jacobi(AtA, v, U);

– 5 - 10 Jacobi rotation should be sufficient

• D is formed by the vector of eigenvalues v

• Finally,

• Note that D is inverted directly

Page 44: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Goal positions

• After R is computed, we can compute goal points for each time step

Page 45: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Integration

• Control stiffness setting by (rigid for = 1)

• So far, only rigid deformations can be achieved

Page 46: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Linear deformations

• Recall that R is the polar decomposition of ( , where )

• Instead of using only R to compute the goal point, also use the matrix A

• Now, objects can get stretched

Page 47: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Quadratic deformations

• Further, quadratic deformations allows for more awesome effects like twisting and bending

Page 48: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Quadratic deformations

• Again, reformulate the equations considering quadratic terms and mixed terms

Page 49: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Objects representation

• Two representations

– Particles for simulation

– Mesh for rendering

Page 50: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

From bodies to particles

• Bodies are discretized by placing particles near to mesh faces

– Naive approach

• Place small spheres for all the vertices

• Try to place using negative normals

• Remove those that are very close

Page 51: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Soft body representation

• When bodies have complex geometries

– Particles are used for collision detection and to compute an optimal deformation matrix

– Later, the deformation matrix is applied to all vertices and normals (on faces or vertices)

Page 52: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Original particles positions x0

i

Current particles positions xi

Updated particles positions xi

Update particles with external forces

Uniform Grid

New moved particles positions (model is deformed)

Collision detection for generating forces

Update the grid

Goal positions gi

Integrate

Compute quadratic deformation matrix

Page 53: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Results

Page 54: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

SMOOTHED PARTICLES HYDRODYNAMICS (SPH)

Page 55: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Motivation

• Fluids enables to simulate a large variety of natural phenomena

– Smoke

– Fire

– Liquids, etc.

Page 56: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Introduction

• There are two main methods for modeling fluids

– Eulerian

– Lagrangian

• Point based Lagrangian methods yield high performance and easier to implement

– SPH (Smoothed Particles Hydrodynamics)

– Mesh free

Page 57: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Introduction

• In recent years, point based simulations have become increasingly popular

• Some of the main contributors were

– Matthias Müller

– Takahiro Harada

– Simons Green

Page 58: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

What is SPH?

• Particle system with inter-particle forces/interactions

– Interactions at infinite distance yield O(n2) computational complexity

– Define interaction cutoff distance

• Less complexity

• Easier to parallelize

• First developed for use in astrophysics

– Simulation of stars / galaxies

Page 59: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

What is SPH?

• Different from other fluid simulation methods (FEM)

– Mesh free (does not consider any “surfaces”)

– Interpolation method for particle systems

Page 60: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

What is SPH?

• Each particle is affected only by the particles within a limited radius h(cutoff distance)

– Uses a “radial symmetrical smoothing kernel” to define the cutoff

h

Page 61: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Why use SPH?

• Advantages

– Very fast/efficient compared to other fluid simulation methods

– Easy to parallelize

– Guarantees conservation of mass (particles themselves are the mass) if weighted functions are normalized

– Computes pressure from weighted contributions of neighboring particles (instead of solving linear systems of equations)

Page 62: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

But …

• Disadvantages

– Still has to reconstruct a surface to render (marching cubes, splatting, etc.)

– Needs a lot of particles for realistic simulation

Page 63: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

How to parallelize

• Use a spatial subdivision data structure

– An uniform grid

– Fill/map particles onto the grid

– Only search within a neighborhood

• For each particle, the cell to which belongs and the adjacent cells in a radius must be checked

Page 64: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

SPH dynamics

• Compute density and velocity

– Query on a neighborhood of radius h to verify particles which can contribute

h

Page 65: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

The equations of SPH

• The particle at location x is computed as a weighted sum of neighboring particles

• In the discretized functions

Page 66: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

The equations of SPH

• The governing equations (mass and momentum conservation) are simplified Navier-Stokes

Page 67: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Particles’ positions Particles’ densities

Uniform Grid

Particles’ densities

Particles’ velocities

Particles’ velocities

Obstacles’ distance function

Particles’ positions

Compute densities

Update velocities

Update the grid

Update positions

Page 68: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Results

Page 69: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

SPH rendering

• Based on gaussian smoothing

– Particles are renderized as small spheres

– This is stored as textures for smoothing

– Two buffers are used

• Depth buffer

• Normals buffer

• After the images are smoothed we can apply effects for

– Illumination, shadow, reflection and refraction

• This technique is simple and cheap

Page 70: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

EXTENSIONS

Page 71: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Extensions

• Rigid bodies using impulses instead of forces

• Cloth simulation

• Solid-liquid coupling

• Cloth-liquid coupling

Page 72: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Rigid bodies using impulses instead of forces

• Disadvantages for the method using forces

– Representing high resolution objects • A large particles' set could be necessary

Page 73: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Disadvantages

• Collision response behavior looks a bit springy

• Collision between particles OK

– But with obstacles?

Page 74: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Disadvantages

• Interpenetration between objetcs or obstacle-object

– Large forces can carry for interpenetrating objects

– Small particles do not guarantee correct separation or even any separation in some cases

Page 75: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Rigid bodies using impulses

• Is more adequate to generate correct dynamic behavior

• In our prototipe, we use variable sized particles

Page 76: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Rigid bodies using impulses

• Collision detection – Estimates contact points

• Collision response – Apply impulses at contact

points

• Differs from forces approach because impulses are applied sequentially

Page 77: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Algorithm

• Save positions and orientations of objects

• Update obtects’ properties (positions, velocities and orientations)

• Update particles properties (positions and velocities)

• Update the grid

• Detect collision on particles and process them by applying impulses at contact points

– Changing objects properties

• Retrieve the objects’ saved attributes

• Update velocities of the objects

• Detect and process contacts, if still there are, by applying impulses

• Update positions and orientations of objects

Page 78: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Cloth simulation

• Mass-spring approach

• Resolution

– Efficiency vs Performance

Page 79: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Cloth simulation

• Collision detection

– Grid for mapping triangles

– Similar to particles collision detection

• Search on a neighborhood

Page 80: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Solid-liquid coupling

• Collision detection unified

– SPH particles

• computes pressure and viscosity forces

– Solids particles

• computes forces for separating collided objects

Page 81: Particle Based Simulations Using GPUs - Arequipa · Visual Studio 2008 or a later version . ... –Discretize the mesh body on small boxes and place a particle at each box ... •Particles

Cloth-liquid coupling

• Collision detection uses two grids

– Fine resolution for SPH particles

– Coarse resolution for cloth triangles

• Collision detection is done in two stages

– One for particles, searching on the two grids

– Second for triangles, searching on the two grids too


Recommended