Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity Terrain System or Custom Meshes for infinite procedural generation?

Discussion in 'General Discussion' started by stor314, Jan 24, 2023.

  1. stor314

    stor314

    Joined:
    Apr 26, 2019
    Posts:
    20
    i'm trying to build an infinite terrain system that has a relatively high lod where the player is located but that region where there are a lot of triangles can be relatively small.

    i've tried implementing with custom meshes (with chunking) and subdividing the region that i need to be high detail around the player, but i'm not super versed in this area so haven't been able to find an immediately performant model. i plan to investigate things like quadtrees or octtrees to allow better performance but it seems the implementation for what i want could take a while to implement on my own.

    it seems like on the surface level unity terrain has most of the tools i'm looking for out of the box but i'm worried about performance and lack of control.

    so i'm curious, what are people's experiences with the unity terrain system and procedural generation? is it a viable option when considering performance (especially on lower end hardware/consoles, switch included)? or are custom meshes the only way to go when thinking about performance for noise based infinite terrain?
     
  2. CoastKid

    CoastKid

    Joined:
    Jan 8, 2013
    Posts:
    62
    I found the octree and compute shaders to be a pretty good combination for an infinite landscape. The octree itself is well suited for LOD and frustum culling, and with compute shaders you can create marching cubes or similar chunk geometry generation algorithms. The only thing I'm not sure about is how the Nintendo Switch will handle compute shaders.
     
  3. stor314

    stor314

    Joined:
    Apr 26, 2019
    Posts:
    20
    not super knowledgeable of compute shaders but would they allow for full collision support with the terrain?
     
  4. CoastKid

    CoastKid

    Joined:
    Jan 8, 2013
    Posts:
    62
    Yes, you can use generated chunk meshes as collision meshes so collisions will work.