Search Unity

Leveraging the LOD class for a custom GeoMipmap implimentation

Discussion in 'Scripting' started by Caiuse, Dec 21, 2012.

  1. Caiuse

    Caiuse

    Joined:
    Jan 6, 2010
    Posts:
    30
    I'm working over some ideas with my own implementation for a terrain system. There are a number of reasons why I'm not using Unity's terrain engine, one of which being I'm creating a spherical terrain, as well as procedural. I also want full control over my terrain at base level.

    I'm looking into creating a GeoMipmap LOD system for this terrain implementation, and I have a number of approaches that I would be extremely grateful to get some feedback on.

    Firstly, at the moment I'm generating a number of Mesh for the different resolution levels of the terrain chunks. I'm considering using the LOD system within Unity rather than creating my own. Now I know that the LOD struct takes an array of Render components, so simply using the generated Mesh objects would be out of the question. The problem with this is that I'm now forced to instantiate a GameObject with a MeshFilter and MeshRenderer component for every node, which I'm assuming is going to have some CPU overhead, small or large, it could of been avoided.

    My guess would be that all the LOD class is doing is calculating the distance from the nearest point on the Renderer's AABB from the camera, probably in an optimum way which is something I would like to leverage. Would it be worth implementing my own LOD class, and class containing my mesh and bounds just to avoid the overhead issues.

    If anyone has any suggestions, maybe even a better solution It would be great to hear!

    Thanks, Caius
     
  2. descenderdante

    descenderdante

    Joined:
    Sep 3, 2009
    Posts:
    218
    Well I would suggest write your own LOD system , just useing Unity LOD would not suffice anyway since you would need to patch the holes for any 2 neighbouring patches with different resolutions .

    If you are interested in learning more about this subject I would recommend this : http://vterrain.org/LOD/Papers/ it helped me a lot when I was working on this
     
  3. Caiuse

    Caiuse

    Joined:
    Jan 6, 2010
    Posts:
    30
    Thank you so much for that link, I've read a few of those white papers but thats a great collection!

    I haven't considered the chunk stitching aspect, that definitely answers my question.

    Thanks again.