Occlusion Culling Improves Performance

Let’s start by defining what occlusion culling is, I went and got the definition provided by the Unity manual.

Occlusion culling is a process which prevents Unity from performing rendering calculations for GameObjects
that are completely hidden from view (occluded) by other GameObjects.

We quickly realize that this is a very interesting tool indeed. Let’s see how it works.

Let’s go to open its tab, like lighting it has its own specific window. We find it under Windows>Rendering>Occlusion Culling.

To use this tool we must take into account that the objects in the scene must be static. In this case, we make our environment static by selecting them and going to press on the static flag.
We will be asked if we want it to be applied also to the child game objects; confirm and go on.

It is important to know, however, that this way we select all elements. If we want to exclude some like global illumination we have to click on the dropdown menu and select only the layers we want to make static.

Once everything is ready we go to the Occlusion tab and in the window called Bake, we go to bake our scene.

And finally, if we go to the Visualization window we can see our result directly in the scene.

Also from the Unity manual page, I leave you some tips on when it is convenient to use this tool.

When to use occlusion culling

- To determine whether occlusion culling is likely to improve the runtime performance of your Project, consider the following:

- Preventing wasted rendering operations can save on both CPU and GPU time. Unity’s built-in occlusion culling performs runtime calculations on the CPU, which can offset the CPU time that it saves. Occlusion culling is therefore most likely to result in performance improvements when a Project is GPU-bound due to overdraw.

- Unity loads occlusion culling data into memory at runtime. You must ensure that you have sufficient memory to load this data.

- Occlusion culling works best in Scenes where small, well-defined areas are clearly separated from one another by solid GameObjects. A common example is rooms connected by corridors.

- You can use occlusion culling to occlude Dynamic GameObjects, but Dynamic GameObjects cannot occlude other GameObjects. If your Project generates Scene geometry at runtime, then Unity’s built-in occlusion culling is not suitable for your Project.

See you in the next article 🚀

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrea Alicino

Andrea Alicino

38 Followers

Unity developer and C# programmer. Currently looking for games industry employment.