Search Unity

Unity Terrain GameObject versus Custom Terrain

Discussion in 'World Building' started by gcast1995, Jul 28, 2020.

  1. gcast1995

    gcast1995

    Joined:
    Oct 27, 2019
    Posts:
    25
    I was recently exploring and working through parts of Sebastian Lague's Procedural Landmass Generation series. Absolutely excellent series and I would recommend it to anyone looking to learn more about Unity and Terrain in general.

    Anyways, I ran into a question that I can't seem to get an answer to. In his series, he walks the viewer through the process of making a Terrain asset in Unity from scratch. Therefore, almost entirely within your code, you're adding a mesh, textures, and adjusting the height and colors of the Terrain. All of which (correct me if I'm wrong) you can do with the Terrain Component on the built-in Unity Terrain GameObject, as seen in another tutorial I'm following (Penny de Byl's Procedural Terrain Generation with Unity, also a fantastic series that I would recommend).

    So this leaves me with the question:

    What is the benefit of creating Terrain through these methods (Sebastian's methods) as opposed to working with the Terrain GameObject/Components (Penny's methods)?

    Lastly, I actually posted this on StackOverflow first but have not gotten an answer yet. If anyone thinks they have the right answer and also utilize StackOverflow, feel free to answer the question there well. Thanks!
     
  2. gcast1995

    gcast1995

    Joined:
    Oct 27, 2019
    Posts:
    25
  3. GermyGames

    GermyGames

    Joined:
    May 20, 2012
    Posts:
    38
    This isn't a definitive answer, but hopefully this helps.

    The main advantage I've heard of Unity Terrain vs mesh based terrain is collision handling. A mesh based terrain requires mesh collider, whereas terrain just uses heightmap data (I think). That would also be one of the the reasons why you can't have caves or overhangs in Unity terrain.

    I think they also do some work on the shader side of things to improve render performance of things like trees and grass.

    The benefits of using mesh based terrain would be the ability to manipulate it through your code, create LODS for distant terrain, and for easier terrain shader creation. You could also implement features like caves, or enabling players to dig in terrain.
     
    BikramKumar likes this.
  4. BornGodsGame

    BornGodsGame

    Joined:
    Jun 28, 2014
    Posts:
    587
    Sebastion teaches you how to make a script that automates all of it. ' Procedural ' means the land is generated automatically. Once you have the script finished, it takes like 2 seconds to generate complete terrains. Doing it by hand takes hours. I know I saw his series, but it was years ago so I am not sure, but if I remember correctly it also does things like automatically applies textures based on slopes of the terrain and height of the terrain. Yes, it it all something you can do by hand, but try painting textures based on slope by hand.
     
  5. BornGodsGame

    BornGodsGame

    Joined:
    Jun 28, 2014
    Posts:
    587
    Nah, the tutorial teaches you how to make a procedural terrain. It is still a fully normal unity terrain that behaves exactly like a normal terrain.
     
  6. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    Sebastian doesn't make a Unity terrain. It's a standard mesh with a standard mesh collider.
    -------------------------

    The main advantage to using Unity terrains is the api access to it. You can reference vertices as heights, convert heights to Texture2D and back, place objects without resorting to raycasting, and more.

    The main advantage to using a standard mesh is it's a standard mesh. You can use all the techniques you already know to work with it, and you have finer control over the resources it uses.

    It's kind of a moot point though because converting to and from terrains and meshes is pretty easy. If you're willing to spend a few bucks, there's converters on the asset store.