My journey becoming a Unity game developer: Make a game look beautiful-URP & Occlusion Culling

Rhett Haynes
3 min readApr 11, 2022

--

Objective: Use Occlusion Culling on the Control Room to improve runtime performance for the CPU or GPU. This ideal for smaller rooms with hallways or corridors that the player will be entering into or exiting from.

Occlusion Culling working on the Control Room.

Unity describes Occlusion Culling is a process which prevents Unity from performing rendering calculations for game objects that are completely hidden from view by other game objects. This process can improve the runtime performance of our project by preventing wasted rendering operations for both the CPU and GPU on objects that aren’t in the camera’s view. https://docs.unity3d.com/Manual/OcclusionCulling.html

To open the Occlusion Culling tab, select Windows->Rendering->Occlusion Culling. There are 3 tabs that Occlusion Culling uses which are Object, Bake, and Visualization. Object tab allows us to click the All, Renderers, and Occlusion Areas buttons to filter the contents of the Hierarchy window. The Bake tab allows us to fine-tune the parameters of the Occlusion Culling bake process. Visualization allows us to see updates in the Scene view to show the effects of Occlusion Culling from the perspective of the selected Camera. https://docs.unity3d.com/Manual/occlusion-culling-window.html

Occlusion Culling tab opened.

To have Occlusion Culling work on the Main Camera, select the camera and turn on Occlusion Culling under Rendering.

Occlusion Culling turned on in the Main Camera Rendering properties.

Next, we need to select all objects that will be immovable in the scene, which in this case will be the Floors, Walls, Columns, Ceilings, Doorway, and Terminal game objects. In the Inspector, select the Static drop-down list and select Occluder Static and Occludee Static. Plus, select their children for these objects to be declared static in the camera’s view.

In the Occlusion tab, open the Bake tab, select the Main Camera which the occlusion will be used on, and click the Bake button.

Static objects in scene set to Occluder and Occludee Static. Then baked using the Main Camera in the scene.

In Scene view, move the Main Camera around to see the Occlusion Culling effects in action.

Occlusion Culling working using Occluder and Occludee.

Another way to setup Occlusion Culling on the static game objects is to have all of the static objects selected, go to the Static drop-down list, and select the Everything setting. Then, turn off the Contribute GI setting as this will keep Unity from including the target Mesh Renderer in Global Illumination
calculations. Move the Main Camera in the Scene, and see the Occlusion Culling effects.

Occlusion Culling working with everything turned on except Contribute GI.

--

--

Rhett Haynes
Rhett Haynes

Written by Rhett Haynes

Learning to become a Unity game developer.

No responses yet