Heat map of water flow on mesh terrain

Hi everybody,

I am doing some terrain analysis for a project and want to re-interpret flow paths of water that were generated with the Bison plugin into a heatmap where I can display areas of higher water puddling. I’m not sure if this is right path, as the output from bison are basically curves and I’m afraid using the points that make up the curves to generate a separate mesh with colors would not be the right way to go.

I’m sure this is pretty simple and I am probably not using the right tool for the job. Any help/comments would be greatly appreciated.

Thank you

Moved to Grasshopper category.

1 Like

In order to get specific help, always attach Rhino and GH files :slightly_smiling_face:

In any case, you can use this script to assign a gradient by curve length and then bake in order to have a distribution of where water runs off most and accumulates. Simple solution. If yours was a droplet simulation id let it run a little more to get a larger distribution of curve lengths.


crvLengthGradientBake.gh (24.8 KB)

Thank you Francesco. I will give this a try.

This is is still using the lines though. I am going more for a colored mesh/heatmap look

You would have to run the simulation of the droplets much much longer to get longer curves,

(can use this script for the simulation, very easy and simple)
simpledrainage.gh (60.9 KB)

and then you could project the curves onto the terrain mesh, divide the mesh into square faces of x sizes and evaluate how many curves pass through each mesh face by dividing the curves into x segments of equidistant points and checking how many popints are in each mesh face. This should provide you with the data to create a gradient for the heatmap.

You stilll havent attached your Rhino/GHA files…

However, I gave a crack at it and its going in the right direction, but it needs input from someone who knows how to handle domains and distributions a little better than I do. Script currectly projects curves onto non planar surface, divides non planar surface into grip of breps and projected curves into x points, tests for points inside each brep, and here I have run into 2 problems that need resolution from someone with more expertise than me…

Problem 1: the output list is not points contained per brep so that they can be remaped to assign color from gradient according to quantity of points on domain (instead its points per curve in brep)


Problem 2: adjust the domain prior to gradient accordingly.

If someone could fix these two, it should work, I’ve done the most I can without spending the rest of the day doing research. References internalised in gha file.

SurfaceGradientPointConcentration.gh (31.7 KB)

The logic I went with here (second image) was to find the closest terrain mesh face center for each polyline vertex in the flow paths, then count the amount of duplicate vertex points at each mesh face center, and colour the mesh faces by this “face flow” metric:

As I recall I used a lower resolution mesh for this “face flow” visualisation.


Same thing I was proposing. Perhaps you can have a look at my attempt and complete it where I wasn’t able to.

Sorry Francesco I had to trim down the mesh and left the office yesterday. Attached is the file with just the mesh and the Bison trace component. TerrainFlow.gh (17.8 MB)

1 Like

This is great, thank you @AndersDeleuran. I will check this out today. Thank you as well @fcdq

1 Like

No worries, thanks, anytime! :grinning:

Do give this a try if you manage. I’ve used many drainage/drop simulations, from kangaroo to bison, this one is honestly the easiest one to manage, gives the same result as the image Anders supplied.

Will give it another try at completing this later when I have more time to do a little research and stich a couple scripts together as I think I might also find it useful in the future, but in the meantiem the logic is there if you are able to resovle the last bit:

:+1: :+1:

The one thing about this approach is that it could be deceiving. Meaning, just because a flow line intersects or passes through the center of a face doesn’t mean there’s puddling. I’m trying the approach to just use the lowest point (end point) of the flow lines and just focus on those points on the terrain to paint the terrain, the closer the points the more flow lines are ending at that location and the greater the chance of puddling.

I’m just reaching the limits of my skills here :stuck_out_tongue: so I’m trying to understand how you guys are proposing to remap/recolor the mesh. This part of the script I’m having a hard time following.

You are completely right! :grin: Puddling is a tough resolve. This solution would show more accumulation/simultaneous presence than puddling. Could you attach the original terrain geometry? I will give something else a try that I have seen once before with spheres and let you know if it works.

I posted the Gh above. Did it not show?

Yes! Sorry I didnt know you internalised the geometry. Ok so,

I reduced the size of the terrain by 0.01 factor so that I could run the drop simulation with the script I sent (smaller = faster). I let it run for about 45 mins. This is important so that you can see longer particle flows as seen in the immage Anders shared. If I reduced the geometry further and let it run a little longer the results would just get better and better. After this, I simply took the endpoints of all the resulting flow curves and added a sphere. This way you can see where water accumulates, both when flowing down a slope, and when standing still on flat surface. Essentially, where there is no slope, water accumulates. See below:

This is the easiest/simplest way i can think of portraying what youre looking for, and then simply overlay this with a graphic interpretation, or coloring the spheres, etc.

1 Like

I appreciate it. This will do for now. I will keep working on alternative ways and post whatever I find. Found some promising routes using spray mesh and clustering via K-means which is way out of my reach but there are a few discussions in the forums. Could be interesting.

Thanks again

1 Like

Hey, not sure if you were still looking for some options here, but I do have a plugin based solution that might be interesting (it draws from @AndersDeleuran’s method). The input param (flow paths) takes a curve input (e.g. the flow paths) but you could probably edit those curves to be just their final 2-5 segments to get the logic you want (I think this would be more effective than just the end points). There are also some simple affordances for calculating water volumes and absorption along the path.

There are also some examples here under the flow folders that might be useful to build off - iirc one example uses these end points to generate metaballs with weights per point-cluster. That logic could probably be adapted relatively easily to color a mesh.


This thread gave me the idea to do some research on this topic, and I found this paper:

I poorly implemented the algorithm(on the left), on the right side a drain script on the base of @AndersDeleuran’s python version:

Both overlayed:
Maybe someone finds it useful.
The excessive use of classes is just for fun and practice.
File:20211031_Drain.gh (103.0 KB)


This is great! Trying to wrap up some things so I can focus on this and @Philip3 's suggestion. I will post back in the week. I forget how awesome this community is, thank you guys