Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Culling in MeshInstanceRendererSystem

Discussion in 'Data Oriented Technology Stack' started by Sylmerria, Dec 1, 2018.

  1. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    213
    Hey guys,

    I have tried to stress test and to understand MeshInstanceRendererSystem.
    I drew an isometric map of 650K tiles without GPU instancing because of a crash :( (Case 1105764).
    I set my camera to see only 700 tiles and so 700 drawcalls without batches

    But I noticed that MeshInstanceRendererSystem draws 650K sprites via :


    (That comes from a build)

    So do I need to set LOD to discard rendering far from camera or I need to control which entity has to be drew or Unity team will add a culling system or how do you do ?

    Thanks :)
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    1,184
    Last edited: Dec 1, 2018
    Antypodish likes this.
  3. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    213
    So for resum how works culling in ECS from this thread and source code :

    If you want culling happens, entity needs a MeshRenderBounds, LocalToWorld( added by TransformSystem if your entity has a Position or Rotation or Scale component) and a WorldMeshRenderBounds. See MeshRenderBoundsUpdateSystem

    Set your WorldMeshRenderBounds with world position center and radius of entity.
    Your WorldMeshRenderBounds needs to be updated manually each time entity position is changed.

    Tip : you can boost culling performance if you successful group close entities in same chunk.


    @eizenhorn My bad and my shame because I begun to look Culling because of this thread and your first video but I have not see the final answer :oops:
     
    Last edited: Dec 4, 2018
    meanmonkey likes this.
  4. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    102
    thanks, your conclusion was very helpful for me
     
    Sylmerria likes this.