Skip to main content

Case study: Practical tips and tricks for world design

The Devouring is a large map in VRC that uses occlusion culling to squeeze the most performance out of Unity. Here is some advice from its developers.

  • Don't forget, occlusion is calculated using Opaque mesh renderers as occluders. Transparent materials will not occlude. Complex edges are bad.

  • If you want to optimize your bake for a large and complex world, especially one with "zones", add big occluder cubes between areas that should not be mutually visible. Make these EditorOnly.

  • One fun way to do occlusion is to not make any of your actual meshes occluder static, but only make occluders out of cubes, and use one obnoxious material for all these occluders (and set those objects to EditorOnly). This avoids issues that the occlusion baking has with more complicated geometry.

     

    image-1643384385653.png
    The occlusion prefabs used in The Devouring. Take note that they are behind the walls.

     

    If those objects are visually distracting in your scene, change the shader on the material to an "invisible" shader as a way to switch off your occluders while working. (Remember to switch it back to an opaque shader for baking.)

    In this case, they are just behind the wall, and same width. For the decorative pillars, they would be inside — for example, if you have a little jog/indentation in a pillar or wall, you don't want to have blinks when you look just at that area. In general, make your fake occluders a little smaller than exposed edges.

    If you can see pink on the inside of your scene, you know you have a place where you might get false positive occlusion. If you don't see pink on the outside, you know that's a gap in your occlusion.

     

  • The Devouring was made of modular assets. All the walls had occluder boxes in them as part of the prefab, which simplified the occluder setup, baking, and eliminated a lot of occlusion errors. You could also see them as pink walls in the scene and fairly easily visualize where they were working. This was combined with giant occluders in a separate GameObject, enabled only for baking.

  • Occlusion areas are great for large maps in chunks, but beware that in 2018 you will sometimes get "blinks" in VR when passing between areas. Very frustrating, but we could find no way around it.

  • Unity 2018 is very frustrating to work with when occlusion is baked, as it hides things from you in the editor. Change your bake settings to something less defined while working to make it easy to clear and rebake quickly. Do a more detailed bake once you are ready to optimize.

  • Think about occlusion when designing worlds. If you don't need an open space, throw a wall there. Add corners and zigzags into hallways to occlude the other side. Block up big open views if they're not showing things off. Try to keep the player from seeing too much at one time — this is especially true for party instances, when occluding players is one of the biggest performance boosts you can make.

    image-1643384451136.png
    An example from The Devouring of occluding corridors.