Search Unity

Randomly generated low-poly styled terrain with rivers, lakes and erosion

Discussion in 'Works In Progress - Archive' started by 3dDude, Jan 6, 2017.

  1. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    Hey!

    I have been working on this project for while and was hoping to get some feedback.






    Right now the terrain uses noise with a hydraulic erosion simulation for the height map. additionally, some algorithms are used to trace and model river paths and lakes. The idea is to create something very stylized with a very clean aesthetic.

    Some of the future goals of the project are:
    1) Spice up the graphics, specifically the water and sky rendering.
    2) Add Roads/villages
    3) Increase terrain size

    Cheers!
     
  2. TheGabelle

    TheGabelle

    Joined:
    Aug 23, 2013
    Posts:
    242
    Nice! How did you go about generating rivers / lakes and the erosion process?
     
  3. 00Fant

    00Fant

    Joined:
    Mar 10, 2015
    Posts:
    131
    looks very nice =)
     
  4. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    Thanks!
    The processes are pretty much separate. The general erosion happens first to smooth the terrain.Then, a pathfinding algorithm is used to find river paths which are used to add vertices to represent the river bed.

    Cheers,
    Ian S
     
  5. TheGabelle

    TheGabelle

    Joined:
    Aug 23, 2013
    Posts:
    242
    I have been doing a bit of research on the subject and came up with a similar, but poorly designed method. I start at a random elevated location, path-find to the lowest neighbor, and then raycast left and right with a vertical height above the terrain relevant to a 'volume' variable. This get's out of hand pretty quickly and creates a wonky mesh. I'd also like to not depend on physics.

    If you wouldn't mind, could you share some tips for gathering vertex locations and controlling the sizes of the resulting meshes (polycount, dimensions, etc)?
     
  6. CmdrSisko

    CmdrSisko

    Joined:
    Feb 19, 2015
    Posts:
    47
    Looks really great! I like the low poly look you have.

    Do you have a game in mind or are you just creating the environment and seeing where it takes you?
     
  7. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    Hmm, I'm not sure I completely follow the approach you're talking about. The pathfinding I use is based off of the terrain's height map. Essentially a random point is chosen for the river source. And from there its 4 neighbors are added to a potential list. Each iteration the lowest elevation point in the potential list gets remove dand added to the river path. This process is repeated until a point is explored which is at ocean level. Each point also stores which adjacent point "created it", in other words which point was responsible for adding that point to the potential list. At the end the path is retraced from the ocean to the source.
    It's essentially an implementation of A* where the heuristic is elevation.

    Once I have a list of points that represents the river path, I run a smoothing algorithm to make a smooth ish curve. Then in regular intervals on the curve I add a "row" of vertices to the vertex list. Because the terrain is triangulated from scratch each time it is generated, I don't really have to do any other work. The new river points simply form the geometry of the river bed.

    At the moment I'm pretty much seeing where it takes me. I'm very hesitant to jump on the "procedural sandbox crafting game" bandwagon, so if I can think of something else I might pursue it farther haha.

    Cheers!
    Ian S
     
    TheGabelle, CmdrSisko and RavenOfCode like this.
  8. abrad1212

    abrad1212

    Joined:
    Jul 19, 2015
    Posts:
    1
    I know this thread is almost a year old, but I was wondering if you still had the code for this project as Iv been having trouble implementing rivers in my procedural terrain.
     
  9. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    How is your terrain rendered? The main reason this works in my code is that the terrain surface mesh is created customary using Delaunay triangulations.
     
  10. Barbzy

    Barbzy

    Joined:
    Jun 5, 2018
    Posts:
    1
    Love this! Are you going to share or sell? Cheers
     
  11. Munchii

    Munchii

    Joined:
    Aug 1, 2017
    Posts:
    4
    Yeah. I would be interested if you were to share or sell. It looks so pretty! Very good job!

    //Daniel