Graphics Reference
In-Depth Information
These two algorithms demonstrate techniques that use the compute shader to perform
calculations that would have been performed on the CPU in older generations of GPU
hardware. By leveraging the GPU to perform these simulations, we can directly use the
results to render its current state. This reduces the required CPU work, in addition to allow-
ing the massively parallel GPU be used to its fullest potential.
12.1 Water Simulation
Providing believable water rendering in a scene adds a significant sense of realism to its
overall appearance. Using a realistic water rendering requires performing a simulation to
determine the current state of the system before it can be visualized with its geometry and
various optical properties. Water, or any other liquid for that matter, exhibits properties
that are very complex, and that are the result of billions of individual molecules interact-
ing with one another and their surrounding environment. Even with the processing power
of modern GPUs, performing a true physical simulation of this scale is still out of reach
for currently available hardware. However, to add a fluid rendering into a scene does not
actually require having access to the state of every molecule in the simulation. Instead, we
are only interested in the primary visual properties of the fluid. More specifically, we are
interested in the surface of the water, since that is what we will end up rendering. Because
of this, we can consider the macro-behavior of the fluid, instead of the micro-behavior of
the individual elements that make up the simulation body.
This allows us to make a number of simplifications to a potential simulation that can
still realistically predict the behavior of the fluid surface, but that can reduce the required
computational complexity of the simulation. In the algorithm presented here, we replace
the massive number of individual particles with virtual columns of fluid, arranged in a
grid-like fashion. Our virtual fluid can move from column to column, but only between
physically touching neighbor columns. When considered all together, the height of each
column defines the height of the fluid surface at that location in the grid. This property can
then be extracted from the simulation and used to generate a number of vertices that will
represent the fluid surface. A grid of vertices is precisely the desired result, since it can be
used directly in the subsequent rendering of the fluid surface.
By making this model simplification, we can increase or decrease the size of the
simulation to allow for either a larger fluid body, or a higher resolution simulation over a
smaller physical area. However, the simplification is not without its costs as well. Because
of the representation we are choosing to use, it is not possible to include advanced features
of a fluid body, such as splashes or breaking waves. However, the resulting behavior of
the simulated fluid is still realistic in appearance, and is sufficient for a real-time rendering
usage.
Search WWH ::




Custom Search