Game Development Reference
In Figure 6.5, the fluid simulation is shown during execution of scenario A
from Table 6.1. The left image shows a pressure constant of k r = 100, while
the right image shows a pressure constant of k r = 250. While only the latter
image seems to generate a useful fluid simulation without too much compression,
the results of the stability test imply that a pressure constant around k r = 250
and upwards already causes too much instability for update rates around 30 Hz.
Adding fluid viscosity or overall velocity damping is a requirement in these cases.
We can conclude from the stability test that there is not much difference in
terms of stability between the original SPH algorithm and the collapsed algo-
rithm. 2 Observe that at every parameter change that introduces instability, both
algorithms show a high (i.e., > 10) average velocity. We tried to find extremes at
which the fluid simulation would still behave correctly, both for small and large
time steps. We therefore searched for the maximum k r yielding a stable simu-
lation for the smallest time step and the maximum k r for the largest time step.
For small time steps, the collapsed SPH algorithm allows for the highest pressure
constant, while for large time steps, the original SPH algorithm is more stable.
However, the maximum pressure constant obtainable for both algorithms is al-
ways within five percent of each other, which is not a significant difference.
The similarity in usable parameters for both types of SPH algorithms does not
guarantee that both algorithms yield the same fluid behavior. To verify any visual
differences between the original and collapsed SPH algorithms, we compare the
visualizations of the SPH simulations for all three scenarios in Table 6.1 with low,
medium, and high k r . We look for differences in configuration and movement
of the fluid particles, such as the number of layers of fluid particles and their
separation. Also, we use an artificial wave running through the glass of water to
find differences in behavior when forces are applied to the fluid particles.
The visual output of one of the scenarios is shown in Figure 6.6. The ob-
tained result is typical for the other scenarios as well. In general, the overall
configuration of the fluid particles is the same for both SPH algorithms. At rest,
the image produced by the original SPH algorithm cannot be distinguished from
the image produced by the collapsed SPH algorithm. During application of the
wave force, differences between the algorithms are minimal. There is a slight in-
crease of fluid compression at the center of the wave in the image of the collapsed
SPH algorithm, but this is unnoticable during movement. Therefore, choosing the
collapsed SPH algorithm instead of the original SPH algorithm seems to have a
negligible influence on the overall appearance of the fluid.
2 The deviating result from scenario B in Table 6.1 at
Hz is caused by collision
forces that are too aggressive. Because the fluid particle velocities have no damping, some keep mov-
ing around the cylindrical collision geometry. Particles inside the glass were stable in this particular
k r = 1100