Search Unity

Open up the instanced rendering api

Discussion in 'World Building' started by snacktime, Mar 30, 2021.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    The instanced rendering implementation is quite nice, but it's tied to the rest of the terrain implementation as a whole and there is just so much more you could do with it if it was made available separately.

    The way it works for those that don't know is it's quad tree based. It has a number of static patch meshes and every frame the quad tree uses the camera view matrices to figure out what nodes to render, and then it does an offset and scale of vertices in the shader.

    The api that could be provided is very straight forward. Pretty much 3 calls. One to configure. One to fetch the base mesh data. And one to query the quad tree.

    Access to this allows for some very performant approaches for dynamic terrain and open worlds. You are rendering the terrain mesh relative to the player every frame, it's always rendering a base mesh out to the far clip plane. And then heights/texturing is somewhat separate. It's basically an overlay over the ever present meshing. And there is no terrain loading per say. This also makes it trivial to have things like ocean floors. Or rather the default is ocean and the height/texture overlays are the areas above water.


    Nvidia's waveworks 2 actually has a nice implementation of this with a very straight forward api. We use their water and I'm in the process of integrating their meshing with Microsplat for our terrain. That I have to do that for terrain is sort of wrong given Unity has this but just isn't exposing it.

    A number of AAA games use the same core meshing approach. But you can't do AAA quality without the ability to customize how you use it for the context. I think this is really a good bang for buck thing for Unity to expose. It's an advanced api sure, but honestly it's not that complex. Simpler then a lot of stuff in DOTS for example.