Realtime 3D Water Flow Simulation in XNA Framework
This was some of my earliest work in the C# language, and considerable refactoring would be beneficial. The simulation allows users to steer and emit water with keyboard shortcuts across multiple terrain configurations.
Videos
Terraced Hillside Demo
The first terrain is a multi-level bucket-shaped landscape where water flows from peak to base while contained within terraced boundaries.
Islands and Tidal Wave Demo
The second terrain is an island environment with preset water levels. Wave effects are created by rapidly adding water to the cells at the edge of the map.
Technical Foundation
This project built upon a tutorial from Riemer Grootjans. An early GitHub commit documents my modifications between the base tutorial and the completed water simulation implementation.
The core concept uses a pair of 2-dimensional arrays containing the height of land and water at each coordinate in the grid. The system calculates water movement and adjusts height values accordingly.
Originally published on blog.mikerandrup.com