Search Unity

LOD Cull or SetActive(false)

Discussion in 'Scripting' started by razzraziel, Apr 6, 2019.

  1. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    Hi!

    I have lots of same object with heavy shaders (Static objects). I want them to activate when they're close to player for performance. I set their LOD with LOD0 and cull.



    But is it better solution to deactivate them with SetActive(false) with player position for same distance? (They already has a script for something else)

    Culled objects with heavy shaders doesnt cost performance right?

    And second question: If LOD cull is better choice, if i write a lighter version of my heavy shader and set it as a second LOD (LOD1) with different material, i can lower the distance. Changing material to simpler one with LODs are best practice? How does memory gets effected by this? They have all same main textures but different masks. So they all use different material instances.
     
    Last edited: Apr 6, 2019
  2. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    Culled objects with heavy shaders will take no performance whatsoever.
    Memory shouldn't be affected by material instances, just the textures and such.
    One option you could have for culling far away objects is to put these expensive static objects onto the same render layer, then setting that layer's cull distance using layerCullDistances. This would be a much cheaper option, assuming you're okay with having these objects having the same cull distance.
     
    AntonioModer and razzraziel like this.