CS480 Project Lecture Notes
In class, we covered some ways to simulate fluids, namely water, in a two-dimensional setting by reading texture pixels and applying physics equations to determine wave behavior. Since this is done on graphics hardware as opposed to the CPU, it can be done in real time. What Cem Yuksel of Texas A&M released in 2007 was to go further by developing a real-time method to simulate water in three dimensions. By using a technique involving “wave particles,” the system can not only simulate waves, but also cause them to interact with both mobile and immobile rigid objects, like boats and walls, respectively.
In order to make a graphically convincing wave from particles, one first needs to figure out what properties each particle needs to have. In Yuksel’s model, each particle needs only five properties:
1. 2D birth position – The point where the particle was originally generated
2. 2D direction – The vector in which the wave particle is passing along
3. Amplitude – The height of the wave, can also be negative
4. Dispersion angle – How much of an outward spreading wave is represented by the particle, used for generating new particles when the wave is too coarse (page 2)
5. Birth time – When the particle was spawned
Having looked at what makes up a particle, we can see how it works. Without any other considerations, this model seems like it would work fine, but there lies a problem in that using particles without any kind extra computation to form wavefronts would lead to very implausible, lumpy waves. To fix this, we must consider how waves really work, and come up with an approximation that’s fast enough to be done in real time. Real wave propagation is determined by the following second order equation, with x, y, and z as the position in 3d space and v as the velocity:
This, however, is too slow to be done on the GPU. Instead, we approximate it as the following, with ri as the radius of the wave particle:
By keeping the distance between two particles less than one half the wave particle radius, the maximum deviation from the ideal wave shape becomes no more than 3%.
The next part to take into consideration is how to handle the particle colliding with an object, like a boat or a wall. From what I could see in the papers, this was handled much in the same way as how we had particles bounce off the walls and floor in our first few homework assignments, with just a little more to it. Along with reflecting the particle’s 2D direction vector along the surface normal of the boat or wall, the particle’s birth position is reflected across the wall as well, allowing for more particles to be accurately generated should the need arise. An illustration of this is shown on page 3.
A couple similar projects I was able to find are:
Illustrations and equations were taken from Cem Yuksel’s slideshow presentation on the subject, from his website. http://www.cemyuksel.com/research/waveparticles/