- search -

JSPWiki v2.2.28
Simple Water Simulation

Der Unterschied zwischen version 1 und version 1:

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:

[{Applet code='WaveApplet' archive='WaveApplet.jar'}]

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

! SourceCode

* [Java-SourceCode|WaterApplet.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

[{Math fontsize='18'

F=\frac{dp}{dt}= \frac{d}{dt}(mv) =m\frac{dv}{dt}=ma

in a combination with Bernoulli's principle

[{Math fontsize='18'



| ''v'' | fluid velocity along the streamline
| ''g'' | gravitational constant
| ''y'' | elevation in the direction of gravity
| ''P'' | pressure along the streamline
| [{Math latex='\\rho' fontsize='8'}] | fluid density

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


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

* [Real Time Fluid Dynamics For Games|]
* [Animation and Rendering of Complex Water Surfaces|]
* [Towards Real-Time Visual Simulation of Water Surfaces|]
* [Controlling Fluid Animation|]
* [Rapid, Stable Fluid Dynamics for Computer Graphics|]
* [deep water simulation with DirectX9|]

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

* [Rapid 2d Water|]


* 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.

Zurück zu Simple Water Simulation, or zur History der Seite.

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. Diese Webseite unterliegt keiner Abnahme oder Genehmigung durch Ulisses Spiele oder FASA.