Search Unity

Feature Request Terrain Tesselation

Discussion in 'High Definition Render Pipeline' started by PutridEx, Jan 3, 2022.

  1. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Been reading some rendering stuff about the demon souls remake, and much of its visuals come from tessellation. Almost everything has quite a bit of tessellation and for long distances. The developers showed some images with and without, and the difference was huge.

    I've been playing around with LitTesselation and its pretty good.

    When I went to try it on the terrain I remembered that's not how life works :)
    I've seen some github work (although It's quite old and seemingly abandoned) of connecting shadergraph and the terrain, which could make it possible to use the new shader graph tessellation on the terrain.

    It would need to be pretty performant though, since you'd need long distance tesselation to make it look good and avoid popping.

    I don't know how LitTesselation scales to something that big, but it has some nice options for performance.
    Although it's hard to know how performant it is since it never shows up in unity's profiler (GPU and CPU).

    I'm not sure if the shadergraph tess is the same as LitTess.

    Some pictures, using LitTesselation:

    With:
    Without: --
    With:

    Without:
     
    Last edited: Jan 3, 2022
  2. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Yes also felt for this once.

    But I have also realized some problem with tessellation and terrain - the collider of terrain is obviously not tessellated and this might result in parts of objects like character feet to be floating or drowned inside ground.
     
  3. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Hmm, true that could be a problem. I'm sure there's a way to work around that -- I feel like the tessellation solution itself should handle this issue, maybe.

    edit: Actually, https://answers.unity.com/questions/448435/better-tessellation-collision.html
    the second reply to the answer here gives a good suggestion, could be the way to do it.
     
    Last edited: Jan 3, 2022
  4. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    It might be, but for a large terrain this would generate one hell of a collider.
     
  5. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,260
    Afaik tessellation is unable to work with instanced terrain rendering at the moment. It should otherwise work correctly, but instanced rendering would have to be sacrificed.

    Tessellation can yield better performance in some cases. Ubisoft used it for things like light shafts meshes (AC4). Where instead of calculating certain shading aspects on a per-pixel basis, they were done on a per-vertex basis instead. There are bound to be fewer vertices on screen than pixels, hence fewer calculations. Since tessellation can neatly blend back to the original mesh based on distance, it scales nicely! That said, simply adding tessellation to a shader won't have the same benefit, unless it's specifically tailored to work in this way.

    For collision, a way to 1:1 match the displaced terrain geometry could be to asynchronously read back the terrain's heightmap render texture below the player, and build out a small mesh collider patch. Perhaps not super elegant or blazing fast, but very accurate and physics-compatible. Likely only needed for 2/4 feet or wheels, visible near the camera.
     
  6. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
    Johnathan is right, instanced terrain doesn't work with the terrain shader.

    For a typical case of getting to work 'out of the box'

    You would need to use the layered lit shader on a non instanced terrain, which then supports both tesselation and Triplanar over 4 textures and 1 pass still.

    Your scale resolution for accuracy would be limited to the terrain size, textures and of course the terrain accuracy slider and of course the tesselation itself.

    The overall performance of this though would have to be closely monitored along with your project scope however, so it's something to keep in mind.
     
  7. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    This is supported by the Microsplat addon. Works pretty well.