This article's documentation is for anything that uses the Source engine. Click here for more information.

func_occluder

From Valve Developer Community
(Redirected from Occluder)
Jump to navigation Jump to search
English (en)Translate (Translate)
Toolsoccluder.gif

func_occluder is a semi-internal brush entity available in all Source Source games. It hides models that are entirely covered by it in the player's view, according to how it has been textured.

C++ Class hierarchy
CFuncOccluder
CBaseEntity
C++ func_occluder.cpp
Green boxes represent occluded props, red boxes unoccluded ones.

Unlike func_areaportal or other optimization tools, occluders perform visibility calculations at run-time. They do not cut visleaves, and they do not hide world geometry (world brushes, displacements, etc). Because of this, they are much less effective when directly compared to areaportals or good Hint brush placement for optimization, and should be used primarily when the former strategies are not possible or ineffective on their own.

Note.pngNote:VBSP may display a warning saying Occluder "" straddles multiple areas. This is invalid!. This warning is obsolete and will not affect functionality. Removed in Mapbase VBSP and VBSP++.
Icon-Bug.pngBug:occluders placed in an Instance will not work due to VBSP not transforming the brushes when collapsing. Fixed in VBSP++  [todo tested in ?]

Usage

Occluders are very useful in cases where you have reasonably large func_detail, prop, func_brush, or displacement walls. These walls also do not cut visleaves and therefore will not stop props from rendering behind these walls. Adding an occluder inside the same wall will at the very least hide all props behind the brush entity walls.

They can also be very helpful if your map layout does not allow for efficient visleaf cuts in an area with a lot of visible detail props. In this situation, you can embed func_occluders in the surrounding geometry to at least reduce the amount of props rendered. An example of this would be Left 4 Dead Left 4 Dead's c8m1_apartment, where large occluders are used in the survivor starting area and the alley after leaving apartments to hide large amounts of props.

Left 4 Dead's c8m1_apartment using occluders to hide props below the starting area.

Texturing

The occlusion will only work if the player is looking at the side that has the Occluder Toolsoccluder.gif texture applied, any Nodraw Toolsnodraw.gif faces will not occlude. This means you could make, for example, a large func_occluder cube, apply nodraw to the entire thing, then apply the occluder texture to only two faces. Only those two sides will hide models when the player is facing them.

Debugging Commands

r_occlusion
Activate/deactivate the occlusion system.
r_visocclusion
Activate/deactivate wireframe rendering of what the occlusion system is doing.
r_occludeemaxarea
Prevents occlusion testing for entities that take up more than X% of the screen. 0 means use whatever the level said to use.
r_occluderminarea
Prevents occlusion testing for entities that take up less than X% of the screen. 0 means use whatever the level said to use.
r_occlusionspew
Activate/deactivates spew about what the occlusion system is doing.
r_occludermincount
At least this many occluders will be used, no matter how big they are.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Initial State (StartActive) <boolean>
If the entity starts inactive, use the Activate or Toggle inputs to turn it on. Default value is 1.
  • 0: Inactive
  • 1: Active
Occluder Number (occludernumber) <integer> !FGD
Automatically inserted by VBSP to distinguish occluders; should not be handled manually.

Inputs

Activate
Deactivate
Toggle
Control the state of the occluder.

External links