Physically-Based Interactive Sand SimulationMarta Pla-Castells, Ignacio Garcı́a-Fernández and Rafael J. Martı́nez-Durá
Instituto de Robótica, Universidad de Valencia, Spain
Introduction
I Interactive terrain simulation is necessary insome Virtual Reality applications. It is acomplex modeling problem.
I In simulation for training realism is a must,because the trainee has to acquire skills basedon the behavior of the environment.
I For this reason, when the simulation involvesterrain manipulation the soil model must bephysically-based.
I Terrain is usually represented as a grid orheight field.
I In the Computer Graphics literature, modelshave been proposed mainly for terrainanimation purposes [1, 2].
Main Goal
I Our main goal is to provide a model of sand:I that is physically-based;I that considers collisions and horizontal
displacement of sand;I with reaction forces;I and that can be used in real-time, interactive
applications.
Physically-Based Sand Model
I We adapt a classical model from the physicsliterature [3] to be used over the discreterepresentation of terrain used in ComputerGraphics
I This model was previously presented in atheoretical work [4], and here we propose itsapplication to Computer Graphics.
I A local rule checks for steep regions, andcauses avalanches that reduce the slope, likein cellular automata formulation of sandpiles.
I The model is interactive: contact forces can becomputed and applied both to the sandpile andto the object in contact.
Horizontal Sand Displacement
Terramechanics
When a portion of soil is displaced, it is consideredas a solid that slides along a pre-defined interface,causing what is called a fracture [5].
Soil displacement
SoilTool
during fracture
⇓
Discrete Model
I The variables of the terramechanics model arecomputed using the the discrete model of sand.
I The fracture region and the horizontal force on thetool are computed.
I If the tool advancesthe material ispushed, slidingalong the fracture.
I Every cell’s heightabove the fractureincreasesaccordingly.
i0
i1
iN
iN+1
i0
i1
iN
iN+1
Fracture
Tool Soil
Tool
Fracture
Soil
Numerical Experiments
I We have implemented two tests, T1 and T2:I T1 corresponds to a cube with unit edges falling
on a flat ground,I T2 corresponds to the same cube pushing
material horizontally.
I The tests have been repeated for different griddensities, recording the time necessary to run10000 steps.
I To use an scenario easy to reproduce, the physicslibrary Open Dynamics Engine (ODE) has beenused.
I Collision detection has been done by means of raycasting.
EUROGRAPHICS’08 ConferenceCrete, GreeceApril 14 – 18
Results
Results for Test T1 (Only Vertical Forces Appear)
I All times are below 0.2ms.I Although the increase of the
cost is not linear, results arevery good even for densegrids.
I This results indicate that thesand model is suitable forreal-time applications.
Average time per step in T1
0
0,02
0,04
0,06
0,08
0,1
0,12
0,14
10 20 30 40 50 60
Number of divisions
Time (ms)
Results for Test T2 (Case with Lateral Displacements)
I All times are below 2ms.I Again, te results are good
even for dense grids.I In this case, scalability of the
model is not so good as in T1.
I The CPU cost of the collisiondetection and horizontalmaterial displacement hasbeen obtained (in %)
I The code corresponding tothese two tasks is notoptimized, and it takes60%–80% of the CPU⇒ Results are good. But evenbetter results are possible,with optimization
Average time per step in T2
0
0,5
1
1,5
2
2,5
10 20 30 40 50 60
Number of divisions
Time (ms)
Average CPU usageof the three main tasks
Collision Detection
33%
Sand Model25%
Material Displacement
42%
Conclusion
I The model is physically-based.I It considers sand pile evolution, interaction and horizontal
material displacement.I The situations where horizontal displacement happens are
more CPU demanding, but still the model can be run inreal-time in complex applications.
I Optimization strategies have to be investigated:I Parallelism,I Multi-scale analysis of the grid,I Hardware accelerated collision detection,I Implementation of the model on GPU.
References
[1] R. W. Sumner et al.Computer Graphic Forum, 18, 1999.
[2] K. Onoue and T. Nishita.Computer Graphics Forum, 24(1):51–60, 2005.
[3] J. P. Bouchaud et al.Journal de Physique I France, 4:1383–1410, 1994.
[4] M. Pla-Castells et al.In Proc. of Cellular Automata, pages 392–401, 2006.
[5] J. Shen and R. L. Kushwaha. Soil-Machine Interactions.Marcel Dekker, New York, 1998.
LSYM - Instituto de Robtica. Universidad de Valencia Mail: [email protected] URL: http://robotica.uv.es/LSYMP.O. Box 2085 – 46071, Valencia, Spain