Anmeldung



- search -
Edit...

JSPWiki v2.2.28
 
Simple Water Simulation

Der Unterschied zwischen current version und current version:

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'

\frac{v^2}{2}+gy+\frac{P}{\rho}=constant
}]

where

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

[water-glass.jpg]

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

* [Real Time Fluid Dynamics For Games|http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf]
* [Animation and Rendering of Complex Water Surfaces|http://graphics.stanford.edu/papers/water-sg02/]
* [Towards Real-Time Visual Simulation of Water Surfaces|http://www.vis.uni-stuttgart.de/vmv01/dl/papers/17.pdf]
* [Controlling Fluid Animation|http://www.cis.upenn.edu/~fostern/pdfs/cgi97.pdf]
* [Rapid, Stable Fluid Dynamics for Computer Graphics|http://portal.acm.org/citation.cfm?id=97884]
* [deep water simulation with DirectX9|http://www.sciencemeetsart.com/wade/Projects/WaterFX2/index.html]

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

* [Rapid 2d Water|http://freespace.virgin.net/hugo.elias/graphics/x_water.htm]

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

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