Searching for fast 2D water physics (textures, hlsl)

Started by
-1 comments, last by mgdan 8 years, 1 month ago

Hi there,

I want to include some kind of liquid in my game. The "world" is represented in 2D textures. Each pixel of those textures represents one block of an element (e.g. stone, dirt, earth, sand, air ..). You can add and destroy those elements.

Now I want to add some water as well. It should be fast to compute in realtime. I want to implement it with HLSL on the GPU (for Monogame).

The water should have the following properties:

-It could occur in any pixel/block which is not filled with a solid element (in future also at 'half'- filled blocks)

-you can distribute one block of water over many other blocks.

-you can unite and divide groups of water blocks

-with modification of the solid blocks around the liquid you can translate and reshape the water block set

-with each modification of a group of water blocks the volume should remain constant (rounding errors are ok)

-a gravity vector should have an influence on the water animation

-no trouble with the borders of two neighbouring textures

-free to use for a commercial prgram

nice to have:

-the surface of the water volume should be continuous (also during translation and reshaping)

-pressure: 1) same height in U-shaped environment (maybe also with air pressure), 2) a hole in the deep should release a longer water jet than a hole close to the surface

-supports rain, evaporation, seeping

would be perfect (but as far as I know impossible):

-compute the state of each water block after a modification of the environment for specific time delay with computation costs independent of the time (e.g. enter a part of the world after x timesteps and visualize the state of the water with only one computation)

This topic is closed to new replies.

Advertisement