Search Unity

What's the best terrain solution for 2020 LTS?

Discussion in 'World Building' started by MDADigital, Apr 2, 2021.

  1. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    On my system nvidia 3090 / AMD 5950x there is about a millisecond difference in frametime disabling terrain, it will be even bigger on a lower end system.

    Thanks to oclussion most of the terrain isn't even rendered.

    I have recorded a path in the scene so I can replay it and bench when built for good measurements.


    Here is a run with terrain

    Highest Frametime: 4.373736

    Lowest Frametime: 1.972616

    Avg frametime: 2.912005

    I have removed top and lowest 1 procent.

    With terrain disabled

    Highest Frametime: 2.739844

    Lowest Frametime: 1.457568

    Avg frametime: 2.024579

    Almost 1ms avg difference, more than 1ms in worst cases.

    Clearly something needs to be done. Increasing pixel error does help 0.05 ms or so. But is not enough. Only have two textures on this terrain and changing to microsplat didn't change anything.

    So what solution should I go with, we are on 2020 LTS forward rendering with built in, single pass instanced VR.

    One solution is microsplat and buy their terrain to mesh plugin. I want a solution with good perfomace and ease of workflow.

    Edit: there is zero detail on this terrain. No foliage
     
    sirleto likes this.
  2. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    I don’t have a direct answer, but here’s some observations I made in my own project. They might not be direct analogs but hopefully it helps some?

    16 512x512 tiles, pixel error of 10, height map 1024x1024, instanced.

    Rough rendering cost (no occlusion) was 5ms.

    Using Gaia (because I already owned it, not purchased for this project so I’m not making a recommendation vs other tools it’s just what I had) I converted the terrains to full detail meshes. Poly count was roughly 10 million but rendering time dropped to 3.4ms.

    I used reduce resolution mesh bakes, and while it dropped the poly count to a minimum of 400k keeping the same shape, the rendering cost remained 3.4ms.

    Rather than convert to a mesh, I converted them to OBJ files. Kept the same terrain shape but now my rendering overhead dropped to 0.9ms.

    Keeping it as a terrain but reducing height map and textures from 1024 to 512 dropped it to about 3.5ms.

    I didn’t dig too deep into things as I still have actual terrain sculpting changes to make and this is excluding occlusion, imposters, etc.

    Granted it depends on your desired rendering overhead and budget remaining, but unless you need specific terrain features, the old advice of at the very least converting to mesh seems to still hold true.
     
    sirleto likes this.
  3. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    You are using unity terrain object?
    I went down a similar path recently, here were my findings.

    A mesh is way way faster than terrain.

    I use this free tool to export unity terrain to mesh. http://wiki.unity3d.com/index.php?title=TerrainObjExporter

    At bare minimum, if you put a diffuse mobile shader on it, its basically free on mobile. Total piece of S*** phone and no hit to performance at all. Especially if you export a lower vertex count mesh for the lower phone, which that tool will also do.

    The problem comes in finding a good splat shader, and each layer will add performance cost.

    Here is a free one to test
    https://tech.innogames.com/terrain-shader-in-unity/

    Using the new splat shader, you can sample the unity terrain splat map you created on the original terrain. So the terrain tools are still used to both sculpt and paint the terrain.

    I tried microsplat mesh plugin and had a hard time getting the performance i wanted.

    So far, the splat shader i enjoy for features and performance on the mesh terrain is this one:
    https://assetstore.unity.com/packages/tools/terrain/terrain-to-mesh-47276

    ... actually that tool will also make the mesh, i have not tried that part as i use the free one already. (Double check shader render pipeline compatibility, i am using default render pipeline).

    Alternately, instead of a splat map that tool also will draw one large "base map" of the real terrain and all its textures. This is super fast on the mesh as it is one texture, but it will be a little blurry.

    On my higher end phone i have that splat shader drawing a few layers on a mesh terrain. Pretty happy with performance. Pixel xl4 @90fps with terrain and decent amount of stuff on the scene.

    For the lower phone i load up a less detail mesh, and i break the terrain in to pieces so i can apply separate super fast mobile shaders on it. Its not as nice as the splat shader with blending and shine and all, but it allows fast performance on the S*** phone while having some variance in terrain textures.

    I actually bridge the gap between the pieces with a mobile river or something to hide the joint.

    ...still in progress but so far thats been my method
     
    JoNax97 and Acissathar like this.
  4. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    I also avoid procedural skybox for mobiles