Search Unity

2018.3 terrains vs 2018.2

Discussion in 'World Building' started by malkere, Nov 4, 2018.

  1. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I'm trying to setup a performance test to compare 2018.2 and 2018.3 terrains. Mine is an open-world procedural game so terrain is generated in runtime. For starters I'm just trying to measure the creation of a 5x5 grid of 1024 sized terrains with 5 pixel error and then a flyby using unscaled time.

    So far 2018.2 wins, but I can't seem to get drawInstanced to turn on in runtime which is obviously almost the entire point of the test XD

    If I turn one on in the editor after the terrains are created they all swap to on.
    If I try to turn any of them on in runtime by simply going terrain.drawInstanced = true it will even immediately Debug.Log() as false. Something else I can push?
     
  2. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    New terrain team doesn't care for the forums much?
    This is where the blog post specifically said to come =o
    Super looking forward to improved terrain performance.
     
  3. zeroyao

    zeroyao

    Unity Technologies

    Joined:
    Mar 28, 2013
    Posts:
    169
    Hey,

    You'll need to include at least one terrain with drawInstanced being true to let Unity build system to know that you need the instancing variant of the terrain shader. You can also do that by using ShaderVariantCollection asset to include the variant you need for your terrain shader by choice (Standard/Diffuse/Specular or TerrainLit from HDRP).

    Cheers!
     
    malkere likes this.
  4. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Thank you for the reply zeroyao
    Unfortunately I don't seem to be able to get it to work. I've got a small terrain in scene with draw instanced enabled. I turned off details and removed the collider, but left draw and draw instanced on. Creating new terrains via script they still won't turn their drawInstanced on.

    Ok, I got it.
    The variable is attached to the Terrain component, but it needs to be set after a new TerrainData is assigned, not before.
     
  5. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I can't see any of the terrains in the build now =o
     
  6. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    The terrains aren't drawing but obviously they are being rendered, I assume a shader error or something.
    With that in mine, results in build 1920x1080 are:
    version: generation time / flyby time / fps when still
    2018.3: 7.9s / 6.7s / 57
    2018.2: 8.0s / 5.1s / 45

    So a nice jump in FPS \o/
    Interesting that the flyby seems slower. That is triggering the mesh LOD recalcs as it passes over the terrains.

    I attached the script I used. I put it on the main camera, and it requires a Canvas with two Text children, Text and fpsText.
     

    Attached Files: