User Tools

Site Tools


Sidebar

hpl3:game:visibility_area

This is an old revision of the document!


Visibility Area

Overview

The visibility area is used to divide a map into areas that should not be visible at the same time. This helps the engine cull objects that are outside of the view and should not be visible. Adding vibility areas to the map will increase performance since it will give the engine an easier time partitioning the objects. It is also possible to manually disable a visiblity area, this will hide all the objects that are inside it. An object will be part of all visibility areas that it is fully inside of.

Objects that doesn't fit inside any of the placed areas will get added to a main render container that has an infinite size.

Placement

Visibility areas should be placed around large rooms, floors or large outdoor zones. They should be placed so that when you are inside one of the areas the other areas are not visible because it is occluded by geometry (like floors or walls). If a map has multiple floors with stairways between them then it would be a good idea to place one area per floor. A visibility area should be added to rooms that have a lot of objects. If the room is big but has few objects then placing an area is not needed. Most visibility areas should be large, covering a whole floor, but some can be small if the room has a lot of expensive objects. Only objects that are fully inside an area will be added to it.

Here is an example of how I divided 1.2 into visibility areas. Four areas are used.

Settings

Add Partial Intersecting Objects

If objects that are only partially intersecting the area should be added to it. The default behaviour is that only objects that are fully inside the area will be added. Enabling this can lead to false positives and the objects being culled when they should be visible.

Min Objects Per Node

Small nodes will merge into larger ones if the number of objects per node is less than this value. This is based on the average and not enforced per node.

Max Objects Per Node

Large nodes will be split into smaller ones if the number of objects per node is larger than this value.

Scripting

Visibility_SetAreaActive(const tString &in asName, bool abActive)

Disable or enable an area and make all objects inside invisible.

Visibility_SetMainActive(bool abActive)

Disable or enable the main area and make all objects that are not part of a visibility area invisible. This can cause issues with large lights being disabled. Add Partial Intersecting Objects can be used with this to disable world the outside while inside a room.

Visibility_SetTerrainActive(bool abActive)

Hides terrain.

Notes

Visibility areas can be rotated to get a better fit. Rotating an area makes updating of dynamic objects a little more expensive.

Play around with min/max objects per node to get the best result (F5 is supported). The goal is to reduce the number of draw calls and queries with draw calls being the main stat.

hpl3/game/visibility_area.1409509007.txt.gz · Last modified: 2014/08/31 18:16 by nebej