On the whole, HydroTerrain is mostly feature complete for river generation, and missing some features for terrain generation. Below are some screen shots of the plug-in running just river generation functionality.
From the postmortem, the task division for the plug-in is listed below.
ALICE:
1. Build Framework
1.1. Implement user interface in MEL [1d]
1.2. Create source images (river slope, terrain slope) [1d]
1.3. Implement command plugin framework in C++ [1d]
1.3.1. Create code stubs for plugin initialization, compute, etc.
2. River network generation
2.1. Create data structures
2.1.1. Individual river nodes with priority index (HortonStrahler’s number), position and elevation [3d]
2.1.2. River node graph [1d]
2.2. Convert source images to usable data [2d]
2.3. Implement Lsystem expansion with initial candidate nodes for hierarchical drainage network growth. [6d]
2.4. Implement probabilistic rule application to determine river branch types [4d]
2.5. Add compatibility checks for newly created nodes [3d]
2.6. Integrate voronoi partitioning library [3d]
2.7. Classify river type for each river node and edge (dependant on 3.1) [3d]
3.3. Create River primitives [3d]
CHENG:
3. Terrain system generation
3.1. Take expanded nodes and implement voronoi partitioning [4d]
3.1.1. Connect the points for each voronoi cell to get a patch.
3.2. Assign height values to voronoi cells [1d]
3.3.1. Define river junction algorithm
3.3.2. Connect river junctions
3.4. Implement Poisson distribution to cover terrain patch with terrain primitives. [4d]
4. CSGTree like datastructure (Cheng) [7d]
4.1. Implement tree structure. [12 d]
4.2. Define different terrain features (hills, valleys, etc.) [12 d]
4.3. Implement blending, adding, subtracting, carving. [13 d]
CSG (constructive solid geometry) data structure and terrain primitives are currently incomplete, as my partner was not able to implement them in time. Since it is the minimum requirement for carving a basic river from the terrain, we were only able to demo river generation. You can see some attempts at CSG intersections at the end of the video where the terrain is interspersed with cylinders.
Despite some setbacks, I'm quite happy with how the rest of the project turned out. The RiverNetworkNode updates/regenerates in real time, so every time the river contour (CV curve) is changed, all the nodes are recalculated, enabling the artist to make changes on the fly. You'll notice in the video that vertically lowering a river mouth results in more rivers branches flowing towards it, which adheres to the natural phenomenon as water always flows downwards.
I was able to learn a lot about writing plug-in's for Maya through this project (not least of which is that it's sometimes a painful and tedious process, hah). I also picked up workarounds for using CGAL with Maya—for example, a node containing the CGAL library will only load properly in Maya when it has been compiled in release, rather than debug, mode. It will compile absolutely fine in either mode, which can throw a lot of people off. Might I note that coming to this discovery was a long and frustrating process.
All in all, I'm glad I got to work on HydroTerrain. While I don't plan on continuing this particular project, I gained a lot from the experience. From a technical point of view, I learned about the procedural process of generating river networks as well as a bit about image processing and STL structures through the CImg and tree.hpp libraries. In terms of project management and planning, I learned how to divide a large task into discrete modular chunks and stick to a development schedule. In terms of Maya integration, I learned how to take general algorithms and translate them into Maya-specific functions. If anyone wants to actually run the plug-in, I'm happy to get in touch and go over the setup instructions (it's quite involved with CGAL installations and path variables which is why I'm not including it here). Cheers!