Advertisement Jump to content
Sign in to follow this  

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

This topic is 1028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Edited by mgdan

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!