Search Unity

Terrain performance huge tris count

Discussion in 'General Graphics' started by bsuro10, May 14, 2022.

  1. bsuro10

    bsuro10

    Joined:
    May 13, 2021
    Posts:
    7
    Hey,
    I am building my first terrain and I don't know what am I doing wrong but my terrain has a huge number of tris: 3M.

    Is that ok for a terrain? My terrain includes trees and grass and sometimes when I paint grass I get an error that the area has too many details objects...

    What am I doing wrong? I think I place too many trees (I think I placed 20K-25K trees) but I can't remove them now because it's too many and to start over it's a long process (even with mass place)

    Any tips?
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    Possibly. 3-million is not a crazy amount for modern graphics cards (even 6 or 7 year old cards, I think). I assume your game is going to be more than just a terrain and a character controller, so it depends not only on your target hardware but also what other calculations are going on at the same time. As you develop, try profiling a build on your target platform to monitor your performance and what things are impacting it. If you're trying to recreate the BOTW overworld in one single scene, then you'll most likely-have problems, though.

    If you have performance problems related to your terrain, consider splitting it up into a number of smaller terrains and only loading in terrain sections that are in the player's immediate location. I don't think Unity's built-on terrain tools support this functionality, but I've not checked in a long time, so it may be different now. In the mean time, there are tools like World Streamer. When I google for "Unity terrain splitting" I can see some free scripts floating around too.
     
    bsuro10 likes this.
  3. bsuro10

    bsuro10

    Joined:
    May 13, 2021
    Posts:
    7
    Thanks for replying.

    My target, for now, is just to learn and develop, my PC runs my games smoothly but when I present them in class I get FPS issues (due to poor pc in college).
    I migrated from built-in rendering to URP and performance went crazy in my first scene (5M to 500-700K).
    But with this new terrain scene, I thought performance would be better than that, so I just wanted to know if you guys have any tips.

    Thank you for pointing out splitting the terrain, I built 1000X1000 terrain and I think it would be better to split it into a few terrains - I will check it out.
     
  4. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    What is the trirangle count and performance without any trees and grass.? 20K-25K is alot of trees. They can have a majot effect on the performance, depending on how may triangles they have. Do the trees have LODs?
     
  5. bsuro10

    bsuro10

    Joined:
    May 13, 2021
    Posts:
    7
    I saw something about LOD, don't know what it is
     
  6. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    LOD stands for Level of Detail and is an optimization technique. Here is some info about LODs in Unity. I suspect the trees and grass are what cause the low FPS and large triangles count in your scene and not the terrain itself. If you want to have this many trees in your scene, you'll need to use some kind of GPU Instancing solution. Something like Vegetation Studio or Critias Foliage System if you are using the Buil-In pipeline. VS is a paid asset while Critias is free.
     
    Last edited: May 15, 2022
  7. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    I never had great experiences with Unity's terrain. I usually make the terrain and then convert them to mesh (tree placement etc is worse then however)
     
  8. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    731
    Make sure to change the pixel error value in your terrain component settings. Also lods will help as stated. I would seriously recommend not splitting up terrain as you just incur a higher CPU cost for basically no GPU performance gain. Especially with only a 1K terrain. Also make sure you don't have a lot of terrain layers as every 4 layers means you have to draw the entire terrain again. So if your terrain is 100k verts with 4 layers, then with 8 layers it will be 200k verts.

    The Unity terrain system is extremely old and has been outdated in almost every way for years.