This is our second contribution to our three-part series (3D configurators) on occlusion culling in Unity 4.3. In the previous contribution, how the new occlusion culling system works in Unity 4.3. We discussed the use and parameters you need to know to get the most out of occlusion culling. If you haven’t read it yet, you can do it here.
In this article, we present you with a list of general recommendations and tips to help you get the best results from occlusion culling.
Occlusion of good quality.
It may seem obvious, but of course it is the first thing you should do to make sure that your scene actually contains a meaningful occlusion. In addition, the occlusion should consist of good, large occluders as far as possible, as opposed to fine details that only accumulate when viewed from a certain angle as occluders. Umbra is usually not able to perform an occluder fusion, so even if its lush forest with lots of foliage hides something behind it, this will only be the case when the individual occluders are “accumulated”. In this sense, trees and forests in general will be rather bad occluders from Umbra’s point of view. On the other hand, a mountain is a good occluder and Umbra will certainly be able to include it in the occlusion data as expected.
Object Flags.
There are two main types of objects Umbra takes care of: Occluders and Occludees. The former are only geometry and Umbra treats them as the only solid model. The latter are those whose visibility Umbra actually tests with the occlusion data. Occluders consist of pretty much the entire geometry where the flag “Occluder Static” is set and not surprisingly Occludee who have the flag “Occludee static”.
As a rule of thumb and default, you can and should set most, if not all, of your renderers as decludees so that Umbra can and should sort them out. Also, most of your static renderers can be occluders by default. Just make sure that if your renderer isn’t opaque, it shouldn’t be occluder either. (Unity will actually issue a warning in this case). This of course includes transparent objects and the like.
But even if your object contains very small holes (e.g. a cheese slice) that you want to search, but reducing the value of the smallest hole worldwide doesn’t make sense, removing the occluder flag from the renderer is the right thing to do.
Since occluders are considered solid, correct culling can usually be guaranteed if the camera does not cut an occluder. This means, for example, if the collision system cannot prevent the camera from flying in an occluder, but you are likely to remove the occluder flag in order to obtain meaningful results.
Object granularity.
Given the fact that Umbra sorts out occlusions at the object level, it makes no sense to have objects several kilometers in size. Such massive objects are very difficult to remove because part of the object is almost always visible, especially in combination with Umbra’s conservative culling. Therefore, it is usually a good idea to divide the terrain into several areas, unless you want the entire terrain to be visible at all times.
With regard to occlusion culling, the best object subdivision is usually a natural one, which means that of course different objects should probably be kept separate during culling. So it usually doesn’t help to chunken objects too aggressively. You should only group objects that are similar in terms of visibility. On the other hand, a too fine-grained subdivision can lead to unnecessary overhead per object. In reality, this only becomes a problem when there are tens of thousands of occludes in the scene.
Perhaps it should be emphasized that only the object subdivision of occludes is important. In any case, occluders are considered a single large shell polygon soup.
Waterproof models.
In the previous article we briefly described how Umbra first voxels the Occluding geometry, groups these voxels into cells and then connects the cells with portals. Umbra is always conservative, which means that in different cases Umbra considers the occluders somewhat smaller than what they really are or vice versa the empty surfaces somewhat larger.
This means that if there happens to be an unintended hole in their occluding geometry, it is more likely to be preserved by voxelization. There is a good chance that it will be slightly enlarged in the final output data. This can lead to surprising “leaks” in the occlusion. The camera may be looking at a seemingly solid wall, but things behind the wall won’t get clogged up because there’s an unnoticed small gap somewhere.
So while voxelization repairs many unintended cracks and gaps in occlusion geometry, it is still very important to try to make the geometry as waterproof as possible. In the next article we will describe the visualization of the lines of sight, which can help you to solve these kinds of problems.
Finding the right parameter values.
Admittedly, the most difficult part of using umbra is finding the right parameter values. The default values in Unity do a good job as a starting point, assuming that a Unity unit is mapped to one meter in the game and the scale of the game is “human-like” (e.g. not modeled on a molecular level, nor is the typical object a planet or a gigantic killer robot).
A good rule of thumb is to start with relatively large values and work your way down. With the smallest holes, for example, the larger value you can use, the baking process is all the faster. Therefore, you should only turn it off when you start removing artifacts, i.e. false negatives. It also makes sense to start with a relatively large Wer for the smallest occluder.
Then you can start adjusting it downwards and see how Umbra sorts out better. Stop if the culling takes too long and/or the occlusion data becomes too large.
As for the rear surface threshold, start with 100. If your occlusion data is too large, or if you happen to get strange results, if the camera is very, very close, or possibly even cuts an occlusion, try 90 or even less. Read more in the next article.
In the next and last post, you’ll go through some common problems people encounter when using umbra.
Thank you for visiting.
Leave A Comment