Tuesday, 29 July 2014

Trigger based occlusion culling

Upgraded trigger based occlusion culling script is almost done. Good alternative to Unity Pro's Umbra Occlusion Culling system.

It works, just it needs more testing. It works pretty well using any cameras on the scene. It needs some manual work, setting up the trigger. select the game objects to hide, but now, it works with children too, so it's not needed to put all the objects one-by-one if they are parented. So the workflow is way faster than before. Combined with the basic frustum culling, it is a pretty good way to keep the triangle / draw call count low.

Also clever level design is important too. Placing objects that can cover other things can help a lot with the combination of this script.

Occlusion Culling in Unity Free
Occluders

The pit lane is not ready yet on the current track I am creating, but garages and other buildings will be really good to cover a lot of other things.

Occlusion Culling in Unity Free
Two of the tribunes and some trees are hidden as they are not needed to be visible.

Unity free trigger based occlusion culling
It's that simple. Make a game object with trigger collider, place the culling script, set it to Occluder layer and it should work. Main camera needs an other object with kinematic rigidbody, which copies the camera position and when that enters the occluder, it'll hide the given game objects or game objects' children. Easy to setup and works pretty well. just good positioning of the occluder is important.