STEAM GROUP
Killing Floor Content Creators Hub KFHub
STEAM GROUP
Killing Floor Content Creators Hub KFHub
5
IN-GAME
38
ONLINE
Founded
April 30, 2015
Language
English
Kill Master Nov 20, 2016 @ 6:58pm
Precomputed Visibility: What is it? Why use it?
There seems to be a lot of confusion surrounding the topic of “Precomputed Visibility”, especially when it comes to KF2 and the role it plays.
In this short Tutorial I’m going to go over the basics of what it is, how it works, why it’s important, and how to correctly implement it.

What is “Precomputed Visibility”?

Precomputed Visibility is at its most basic is the culling (or unloading) of geometry and actors that the player cannot see, this includes lights as well.
For example when a player walks in front of a wall everything behind it is culled, this is done in order to decrease the amount of geometry rendered in the scene which will in turn increase performance.

Unlike “Dynamic Occlusion Culling” which does this automatically Precomputed Visibility actually saves this information into the level.

Why is it important?

Now you may be thinking “If Dynamic Occlusion Culling exists then why bother going through all the extra effort to set up Precomputed Visibility?”
There’s actually a pretty simple answer.
While Dynamic Occlusion Culling may cull objects you can’t see automatically it does so at a cost.
Each object that is culled requires an instruction, and the more instructions you have the longer your rendering thread time becomes which in turn will lower your overall frame rate.

Note: When set up correctly Precomputed Visibility should cull anywhere from 50 – 80% of the hidden geometry, Dynamic Occlusion Culling will take care of the rest.

How to set up “Precomputed Visibility”?

Now that you understand what Precomputed Visibility is I’m going to explain how to set it up in your level.

According to the UE3 Documentation Precomputed Visibility can be set up by simply covering the entire playable area with a “Precomputed Visibility Volume”, however in the case of the KF2 SDK in specific this method doesn’t produce very favorable results on top of that it also needlessly increases your light build time by a significant margin.

My method for setting up the Precomputed Visibility Volumes involves using a combination of strips and boxes in (no smaller than 256x256x256) in order to efficiently cover the whole playable area.

*NOTE:*
1. Make sure that all areas the player can access are fully covered by a volume otherwise you may end up with geometry culling when it’s not supposed to.
2. Sinking the volumes a few units into the floor or ground is a good habit to get into as it ensures that the Precomputed Visibility system will properly detect the surface that the volume is covering.

Once you have all your Precomputed Visibility Volumes set up make sure that the feature is enabled in your “World Properties”.

Debugging & Stat Views

Precomputed Visibility console commands;
• TogglePrecomputedVisibility - Toggles the use of precomputed visibility data.
• ShowPrecomputedVisibility - Toggles debug visualization of precomputed visibility cells
Image of Precomputed Visibility cells[i.imgur.com]

How to bring up the stat view and what to look for.

1. First let’s bring up the “Log window”, this will allow you to see the commands your inputting and weather they have been enabled or not.
To bring up the Log go to: View > Browser Windows > Log
The Log Window looks like this: Picture Link[i.imgur.com]

2. Next we will set the viewport configuration to a vertical split.
To do this go to: View > Viewport Configuration > 1x1 Vertical Split

3. Execute the command stat initviews then hit (Shift+L).
This should brigh up the “InitViews” information.

Now that you’re all set up take a look at these 3 settings. Image Link[i.imgur.com]

*Remember to stay within the Precomputed Visibility cells otherwise you won’t receive accurate data*

These values will show you how much render time you’re saving with each frame & how many objects are being culled by Precomputed Visibility.
When Precomputed Visibility was set up correctly the “Statically occluded primitives” value should be anywhere between 50 – 80% of the “Occluded primitives” value

**To see how much render time your saving with each frame input the command ToggleOcclusion to disable Precomputed Visibility and your “Occlusion Result” value should increase.
Run the command again to re-enable Precomputed Visibility and do some simple subtraction to figure out how much frame time you’ve saved by setting up Precomputed Visibility.**
(Even saving 5 or 6 milliseconds is a good result)


Lastly here’s another image showing how to enable Precomputed Visibility in the world properties and how to enable the visualization of culling and occlusion in the orthographic viewports.
Image Link[i.imgur.com]


Download for Example Map
[mega.nz]

Guide Version:
http://steamcommunity.com/sharedfiles/filedetails/?id=805273408

Tags: {Tutorial} {SDK} {KF2}
Last edited by Kill Master; Nov 24, 2016 @ 1:29am
Date Posted: Nov 20, 2016 @ 6:58pm
Posts: 0