Latest File Releases: Mark IV Engine

Monday, 29 June 2009

Playing with Water







Very simple water system added to simulation. When added by scenario water level is at a set level throughout environment. Creating valleys below this level in the editor will fill them with water.
Although there are a couple of very realistic water options for Ogre (Ogre's Fresnel demo, animated mesh water, and the Hydrax plug-in). I had a look at all of them - they will all be a bit of a pain to integrate - so I have gone for a Keep-It-Simple approach to start with.

The water level rises and falls around a meter, which provides a nice lapping waves effect, and should also allow us to simulate buoyant objects (boats, vegetation, debris etc) that bob up and down.

As for the graphical bits I've made a very simple script that sets the texture to about 30% transparent. This allows you to somewhat see partially submerged objects and some underwater geography without looking too much like something from Quake. The other simple trick was to make it extremely reflective of sunlight - by just amping-up the specularity.

This is the result - simple, cheap, quick, reasonably realistic-looking water. The pictures are all taken from my Asus EEE (yes, I actually built an OpenGl programme on it) so I had to turn off the terrain rendering. Better pictures to come...

I've also created a pre-processor that augments a map of the environment with the topography, and marks all of the regions that are covered by water. The current water level is also available This can then be used by:
  • boats that travel on the surface and can only move on water, bobbing up and down
  • amphibious vehicles that float and can drive onshore
  • land vehicles that can submerse and drive along the riverbeds
  • floating things that can be sunk
  • land-based things that can't move through water

0 comments: