Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Stephen Walter Lavedas, posted on December 04, 2000

Image Description, by Stephen Walter Lavedas

These images are all from a part of my undergraduate thesis work on physically based water simulation. This is the basic water simulator. It simulates the interaction of external forces on a square pool of water roughly 40cmx40cm with a small obstacle in the middle. From top left to bottom right, the view are Triangular Mesh surface (with bad normals, anyone have a good way to calculate per vertex normals for triangle strips?) which runs in realtime. The second is displaying the water flow. The third is a wireframe of rendering with a NURBS surface and the fourth with the filled surface. I didn't have time to write my own NURBS renderer so I get something around 3 fps on a PIII 700 with a Geforce DDR card in it. This part of my system is only for appearence however.

The water system uses columns of water, the pressure differentials are calculated between columns and water is transfered based on those. There are several problems with this method, but it is useful for the simulations I am using it for. I have extended it to also flow downhill and have created a river simulation using my extensions. This pond is made up of almost 1600 columns of water each 1cmx1cm and 10cm high at rest. The obstacle is made of columns who cannot hold water and whose base is much higher than their neighbors tops, so that they won't transfer water. Waves do rebound off these obstacles. Videos (and pretty much nothing else) can be found at


Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
Timothy Barnes

December 04, 2000, 04:49 AM

It may be slow but it looks amazing.


December 04, 2000, 06:00 AM

I think about 10 years ago at Sigraph '90 a paper was published on simulating water that uses what appears to be a similar system to yours? If I remember right, it was using a simple vertex mesh like in the wireframe view, but each vertex was spring laden vertically to give it harmonic motion and transfered some of it's "energy" each update to the surrounding 8. Works well provided the waveforms don't get too short as to cause huge spikes.

Hmm, regarding other techniques, there's also a few papers on the web regarding this other thing called the "Navier-Stokes equasion" - it's used for resolving uncompressible fluids as "voxels" of water - maybe you could find some stuff to in there to help you out? It allows you to simulate overlapping, splashing, pouring and collapsing waves - pretty much physically perfect but it's very expensive processor wise..

Also - maybe you could speed up your simulation data by rendering a simple mesh over the top, using each column as a center vertex for a plain mesh as opposed to using nurbs?

As for the normal question, you can generate your normals on a vertex by vertex basis, by finding the normal of the plane generated by that Vertex, VertexRight, and VertexDown. (if you get that?) - It's not perfectly accurate and you can't get normals for the Right and Bottom edges of vertexs, but it'll give you a nicely shaded surface.

Anyways, good luck with the Thesis work dude - always great to see shiny IOTDs =)


December 04, 2000, 06:15 AM

From what I remember from grade 11 and 12 physics class (playing around with the wave pools :) everything looks nice and realistic. Kepp up the good work and good luck on your thesis project!


Joakim Hårsman

December 04, 2000, 06:26 AM

To calculate the vertex normals just add the normals for all the faces connected to the vertex and divide by number of faces connected.

Manuel Astudillo

December 04, 2000, 07:42 AM

Or even better, just normalize the sum of the normals (so you dont need to keep the number of faces connected)


December 04, 2000, 10:36 AM

Looks real(,) nice !
Especially the bottom two images.

Jaap Suter

December 04, 2000, 01:16 PM

About the vertex-normal-calculation thingy,
even though often people use the above mentioned method for calculating them, cause it gives satisfying results most of the time.

However for better results you might want to take the face-areas and face-angles into account as well.

A bigger polygon should have more influence on the vertex normal. A polygon that lies at a sharper angle should have more influence (although this sort of is dealt with by averaging the polygon normals).

Anyway, just something I once read.

It's a very cool IOTD, I love fluids.... (Don't even try to comment on this one Dirtypunk, Zaewo and Nosebleed :) hehe).

I'd like to see some more realistic fluids appear in games. Not the same ol' water-plane. Remember how Quake did the underwater wavy effect in software? That was awesome!!


Japio De Amigo

Daniel Zoran

December 04, 2000, 02:41 PM

Hey, it looks fantastic!

You should really take a look at, it uses the Navier-Stockes equations too simulate water flow, and it looks great. ;-)

I once made a small particle system in which every particle attracted other particles form the distance, but repelled when they got too close. It allowed for very different behaviors, from Liquid like stuff, to flocking behavior...

good luck on your thesis!!


December 04, 2000, 03:06 PM

Thanks for the comments. Number27, the top right image is basically a triangular mesh as you described,
but that is the best normal calculations I could come up with. Those normals are calculated by calculating
the normal to each triangular face and then adding up all the normals of triangles touching any given vertex
and averaging all of them together.

That runs at 60fps, but it looks bad, as you can see. I've based my initial water simulation off of a paper by
O'Brien and Hodgins at Georgia Tech, but expanded the system to work over uneven terrain (ie flow downhill).
I did look at the Navier-Stokes equations, but for the purpose of my research, they didn't do what I needed.
(They run too slow) Also, they are Partial Differential Equations, which (to be totally honest) are NOT my
strong suite.

If anyone can point me to a good tutorial or some sample code to generate better looking normals,
I'd love to implement it.


December 04, 2000, 04:34 PM

Jaap: If you just take the sum of the non-normalized surface normals of the connected triangles, it will implicitly account for the area of the triangles, since the non-normalized cross product is proportional to the area of the triangle. :) It's also a hell of a lot faster than just taking the average of the normalized normals to boot - can't go wrong ;)

Jaap Suter

December 04, 2000, 05:53 PM


great tip. Hadn't thought about it before. (well, I never needed to calc them normals before). I'll remember it.

Japio De Amigo


December 04, 2000, 06:01 PM

The bottom shots are Real Nice.

Are they a nurbs surface with control points same as top images? Or is it a higher res control grid?


December 04, 2000, 06:07 PM

Maybe you need to "filter" the normals a bit, by taking into account triangles further away from the vertex. Obviously this is not real-time, but it might make it look a bit better (although you may not notice it with lower res meshes).


December 04, 2000, 06:16 PM

Thanks for the tip Jaffy..I'll try that

As for the NURB surface, it actually has a slightly smaller number of control points. The top images use the
corners of each cell as their points, the NURB surface uses the center of each column and the height of the column
the corners are calculated by averaging the heights of the neighboring columns, so they are slightly less accurate
and higher than the ones used for the NURB surface. But in a general analysis, they are roughly equivalent.



December 05, 2000, 08:54 AM

Nice work! I especially like the lighting in the bottom-right picture :)


December 05, 2000, 11:46 AM


Very nice, especially the bottom right one =)

This thread contains 16 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.