Search Unity

Terrain performance issues

Discussion in 'Editor & General Support' started by damsku, Dec 30, 2011.

  1. damsku

    damsku

    Joined:
    Mar 10, 2011
    Posts:
    17
    Hi,

    I am using the Unity terrain and am hitting some massive performance hits when moving the camera around from high enough.
    E.g during the culling, Terrain.Details.BuildPatchMesh is called over 1083 times and takes roughly 320ms, is there any trick I can do to decrease those figures? Or is it possible to somewhat distribute building the patches over a few frames?
    Thanks
     
  2. cod

    cod

    Joined:
    Nov 26, 2011
    Posts:
    267
    same issue :(
     
  3. Lucas_Wilkins

    Lucas_Wilkins

    Joined:
    Jan 22, 2014
    Posts:
    7
  4. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Just a little push on this topic. Is there anything we can do to fix this?

    I sit at a solid 160fps on my project, but when moving around, I get sudden spikes and a short screen lag. Consistently.

    It's incredibly annoying.
     
  5. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Increase the "Pixel Error" in the terrain settings to something like 10 or 20.
     
  6. Brenden-Frank

    Brenden-Frank

    Joined:
    Aug 5, 2012
    Posts:
    110
    Larger the patch size, the longer it takes to build the patch mesh. The smaller the patch size, the more drawcalls you'll have so this too, is undesirable. This is a complicated issue I've been talking to Unity about. If the patch meshes aren't destroyed and created at runtime, they cause out of memory crashes very quickly. One solution they are considering is baking patch meshes to the terrain data, but this would increase build size significantly. There's a bug on it but it won't be fixed until 5.1

    http://issuetracker.unity3d.com/iss...tch-meshes-at-runtime-which-causes-cpu-spikes
     
  7. modernator24

    modernator24

    Joined:
    Apr 7, 2017
    Posts:
    205
    I'm currently facing this issue, and just like @makeshiftwings said, increasing pixel error helped to improve performance but there are so many ugly render results. My project was started from Unity 5.6.x and just upgraded to 2017.4, and there was a slightly better performance but still, a huge lag spike exists. I want to upgrade to something like 2018 or 2019, but external assets are not compatible with the latest version :(