Check the original blog post at The Gamedev Guru: How to Use Occlusion Culling in Unity — The Sneaky Way
If you never came across an occlusion culling tutorial for Unity, let me ask you:
Can you guess what's wrong in this game's indoors scene? Have a look:
What Is Wrong Here?
Any guess what the problem is?
This problem, by the way, will happen to you in Unity by default.
Let’s see what’s going on and what you can do about it.
Table of Content
Level 1 Developer: Before Dating Occlusion Culling
In the video above you can see two areas:
What Unity renders
What the player actually sees
If you compare both, you’ll notice that we are rendering MANY more elements than what the player sees. Like, everything past that door.
That’s a frustrating issue many developers are used to live with. And it’s pure garbage because rendering unnecessary elements is making your scenes look worse than they could.
After all, if you managed to render what you needed and only that, you could ramp up the visuals of your game.
The time Unity wastes in drawing elements hidden behind walls is not spent where it matters most: rendering more detailed elements that the players actually see.
And not just visuals.
A more forgiving performance budget will let you implement more advanced gameplay elements, AI, sound, physics, you name it.
By the way, I probably said it already, but this “over-rendering” happens by default in Unity.
Rendering Hidden Elements
To combat this, some developers go through the constant pain of manually activating and deactivating entire rooms depending on where the player is.
But let me tell you: if you are settling for less than what your game could offer or you are putting extra hours on tedious workflows, then I have good news for you.
Once you swipe right and decide to date this feature, you’ll make your life easier and your game will perform better.
We call this technique occlusion culling. And you have it integrated in Unity at no extra cost.
The reason most developers ignore this technique is because it is not intuitive. And heck, even this feature is somewhat hidden from typical gamedev workflows.
But starting today, you won’t miss it again.
Ready for a date?