Occlusion bake

From sine.space Wiki
Jump to: navigation, search

Occlusion Culling is a Unity function which can disable rendering of objects when they are not currently seen by the camera if they are occluded by other objects, which can save time from rendering.

You can get the details of advanced operation from the Documentation.

Here we only use a simple example to show you how to use this function in Sinespace.

Occlusion overview.jpg

This is the overview of a new created region. You can see there is a big cuboid and a small cube, where the small cube is occluded by the big cuboid from the view of camera, and the big cuboid is combined by 3 big cubes.

Now in menu, click Window -> Occlusion Culling to open the Occlusion window(In Unity 2018, it's Window -> Rendering -> Occlusion Culling).

There are 3 tabs in this window, object, bake and visualization.

In Object tab, you can set objects Occluder static and Occludee static. Occluder static means this object can occlude other smaller objects which has occludee static parameter checked.

Occlusion object.jpg

You can also use the option "static" in the right-top of the Inspector window. Set the objects Occluder static and Occludee static here:

Occlusion set static.jpg

It's same as the operation above. Choose the method which you prefer.


When you finished setting the objects occluder or occludee, you can bake the scene to calculate the occlusion data.

Occlusion bake.jpg

The default settings here normally is enough for most situations. If you want to adjust them, check the Unity documentation(link mentioned above) for the details of each parameter.

The occlusion volume will show after bake.

Occlusion baked.jpg

Then you can test the result in Visualization tab, if every thing is correct, when you focus on the camera, the small cube behind the big one will be invisible.

Occlusion visualization.jpg

A region with occlusion culling is complete. Remember delete the camera for test before uploading your region.


Does it really work in Sinespace?


Yes, the occlusion culling in your region will be the same as the result you tested in Unity. It may be hard for normal user to find it out, so here I present some images from the developper:

Occlusion gameview.jpg

Occlusion sceneview.jpg

The image above is the game view of the client. And switch to the scene view(image below), you can see the small cube is invisible in visualization mode, proving the occulision culling does work with Sinespace.

If we move around, to the side of one big cube, where we can see the small one, like in the image below:

Occlusion sceneview2.jpg

As you can see, the small cube can be seen now, but 2 other big cubes are invisible because of occluded by the one close to the Avatar.

As a conclusion, if you want to make your region more friendly to low-end PC or webGL, mobile platform, use occlusion culling to your region -- just set the static objects occluder and occludee, bake it with default settings, that's all.