Anmeldung



- search -
Edit...

JSPWiki v2.2.28
 
Simple Water Simulation

This is an example of an easy water-simulation. The algorithm is fast and stable and looks like water - not perfect, but it fits my needs.

Just move the mouse over the applet:

It is just a 2D Version, but it is easy to extend it to 3D as you can see in Jopulous.

SourceCode

Description

A physical and mathematical description will follow, but the main idea is to use a height-field of seperated water columns and to calculate the pressure and the amount of water flowing between direct neighbour columns. The runtime is O(n) where n is the number of columns.

The base idea is to use Newton's second law of motion

Plugin insertion failed: Could not find plugin Math

in a combination with Bernoulli's principle

Plugin insertion failed: Could not find plugin Math

where

v fluid velocity along the streamline
g gravitational constant
y elevation in the direction of gravity
P pressure along the streamline
Plugin insertion failed: Could not find plugin Math fluid density

The algorithm is far from beeing a realistic simulation, if you look at the following.

water-glass.jpg

But with modern algorithms it is possible to get close to the original (sadly not in real time ;-):

And here an other naive algorithms like the one I use:

TODO

  • Make it better by suppressing the unnatural high frequent waves. This could be done by adding some not-accelerated amount of the water differnece to the left and right direct neighbour columns.




letzte Änderung 21-May-2007 21:11:30 CEST von unknown.

Dateien:
water-glass.jpg water-glass.jpg 8682 bytes
WaveApplet.jar WaveApplet.jar 4005 bytes


Earthdawn (R) ist ein eingetragenes Warenzeichen der FASA Corporation. Barsaive (TM) ist ein Warenzeichen der FASA Corporation. Copyright (c) 2015 by FASA Corporation. Copyright der deutschen Ausgabe (c) 2015 by Ulisses Spiele GmbH, Waldems. www.ulisses-spiele.de. Diese Webseite unterliegt keiner Abnahme oder Genehmigung durch Ulisses Spiele oder FASA.