Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

LandForge - DX11 Procedural Terrains

Discussion in 'Made With Unity' started by jesta, Jan 17, 2013.

  1. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Hi there!

    The dx11 contest is finally over, so let me present what I've been working on these past weeks.



    LandForge is a procedural terrain generator utilizing the power of DirectX 11 to create huge terrains instantly.

    Advanced noise functions, normal maps, ambient occlusion maps and splat maps are entirely generated on a compute shader. The terrain is also displaced with the help of a tessellation shader, for maximum detail.

    There is no collision detection at the moment, but the generated vistas can already be used for flight sims or other similar games.

    The package uses the SilverLining skies from Sundog Software. The original music was composed by my girldfriend, Kim Derome (http://kimderome.com/) for this project.

    Hope you enjoy the video!
     
    Last edited: Jan 17, 2013
  2. xenius

    xenius

    Joined:
    Sep 30, 2010
    Posts:
    523
    Really beautiful work! Couple questions for you if you don't mind:

    Is the noise information generated at run-time and stored, or are you generating it on the fly?
    If the latter, i'm curious as to what you've found to the limitation on the number of 'passes' in constructing your shape. Have you been able to squeeze in anything resembling a weathering model into the generation, or are you trying to pick noise combinations that get you close to a desired shape without any extra processing?

    Anywho, really evocative demo. So glad to see such eye candy coming out of the competition.
     
  3. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Thanks xenius!

    I did not have time to put basic thermal and hydraulic erosion for the contest, but my current tests suggest that droplet erosion on a compute shader isn't that demanding.

    I didn't even use noise combinations and transformations for the shapes in my video. I used value, perlin and simplex noise derivatives to generate some really interesting effects. Noise operations will be supported of course, and I'm very eager to see what kind of shapes people will come up with :).

    As for your first question, I'm not sure I understand the difference between "run-time" and "on the fly". The noise is generated at run-time with a given seed and offset, and it is stored in a RenderTexture that is sampled in a shader.

    Edit: Oh and by the way, good job on TC particles! ;).
     
    Last edited: Jan 17, 2013
  4. xenius

    xenius

    Joined:
    Sep 30, 2010
    Posts:
    523
    Very interesting. Does that mean that over a span of X meters/kilometers the terrain will eventually topologically repeat at all?

    Thanks much btw, I'll have a post up soon about our demo. The results of the last week crunch are that I'm now quite ill.

    Oh, and do you intend to build a full terrain module out of this for the asset store?
     
  5. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    I'm using a very fast 32 bit hashing function to seed the noise, so the the patterns virtually never repeat.

    And yes, my intention is to make a full-fledged procedural terrain module for the asset store ;).

    Hope you recover soon!
     
  6. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Looks very nice. Makes me show my age by saying that it reminded me of `Vista` on the Amiga which would take hours to render a single frame of a 3d landscape after taking several seconds to generate a small noise-based topography. Very nice to see it running so smooth and detailed.

    Now, if you make this capable of mapping onto a sphere to create an entire plan that you can fly out of and very close into plus land on and have collisions, you're onto a major winner.
     
  7. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    That's the plan :). Thanks for the kind comments!
     
  8. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    +1
     
  9. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Great video and project! This competition has really brought in some heavy competition!
     
  10. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Very cool! Thanks for the insights.
    Reminds of a GPU Gems article: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html

    It would be awesome if you could implement a marching cubes geometry shader, to have full on 3D terrains. I can imagine that makes collision even more complex, though. Great work!
     
  11. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439

    The problem with GS marching cubes is that it's way slow! Histo pyramids marching cubes is much faster, and it only requires SM3!
     
  12. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Exactly. In fact, I already started implementing the hysto pyramids marching cubes for my 3d noise functions ;).
     
  13. gizm0san

    gizm0san

    Joined:
    Jul 6, 2012
    Posts:
    14
    mind blown :) awesome!
     
    Last edited: Jan 18, 2013
  14. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    This is great!

    I only discovered the histo pyramids method after implementing the GS method, d'oh!. Funnily enough, I was starting a GPU based voxel terrain method, with dynamic LOD using tessellation!

    Maybe at some point we can do a shader swap, to see what the real performance difference is between the two methods! :)
     
  15. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    I'd be glad to. :)
     
  16. JscriptFless

    JscriptFless

    Joined:
    Jan 8, 2013
    Posts:
    49
    the trailer looks like the earth was hit by a asteroid and is renewing it's self!
     
  17. jmatthews

    jmatthews

    Joined:
    Jul 27, 2011
    Posts:
    199
    Some of the scene appears to have distinct zones carved into the landscape. Is this a result of a voronoi diagram as part of the generation or is it just a coincidence of fbm noise?
     
  18. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Sorry for the late response. The "distinct zones" are just a coincidence of the eroded fbm noise. In fact, there's no real erosion process applied to the fbm. I used derivative noise fbms as described here to simulate the erosion process, and it's very fast.

    Stay tuned for a big update on the project, with complete planetary generation :).
     
  19. Caliber-Mengsk

    Caliber-Mengsk

    Joined:
    Mar 24, 2010
    Posts:
    689
    Looks fairly impressive. Creating a planet by simply using a noise seed would be interesting. Does it create the exact same results given the same seed (as would be expected) or does it change as you get further out (since you are using some form of hash generation?

    Does it do different biomes yet? As in you fly so far, and the terrain changes from mountainous to desert to forest, and are you planning on implementing that if you don't already. Is it voxel based to where you can dig into it?

    :p Sorry for all the questions, just looks good and fast. I'm tired of terrain generation systems like minecrafts where it just pops into existence and takes forever to do so. It'd be pretty cool to work inside of this system to make full world with cities and roads and everything in real time.
     
  20. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Thanks for the kind comment. The generator creates everything (height, normals, textures, ambient occlusion, splatmap, etc) from a single int, so you can "save" a terrain by simply saving the seed.

    Biomes are only implemented in the texture and color generation at the moment. Full biomes will be a feature for sure.

    The terrain is heightmap-based, which is why it is so fast. Currently, the system can generate earth-sized planets in milliseconds, which allows for runtime modifications of the terrain. The voxel approach is much slower and provides less realistic results in my opinion, so you won't be able to dig in the terrain.
     
  21. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Really impressive... I would like a webdemo or a build so much, just to get lost into alien worlds :D
     
  22. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Awesome, that's the power of procedurally generated content!
     
  23. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    @OP
    So, after generating an spherical world it would be possible to save it and re used it every time. Right?
    ETA because i've some money for you.

    BTW, your system does it manage the shadows?
     
    Last edited: May 30, 2013
  24. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    ZJP, yes, a single int value will save the entire planet. It's too soon to speculate on ETA unfortunately. I really want this to be the most complex, user-friendly, realistic and efficient planet generator available.

    I'll try posting my progress with screenshots, videos and webplayer builds in this thread as soon as I can. Thanks for the support guys!
     
  25. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks for the replay. Bookmarked ;)
     
  26. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Oh I forgot to respond to your last question: yes it supports shadows from any source :).
     
  27. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Would it be possible to incorporate specific flat areas so that buildings could be placed in that spot?
     
  28. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    My tablet is only DX10. :-(

    I'd like to see oceans, lakes, rivers, streams, plateaus, savannahs, ...you know Florida type landscapes...

    What we you do? one by one call a function with a seed to erode those type landscapes according to the base continents / ocean floors?

    I may have to upgrade to a Surface Pro or something.

    I wonder how long before this type thing can run on iOS / Android hardware?
     
  29. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Yes, a city, town, farm, ecosystem set of functions that allow you to supply an inventory of botany, fauna, buildings while it when though bulldozing (or choosing river plain, ...), building, and distributing the contents of the inventory would be cool.
     
  30. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Flat areas are totally possible, yes. In fact you'll pretty much have total control over the terrain, even locally.

    You don't need DX11 to generate the planet. The thing works on DX9, but it's less realistic, and slower.
     
  31. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Very good news. Thx a lot.

    Nice. A perfect tool.


    Btw, forgot to ask : As a procedural system I guess the world is "flat" beyond the camera (I mean on the opposite side or hidden face), have you planned a sort of heigtmap of the world?
     
    Last edited: May 30, 2013
  32. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    OK, so I could feed to the terrain a Bezier curve, start and stop coords and whether it was a river (canal) or road and it would go through and appropriately scale the curve to fit the start stop, then erode or bulldoze the path?
     
  33. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    I'm not sure I understand your question. Terrain tiles not seen by the camera will be culled, but "exist" as mathematical representations. Could you elaborate a bit further?

    @goat: Exactly. You can provide any brush/mask to modify the terrain.
     
  34. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Most of procedural engine (like the one i use at the moment : Etherea) only build the world around the camera (the main player), perfect for a solo flight/drive, but not ideal for the other NPCs. Without an heightmap information you can move these NPCs on the surface of the world.
    How move an NPC on the culled tiles without information about the altitude where is this NPC?

    Your tool will allow us to do things like this? ;) (The colors are for debugging)
     
    Last edited: May 30, 2013
  35. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    That's pretty outstanding.
     
  36. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Here are 2 videos showing my progress for these pas 2 weeks:


     
  37. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Wowza, that's a lot of detail! Cool.
     
  38. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Fantastic. But if you don't take care of those seams it's not useable :D
     
  39. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Of course :). It's pretty simple to fix for the dx9 version. I just need a fix for the dx11 tessellated version, which shouldn't be too hard.
     
  40. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Nice job. Keep going. ;)
     
  41. Xantheron

    Xantheron

    Joined:
    Sep 3, 2012
    Posts:
    10
    Fantastic update!

    Can't wait to see more.
     
  42. Azaphrael

    Azaphrael

    Joined:
    Nov 17, 2011
    Posts:
    41
    All good and fine with planet rendering. But please don't forget about the users looking for a standard flat terrain solution.

    Would be wonderful if it also had some kind of procedural road and infrastructure generation.

    I'd really pay good money for a terrain system like in FUEL.
     
  43. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    Of course, flat terrains will be implemented. I just wanted to tackle the hardest part first :).
     
  44. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Awesome job. Those seem like really huge terrains how bigger are from default Unity terrains? Desert is especially great one becouse those kind of surfaces are hard to sculp.
     
  45. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    The terrains in the video are 16x16 km (with 1 Unity unit = 1 meter). The engine will support infinite terrains though.
     
  46. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Woow!!!
     
  47. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Amazing, are they created realtime or can you sculpt them or use displacement map to curve height?
     
  48. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    The ones you saw were created realtime, but you can also sculpt them however you want using masks.
     
  49. GdeCarpentier

    GdeCarpentier

    Joined:
    Jun 18, 2013
    Posts:
    5
    Nice to see my Jordan and Swiss noise functions being put to good use. :) Good luck with your project!
     
  50. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    293
    The terrains would have been a lot more boring without your noise functions. Thanks!