Post news RSS Culling Zombies

This article covers the process of building a custom real-time occlusion culling system for the zombies in RIZN.

Posted by on

I've spent my free time since the last article building a custom real-time occlusion culling system for zombies. The idea here was to roll a solution that works in tandem with the frustum culling that's already in place. This was to prevent sending any zombies that were occluded (hidden from view) by world geometry for rendering, since there are instances in which several hundred zombies can skip the rendering process entirely until they came into view.

I shared several videos via social media outlining the entire process but will only cover the most important here. I wanted a custom solution that I could easily expand on and refine over the rest of development, and I also wanted one that used data which was pre-baked in the editor, ensuring that I get the largest performance boost possible. The first step was to nail down the baking process, and I created numerous helper methods so that the resultant data could be easily visualized, as shown in the image below.

Culling data visualization

As the player moves around the scene, I query the dataset for the grid node they're currently occupying and can then run a second query on its subset of data for the grid cell of any zombie, which tells me whether or not the latter is visible from the former. If it's not visible (red area) then I can safely cull the zombie, saving me from having to render any zombies that aren't currently visible from the player's location. This is depicted in the video below which features a simple test scene I used during the development process. On the left you can see that zombies always render, even when they occluded by the structures and quarantine walls. The video on the result shows how they skipped over entirely until just before they come into view of the camera.

In practice, I'm seeing some incredibly significant performance boosts now that the system is in place and working. Max zombie counts for fully loaded quarantine zones is now upwards of 1,000 in all and spawning that many RIZN in a single zone results in them being packed together like sardines, so I'm fairly confident that this endeavor has been a complete success in that I'll never need to spawn more undead than I'm already capable of doing efficiently, regardless of how complex the world geometry gets.

I spent today going through and fixing any small bugs that came up as a result of implementing this new system and am now working towards putting all the small details in place required for me to record a full game-time day and share it. The goal is to highlight everything that's been done up to this point, including looting props for items, crafting, stim injections, and a ton of zombies - all capable of ragdolling at a moment's notice and rendering in as an efficient way as possible.

With all this work in place, I recorded a short video that helps to highlight the results, which only features 600 spawned total, far below the current max.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.