Personal tools

Author Topic: Procedural water - why not?  (Read 5934 times)

Offline Sandro

  • Squad Leader
  • ****
  • Posts: 240
  • Maintenance guy for UFO:AI 3D engine
    • View Profile
Procedural water - why not?
« on: August 31, 2012, 07:39:23 pm »
Personally, I don't like current water at all. Current "water" swirling material could be good for Quake's murky basins,  is not good for simulating the kind of water we usually meet; even more, it behaves differently in FFP and GLSL renderers, which somewhat breaks the "mansion" map (and maybe some others).
I've been thinking about it a lot, considering various ways, but was always returning to the same thought: we can use the same approach as in Cossacks, using the procedural water simulation to create random, realistically-looking water. And they were doing on 100 MHz Pentium, remember? It was fast enough.
Finally, today it somehow dawned on me, so I've understood how to make simplest possible fluid solver, so after a few hours it was written, tested and tweaked to look like real water (it is not physically correct, but is based on real world hydrodinamics).
It is relatively fast: unoptimized version, being written entirely in Java consumes only about 1% of CPU while rendering 256x256 heightmap at 20 frames/sec.

I'm attaching it to the post, so everyone could play with it and say whether it is good or not. Requres Java Standard Edition (SE) 1.6 or later. Download, extract fluidsolver01.jar from the archive and run with "java -jar fluidsolver01.jar"
Click or click-drag mouse to disturb water, there are no built-in wave generators for now.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
    • View Profile
    • Vengi Voxel Tools
Re: Procedural water - why not?
« Reply #1 on: August 31, 2012, 08:54:20 pm »
it looks cool - can't wait to see this in ufoai itself ;)

Offline Crystan

  • Project Artist
  • Captain
  • ***
  • Posts: 572
  • UFO:AI Lead Sound Artist
    • View Profile
Re: Procedural water - why not?
« Reply #2 on: September 01, 2012, 11:12:28 am »
Awesome! Awesome! Awesome!

Offline fhstoica

  • Rookie
  • ***
  • Posts: 14
    • View Profile
Re: Procedural water - why not?
« Reply #3 on: February 19, 2013, 12:22:33 pm »

The attachment is a (zipped) animation of the surface waves that can be generated with the code (surface_waves.tar.gz) I posed at:,7472.15.html

Let me know if this is what you are looking for.