Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Rivers using Heirarchical Poisson Disc and Delaunay Triangulation

  1. #1
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Wip Rivers using Heirarchical Poisson Disc and Delaunay Triangulation

    Here's what happens when you take a hierarchical Poisson disc stipple field, assign a rainfall level of 0 or 1 based on rank in the field and a precipitation surface (in this case (sin x*cos y)^1.5), assign the nodes around the edge to a starting set (effectively the ocean) and then randomly add nodes adjacent to the connected set in the Delaunay triangulation of the whole set to the connected set until you've connected them all, and then display the graph with edges weighted by the sum of upstream rainfall.

    Click image for larger version. 

Name:	foo.png 
Views:	132 
Size:	202.5 KB 
ID:	63501

  2. #2
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Default

    Now with a weighted selection for flow direction that reduces the likelyhood of sharp bends and constrained hydrological divides.

    Click image for larger version. 

Name:	foo.png 
Views:	99 
Size:	200.0 KB 
ID:	63536

    Here's the weighting function, where theta is the angle between the new segment and the downstream one. All the available downstream nodes are weighted and then one is selected randomly based on that weighting. This is designed to encourage some squiggle but avoid really sharp bends.
    Code:
    ToDoubleFunction<Optional<Double>> weight = theta->{
      return Math.pow((Math.cos(theta.orElse(0.0))+1)/2, 100) - Math.pow((Math.cos(theta.orElse(0.0))+1)/2, 300)/4;
    };

  3. #3
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Default

    I think I may need to add a weighting to the selection of the next node to add, perhaps based on proximity to break lines. If nodes near the break line were selected later it would reduce the occurrence of rivers along the sides of break lines.

  4. #4
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Default

    Weighting the selection with proximity to the break line helped immensely.

    Click image for larger version. 

Name:	foo.png 
Views:	106 
Size:	201.3 KB 
ID:	63538

  5. #5

  6. #6
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Default

    I've noodled around with this a bit more recently

    Click image for larger version. 

Name:	rivers.png 
Views:	18 
Size:	150.4 KB 
ID:	73328

  7. #7
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Default

    Added endorheic basins and lakes.

    Click image for larger version. 

Name:	rivers.png 
Views:	28 
Size:	220.0 KB 
ID:	73352

    Lakes start as a point on a river and then expand up stream (including along streams that were made 'dry' during the precipitation and flow calculation).

  8. #8
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,844
    Blog Entries
    4

    Default

    Very cool stuff going on here. Keep posting - I am following what your doing with some interest. Tho I calculate my rivers using a different technique I can see why this way might be really super fast compared to mine. Presumably you can determine the height map from the initial stipple field. Id like to see how this looks in 3D or with shaded relief.

  9. #9
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Default

    Quote Originally Posted by Redrobes View Post
    Very cool stuff going on here. Keep posting - I am following what your doing with some interest. Tho I calculate my rivers using a different technique I can see why this way might be really super fast compared to mine. Presumably you can determine the height map from the initial stipple field. Id like to see how this looks in 3D or with shaded relief.
    The speed is hampered by the weighted random selection it has to make at each step of computing the paths. Once that is done though, it can be saved and re-used so that the river network can be recomputed for different precipitation surfaces. At some point I'd like to do an animation of the river network shifting with varying weather. Tying the lakes into that too would be particularly cool. Overall the images above took a few minutes to generate. Being a bit more clever about it ought to speed it up, especially if created some specialized data structures.

    3D isn't that practical given the way this works. It essentially only knows about aspect, not slope or elevation. Artificial DEMs that don't look horribly fake are really hard to do which is why I tried to come up with a way of generating decent looking rivers without a DEM.

  10. #10
    Guild Expert Gracious Donor Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,198
    Blog Entries
    1

    Default

    Weighted random selection now uses parallel prefix sum and binary search which has improved performance. I've also switched to loading shapefiles instead of generating the coastline and divides internally.

    Input
    Click image for larger version. 

Name:	input.png 
Views:	10 
Size:	28.8 KB 
ID:	73585

    Output
    Click image for larger version. 

Name:	output.png 
Views:	14 
Size:	121.8 KB 
ID:	73586

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •