Built-in Dynamic occlusion culling

Hi, ladies and gentlemen,

I’m looking for a way to occlude moving objects when they are not in view. In my case, the moving objects are animated enemies wandering the scene. Using Unity’s built in Occlusion culling system, I did manage to get Occlusion culling working for static objects (terrain and static environmental props/trees/rocks). However, the system fails with moving objects.

My question is, what is the easiest way to implement occlusion culling for moving objects? Do I need to write a system myself or is there a built-in way to achieve it? I have also heard good things about some of the Dynamic OC packages on the asset store, namely this one >> Unity Asset Store - The Best Assets for Game Making
But don’t want to pay for it if there is an easy way to do it myself.

As far as scripting my own occlusion culling system, my idea is to do a raycast from the enemy to the player, and only render the enemy if the ray reaches the player. Other dynamic OC systems do it the other way around, with rays coming out of the camera, but it seems much more efficient to simply have one ray per enemy. This way, I would use unity’s built in OC for static objects, and raycasting for moving objects.

let me know what you think is the best way to proceed.

Static occluders should be causing dynamic objects to be culled in Unity when you bake occlusion.
Dynamic objects won’t occlude anything using the built in unity OC.
Unless the enemy is single point in space, your method wouldn’t work using a single raycast.
So you need much more complex solution.

Could you do all that work yourself for less than $25?
Unless you make $0.50 per hour, I don’t see how.

I did it with Occlusion Area. Link I would suggest just follow this documentation :slight_smile:

Yup, adding an occlusion area solved the problem. Moving objects are now being occluded. Thanks!

Another way to achieve occlusion culling on dynamic / moving objects is by using Unity’s CullingGroup API. This option will also give you the added benefit of having more control over the objects that your occluding.