Search Unity

Culling Runtime Generation of Terrain to Quad-Bounds

Discussion in 'World Building' started by ferretnt, Jul 31, 2019.

  1. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    We have an AR app that displays user-controllable a sub-rectangle of a terrain (i.e. they can zoom and pan over the map using on-screen controls, but they only ever see a fixed extent of it, perhaps 2m-square in their physical viewspace) on their floor.

    To implement this as a first pass, we used a custom terrain shader and just clipped pixels outside the extent of the terrain's visible user-space bounds. This works, but is very inefficient under high magnification because lots of the terrain is potentially *inside* the screen's camera frustum but outside of the region we are going to render.

    Is there a way to say to the terrain system "don't generate terrain meshes outside of these extents"? Obviously, we'll still need to pixel clip, as it's unlikely the bounds of chunks will align with the max bounds we want to show.