Search Unity

3D terrain best practices?

Discussion in 'World Building' started by saz_at_evenflow, Aug 26, 2022.

  1. saz_at_evenflow

    saz_at_evenflow

    Joined:
    Mar 13, 2018
    Posts:
    10
    Hi folks!
    I'll start off by mentioning I am new to Unity and C# (although I have many years of programming experience).

    So far, I've run into a couple of obstacles, one of them being deciding on HOW to actually create 3D terrain for my (platformer / adventure RPG) game.

    My approaches / considerations so far:
    • Unity Terrain Tools:
      Most youtube tutorials throw together a static scene in "x minutes", but I haven't seen many "real" gameplay examples.
      I tried using it myself, but I wanted a custom shader graph for both art-style and effects. However, I had huge problems getting it to work since the terrain doesn't behave like a "normal" mesh.
    • ProBuilder / PolyBrush:
      There often seems to be an emphasis on that this should be used for prototyping. Using ProBuilder alone seems to be fine when you are building small levels / indoor buildings etc, but not really larger environments?
      I tried creating a plane, subdividing it, and painting some hills etc with PolyBrush, but this was absolutely brutal on performance. There seems to be no control on where you want to have higher vertex density.
      A workaround is to have many smaller planes, but even with small chunks, the Editor almost kills itself when painting height unless you are going for a really low poly look (maybe bugged tool?).
    • Procedural Mesh Generation:
      While it is easy to just produce some random map at runtime using some noise algorithm, I ideally want more control than this, and to be able to tweak details while in the editor. I want to avoid the workflow of editing a heightmap in PS or similar.
      Perhaps I would be looking at creating my own editor by extending Unity via their APIs, but it would be a lot of work to actually get good in-editor painting support.
    • Sculpting in Blender:
      What I finally landed on for my first level was using Blender to create my mesh.
      This allowed me to use their sculpting tools, and also full control of where the vertices of the terrain needed density or not for improved performance.
      However, the process of jumping back and forth between Blender, exporting etc, is a pain to say the least.
    • Asset Store extensions:
      I have glanced at a couple of different terrain editors from the Asset Store, but none have actually convinced me so far.
      My primary worry is lack of control and being dependent on some other developer for fixes / updates if the current implementation is not enough. In particular I want to be able to easily extend the shader for art-style and special effects and handle "chunks" / vertex density.
      Secondly, I am a bit hesitant on spending money for such a tool.
      While the Asset Store is great in some ways, I am sure Unity takes a decent cut for any sales there, which leads to the dilemma of "why should they improve their tool in this area, if they are making money on people buying what they need from the Asset Store?". I don't really want to incentivize lack of development on their Terrain Tools.

    I can't be the only one scratching my head and wondering what is the best and most convenient way for this?
    What are you guys experience / approach?

    (Sorry for the wall of text)
     
    Gravesend likes this.
  2. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,759
    I have used Gaia in every game/project ive developed over many years (including a in-house heavily modified version), proven, updated, and support is flawless. Its the best terrain generator for Unity you will ever find. Myself i use a combo of Gaia and terrain tools (create my terrain with Gaia, then modify with terrain tools), and theres nothing i cant do. With that said, i dont know your project, you mention "platformer/adventure RPG", that can mean alot of different things.

    Maybe show us an example terrain, so we can help better :)
     
  3. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    Although Gaia is the most famous out there i never managed to work with it. I've always went with MapMagic. Just feels simpler.
     
    PutridEx likes this.
  4. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,759
    MapMagic is good, used it a few times, and is a bit simpler to use. Gaia is a more of a Pro type asset, with great functionality. In the OP's senario any terrain generator will work, then just mod it with terrain tools, if needed.
     
  5. saz_at_evenflow

    saz_at_evenflow

    Joined:
    Mar 13, 2018
    Posts:
    10
    Thanks for the reply!
    I don't really have anything useful from the game to show since it is all just prototyping that looks like crap.
    But what I'm aiming for in a "level" might be something like this:



    In addition to these non-heightmap based shapes (cliff overlook etc) I'm also looking at shader effects like:
    - Outline
    - Curved terrain
    - Maybe more..?

    I haven't had time to really dig in to exactly how the unity terrain behaves compared to a regular mesh, but at least it doesn't seem to work "straight out of the box" with the shader graph (I had trouble with my effects at least).
    Also this thread https://forum.unity.com/threads/shader-graph-for-unitys-terrain.1057802/ and the "in development" task here https://portal.productboard.com/dzcznunfgebtky7ipmhrc22z/tabs/207-3d-world-building suggests the same.

    All in all, from scouting a bit more on the asset store, the closest fit I could find so far has been this voxel editor:
    https://assetstore.unity.com/packages/tools/terrain/digger-pro-realtime-terrain-digging-149753

    Anyone that has experience with it? It seems however that it will be a combination of Unity terrain and meshes created by Digger, so how would that work with materials and in particular with the shader graphs?
     
    warthos3399 likes this.
  6. saz_at_evenflow

    saz_at_evenflow

    Joined:
    Mar 13, 2018
    Posts:
    10
    In case someone else was looking for information on this, I just thought I'd mention what solution I ended up with for now:

    I found an addon called MeshSync developed by Unity (but still WIP): https://docs.unity3d.com/Packages/com.unity.meshsync@0.17/manual/index.html

    This allows me to model my environment in Blender where I have full control of the mesh being created, and can also utilize the terrain generation addon A.N.T.
    With the click of a button my objects from Blender are imported/synced straight into Unity as GameObjects.
     
  7. yethumyat7201994

    yethumyat7201994

    Joined:
    Apr 5, 2023
    Posts:
    1
    How do you paint mesh terrain created in blender in Unity? I am looking for splat map shader to use in mobile game.Thanks