Game Development Reference

In-Depth Information

Naive Neighbor

Collapse GCB Hash Homogeneous

19

26

30

36

37

Ta b l e 6 . 3 .
Actual framerates produced by the original two-pass algorithm (Naive), the

original algorithm with neighbor lists (Neighbor), the collapsed SPH algorithm (Collapse),

the collapsed algorithm with a grid cell based hash (GCB Hash) and an implementation

with all previous improvements and the optimizations for homogeneous fluids (Homoge-

neous). The simulation consists of
8000
fluid particles at rest in a glass, with
k
r

= 750

g
r
= 100
and
μ
r

=
hμ
=1
.
5
. All tests are performed on a single core of an Intel Xeon

W3520.

6.8 Conclusion

In this chapter, the elements for constructing an efficient and stable SPH simu-

lation have been discussed, applicable to both sequential and parallel algorithms.

This includes optimizing the SPH algorithm and equations, designing an efficient

spatial hash for nearest-neighbor searching, and obtaining a stable simulation.

Further work can focus on the implementation and optimization of the spatial

hash data structure—or other spatial data structures—for specific parallel plat-

forms. For an implementation on multiple processors, one can take a look at

Chapter 7, “Parallelizing Particle-Based Simulation on Multiple Processors” by

Takahiro Harada. Because current real-time SPH simulations still allow the fluid

to compress, another interesting topic of research is incompressible SPH for a

more convincing simulation of water, as described in [Koshizuka and Oka 96]

and [Edmond and Shao 02]. Lastly, efficient real-time visualization of fluids re-

mains an open problem despite the plethora of methods available and is also a

necessity for presenting a believable simulation to the end user.

6.9 Appendix: Scaling the Pressure Force

Scaling the fluid simulation—the fluid-particle positions
x
and smoothing kernel

size
h
—with a factor
s
does not necessarily have an influence on fluid behav-

ior. This section shows that for our choice of smoothing kernels, the fluid-particle

acceleration
a
scales linearly with the fluid simulation. Consequently, the fluid be-

havior resulting from pressure forces does not change relative to the scale of the

simulation. The only requirement is that the pressure constant
k
scale according

to
s
2
. The proof follows from Equation (6.9) below, which defines the accelera-

tion of the scaled fluid particles
i
s
in terms of the acceleration of the original fluid

particles
i
. The definition of
a
i

is taken from Equation (6.8):