Gamasutra: The Art & Business of Making Gamesspacer
Sponsored Feature: Real-Time Parametric Shallow Wave Simulation
View All     RSS
September 20, 2017
arrowPress Releases
September 20, 2017
Games Press
View All     RSS






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Sponsored Feature: Real-Time Parametric Shallow Wave Simulation


January 28, 2009 Article Start Page 1 of 5 Next
 

[Simulating convincing waves is mathematically complex and computationally taxing. In this sponsored article, part of the Intel Visual Computing microsite, John Van Drasek III, David Bookout and Adam Lake tackle the problem with DirectX 10.]

Abstract Summary

The simulation of ocean waves provides a significant challenge to computer graphics. Offline rendering yields phenomenal results, but the computational cost is high. The ability to generate waves in real time that resemble actual ocean waves is highly desirable. In this article we describe an implementation of a real-time shallow ocean wave simulation using Microsoft DirectX 10. Our simulation produces a variety of wave shapes and allows the designer to tune wave parameters in real time.

Introduction and Previous Work

Simulating ocean waves has been a challenging goal for both offline and real-time renderings. Early publications in the graphics literature date back to Peachey (1986) and Fournier (1986), but these publications refer to a number of wave simulations that were developed as early as 1981 and the film Carla's Island by Nelson Max (1981). For game developers, a continuing degree of realism has tracked the performance capabilities of hardware. These techniques can be partitioned into two categories: offline and real-time. In both of these categories, water simulation techniques are classified as those that simulate only the water surface and those that simulate the entire water volume.

Offline rendering lets us increase the physical accuracy without regard to the tight time constraints we have in real-time game engines. Many attempt to simulate the fluid mechanics using solutions of the Navier-Stokes (NS) equations. In computational fluid dynamics (CFD) an area or volume approximation is used to calculate an accurate solution to the NS equations (Wang 2007;Stam 1999; Foster 2001). Particle systems can also be used to create solutions to the NS equations. Examples include smoothed particle hydrodynamics (SPH) and level set methods1.

Real-time wave simulation also has two areas of research: treatment of the water as a 3D volume and treatment of the water as a 2D surface. Previous work using a volume-based approach includes that of Thürey (2007). Because of the reduced computational complexity of the surface simulations, the majority of work for game developers has been in this realm. The technique that treats the wave simulation as a surface was made popular by Tessendorf (2001), and relies on treatment of the surface in the Fourier domain. The corollary to the Tessendorf approach is known as the "sum of sines" (Isidoro 2002; Finch 2004; Lake, Van Drasek III, and Reagin 2005; Lake and Reagin 2005). Most recently, an interactive simulation that includes interaction with floating objects (Yuksel 2007) has been published. Although still simulating only the surface, Yuksel uses a particlebased approach.

Observations made by oceanographers and surf science authors provide data that reveals the behavior of ocean waves. Tessendorf refers to this method as a phenomenological approach. It produces results that work well to reduce the complexity in the simulation.

Our real-time parametric shallow wave simulation was written using DirectX 10 and provides a complete framework for future work on breaking-wave geometry simulations. The approach uses the work of Tessendorf, Finch, and Isidoro for the surface representation and the sum of sines method for generating wave shapes. Each vertex in the water surface mesh is calculated independently from other points in the mesh, which makes our wave simulation a good candidate for parallel workloads.

We begin by presenting the theory behind our wave simulation. Next we describe the approach used to create waves and manipulate their shape as they move into shallow water, and then we give the details of the normal mapping method used to simulate the surface effects. Finally, we provide performance numbers and discuss the results of this simulation.

Theory

The fundamental component for our shallow wave simulation is the sine wave. A parameterized sine function allows control over the wavelength, amplitude, velocity, direction, and steepness of a wave for some point in the mesh at some time step. The inputs for the function are the direction, vertex position, time, amplitude, velocity, water depth, wavelength, wavelength variance tolerance, steepness, and steepness variance tolerance. The function returns a height value that is used to displace the z dimension of the water surface mesh. We summarize our approach, adopted from Finch.

It is important for the phase of the wave to remain unchanged from one adjustment to the next. Maintaining a constant phase ensures smooth visual transitions when adjustments are made to the wave. Prior to changing the velocity and wavelength values, the phase is calculated. The inputs for the function that calculates the phase are velocity and wavelength. The output is the phase constant.

As a wave enters shallow water, the wavelength and velocity decreases while the steepness increases. The wavelength will begin to shorten when the depth of the water is less than one half of the wavelength. The inputs for the function that adjusts the wavelength are wavelength and water depth. The output is the adjusted wavelength.

The steepness of the wave is adjusted after the wavelength has been adjusted. In our simulation we chose to adjust the steepness at the same rate as the wavelength, resulting in the two functions looking very similar. The inputs for the function that adjusts the steepness are steepness and water depth. The output is the adjusted steepness.

Now that we have adjusted the height of the vertices in our mesh with the parameterized sine function in equation (1), we need to compute the surface normal to use in our lighting calculations. The surface normal at a given vertex is calculated using differentiation (Finch). Differentiating in the x and y directions gives the rate of change of the surface and becomes the normal at the vertex we are evaluating. These derivations are known as the binormal and the tangent vectors, respectively. The binormal and tangent vectors create a matrix commonly referred to as a "tangent space matrix." The surface normal is multiplied by the tangent space matrix to properly orient it on the surface of the wave.


Article Start Page 1 of 5 Next

Related Jobs

Konami Gaming, Inc.
Konami Gaming, Inc. — Las Vegas, Nevada, United States
[09.19.17]

Software Engineer III
Nintendo of America Inc.
Nintendo of America Inc. — Redmond, Washington, United States
[09.19.17]

Software Engineer, Developer Support (NTD)
DigitalFish, Inc.
DigitalFish, Inc. — San Mateo, California, United States
[09.18.17]

Software Engineer - Mechanical Learning
DigitalFish, Inc.
DigitalFish, Inc. — Mountain View, California, United States
[09.18.17]

Software Engineer - AR/VR





Loading Comments

loader image