Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Occlusion Culling for runtime objects

Discussion in 'General Discussion' started by elmar1028, Mar 4, 2015.

  1. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    Hey guys,

    With Unity 5 out, I quickly downloaded and installed it, upgrading exiting project and getting my hands on new features (and features which weren't available to me) :D

    I have lots of objects which teleport to random locations from time to time (dynamic). However, at the beginning they are instantiated, which makes it impossible for me to "bake" them in editor.

    My question is: Is it possible to "bake" GameObject which aren't in editor, but instantiated at runtime?

    Thanks in advance :)
     
  2. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,886
    It should cull them fine. You can watch it happening in the editor when the occlusion window is open.

    I have a dungeon game with enemies that move, and it culls them when they are around a corner, etc, but it doesn't work as well as it does with larger static objects. I have an extra safety script that disables their Renderer based on getting far away from the player. It's based on OnTriggerEnter/Exit so it wouldn't work with teleporting.
     
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,500
    By typical usage of the word "bake", no. Baking is pre-calculating data for things that don't change.

    If your stuff always gets instantiated in the same place then you could of course put it there in the editor and bake that.
     
  4. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    Nope. They are instantiated at random positions as game starts.
     
  5. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    I wouldn't worry about optimization unless your game runs really bad (either for you or your players). If it's anything above 60fps with vsync off, you're good to go I think, since very few people have 120hz screens.
     
  6. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    It runs smoothly at 60 FPS on strong devices (I am developing or mobile). But slow phones experience a drop to 40 FPS.
     
  7. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,782
    I believe Dynamic Object are not compatible with occlussion culling. Dynamic object are only compatible with fustrum culling
     
  8. -Singularity-

    -Singularity-

    Joined:
    Jul 27, 2014
    Posts:
    122
  9. Nawash_

    Nawash_

    Joined:
    Mar 13, 2016
    Posts:
    3
    Hi,
    The comments are great about your plugin and the tutorial videos are very clear. :)

    I have 3 specific questions. I ask them here so the all community can see the answers.
    I'm about to buy your solution on the asset store, but just before that, here are my questions:

    - Do you handle transparency ? I mean if an object is transparent, the objects behind it should not be culled. Does the plugin handle this case ?
    Writing this I realise my question is stupid :): I will not simply add transparent object in the layer.

    - Have you any figures about the maximum number of object the plugin can handle ?

    - Will the plugin work correctly for culling objects located inside an other object ? This is mainly the case in the scene I wish to optimise: lots of objects located inside other objects, not just behind.

    If you could answer these questions, that would be cool.

    Thank you
     
    Last edited: Jul 3, 2016
  10. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Consoles run at 30fps, and as long as controls remain responsive and the lowest supported devices maintain at least that 30fps, you're good to go. I agree that you should keep optimization in mind but don't bend over backwards for it until it presents itself as an issue.
     
    Daahrien likes this.