Search Unity

Question Culling?

Discussion in 'Graphics for ECS' started by l33t_P4j33t, Jun 17, 2021.

  1. l33t_P4j33t

    l33t_P4j33t

    Joined:
    Jul 29, 2019
    Posts:
    232
    I have some questions about culling:
    -does hybrid renderer2 have dynamic culling atm
    -does it happen only for static objects
    -does it require (lightmap?) baking
    -is it possible to add the necessary components at runtime
    -how do i know if an object is being culled
    -do lights get culled

    currently i have a large scene, and there doesn't seem to be any culling, as i get 5 fps.
    for now, i have to manually add DisableRendering tag, which increases fps significantly.
    what do i have to do to give it culling?
    i know there's ocludder / ocludee monobehaviours, does this have to be added to every object to make culling work?
     
    Last edited: Jun 17, 2021
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Yes. Hybrid Renderer has dynamic frustum culling which is always enabled, and experimental dynamic occlusion culling which you have to enable manually.

    No. Frustum culling always happens for every entity, and it does not require any kind of baking. It is based on mesh bounding boxes. The occlusion culling requires some extra setup, but it does not require lightmaps either and as far as I know is usable for all entities.

    Yes. The easiest way is to use the RenderMeshUtility.AddComponents API.

    One easy way is to use RenderDoc to see if the entity was being drawn or not. The culling is not perfect, but for example entities completely outside the view frustum should not get needlessly rendered.

    Hybrid Renderer does not directly handle lights in any way, which also means that it doesn't cull lights. Light culling depends on the SRP that is being used.

    The default culling does frustum culling only, which culls objects which are outside of the camera's field of view, but it is unable to cull objects behind other objects. The Hybrid Renderer has an early experimental preview occlusion culling feature that can do this, but it is still in development and there isn't any documentation yet. If you're willing to experiment with it, you can try it out using the ENABLE_UNITY_OCCLUSION scripting define.