Search Unity

LOD + Occlusion Culling

Discussion in 'General Graphics' started by brett_ridel, Aug 12, 2017.

  1. brett_ridel

    brett_ridel

    Joined:
    Jan 15, 2017
    Posts:
    33
    Hi all

    I'm developing a game in which the terrain is a big sphere (as a planet, but not so huge). The player is standing in its surface.

    In order to be geometrically detailed enough, I've decided to divide the sphere in some patches. Each patch is composed of triangles and is seen by Unity as a single mesh. I illustrate it in the following image (there is not height variation for explanation purpose).



    Now, I would like to combine both LOD and occlusion culling techniques : some patches are desactivated if they are not visible by the player, and each visible patch use the corresponding LOD to optimize the number of triangle.

    I made some tests with occlusion culling (without LOD), it's working pretty well.
    However, I don't know if I can combine it with LOD Group and, if so, how to visualize it (there is a visualisation for the occlusion culling, an other one for the LOD, but none of them show the combinaison of the two techniques).
    Is there a way to do this kind of things, and to visualize/debug it ?

    A also would like to know how to organize my LOD.
    Here is how my meshes are exported by ZBrush :
    If I use an empty object with LOD Group script attached to it, and each Sphere_LODx as children, does the LOD works for each individual patch (Activated patches do not necessary belong to the same mesh. Ex : patch1 is the one of Sphere_LOD0, whereas patch2 and patch3 belong to Sphere_LOD2) ? Or does it considers only each Sphere_LODx ? Here is what I would like to get (without the occlusion culling) : the patch near the player is more detailed than the ones far from him.



    Brett
     
    Last edited: Aug 12, 2017
    paladim likes this.
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    If you can do it manually why would you need unity's LOD trigger?
     
  3. brett_ridel

    brett_ridel

    Joined:
    Jan 15, 2017
    Posts:
    33
    The last image is photoshopped.
     
  4. brett_ridel

    brett_ridel

    Joined:
    Jan 15, 2017
    Posts:
    33
    I've made some tests with a simpler scene : I put a cube with 3 LOD behind a bigger cube (that do not contain LOD). The big cube is between the camera and the small LOD cube. I visualize the LOD cube with a wireframe shader, to be sure that the corresponding LOD is used.


    I can now answer both my first and my second question : yes, it's possible de use both LOD and occlusion culling. But I have to create a LOD Group for each of my patches.

    However, I've now an optimisation/performance question.
    If I want to use LOD, I have to multiply by 3 the number of mesh in my scene. Problem is, I noticed that all the 3 LOD meshes are activated, even if only one of them is visible at the same time (at least in the inspector). There is the same behavior with the Occlusion Culling. Does this not could create performance issues for Unity to handle three more time gameObject ?

    A more practical question that could help me to understand : what happens if the LOD cube is hidden by the big cube ?
    Does the 3 gameObject containing the meshes are desactivated ? Does the 3 MeshRenderer components are desactivated ? Does the LOD Group gameObject is desactivated ?

    Brett
     
    CGDever and swantonb like this.