Occlusion Culling Dynamic Objects

Hi all,

Can I using Occlusion Culling to objects which are created through a script?
I need to create 500к cubes, and make it in the editor, for calculate Occlusion Culling, but it is not possible, for example.
If it’s can’t do, how it was made on cubelands.com - there about 500k cubes and good perfomance.

Thanks!

I have never done something with the editor’s camera, but try to change the Occlusion with this:

Camera.current.cullingMask

All I know is that Camera.current, in a editor script, returns the editor camera itself.

Hope it helps you.

No. I mean the component of unity - Window->Occlusion Culling in Pro version.
I get use it only with static objects that are already on the scene in editor. But how do I use it, if the objects are created from static Prefab via script?

Oh, I’ve misunderstood it. Sorry.

Well, I don’t have pro here (I’m at work), but all I can do to help you now is recommend the SSAO screen shader:

http://unity3d.com/support/documentation/Components/script-SSAOEffect.html

I’ll check the Occlusion on pro when I get home.

Try to make each cube static.
gameObject.isStatic = true;

To explain how Occlusion culling works:

  1. Its an offline process. So you bake the occlusion data in the editor
  2. Only objects in the editor marked as static will cause an occlusion
  3. Anything else will only be occluded (be it dynamic in editor or added through code later), none of them will ever act as an occluder and you can never make them act as an occluder due to the fundamental port mentioned in step 1 (the occlusion is generated offline, there is no realtime occlusion with dynamic objects happening)

if you need occlusion from dynamic objects you must implement something yourself and think about how doing it, there is no general way to do it outside the desktop where you have the GFX Occlusion Query but that one is taxing for hardware older than GF 7900 / HD 2900 and also not exposed in Unity for usage.