Func occluder: Difference between revisions
(No point in having a patch for this.. don't even know what game this was for) |
(Simplify/Reformat this page to be similar to other pages.) |
||
Line 1: | Line 1: | ||
{{LanguageBar}} | {{LanguageBar}} | ||
{{this is a|semi-internal=1|brush entity|name=func_occluder|sprite=Toolsoccluder.gif}} | {{this is a|semi-internal=1|brush entity|name=func_occluder|sprite=Toolsoccluder.gif}} It hides [[model]]s that are entirely covered by it in the player's view, according to how it has been textured. | ||
{{CD|CFuncOccluder|file1=func_occluder.cpp}} | {{CD|CFuncOccluder|file1=func_occluder.cpp}} | ||
[[File:Occlusion example.jpg|thumb|Green boxes represent occluded props, red boxes unoccluded ones.]] | |||
Unlike {{ent|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|[[VBSP]] may display a warning saying <code>Occluder "" straddles multiple areas. This is invalid!</code>. This warning is obsolete and will not affect functionality. Removed in {{mapbase}} VBSP.}} | |||
== Usage == | |||
Occluders are very useful in cases where you have reasonably large {{ent|func_detail}}, [[Prop Types Overview|prop]], {{ent|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 {{l4d|2}}'s <code>c8m1_apartment</code>, where large occluders are used in the survivor starting area and the alley after leaving apartments to hide large amounts of props. | |||
[[File:Nomercy.png|thumb|{{l4d}}'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 [[tool textures#occluder|Occluder]] [[File:Toolsoccluder.gif|20px|link=tool textures#occluder]] texture applied, any [[Tool textures#nodraw|Nodraw]] [[File:Toolsnodraw.gif|20px|link=nodraw]] 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=== | === Debugging Commands === | ||
;<code>r_occlusion</code>:Activate/deactivate the occlusion system. | ;<code>r_occlusion</code>:Activate/deactivate the occlusion system. | ||
;<code>r_visocclusion</code>:Activate/deactivate wireframe rendering of what the occlusion system is doing. | ;<code>r_visocclusion</code>:Activate/deactivate wireframe rendering of what the occlusion system is doing. | ||
Line 43: | Line 27: | ||
;<code>r_occludermincount</code>:At least this many occluders will be used, no matter how big they are. | ;<code>r_occludermincount</code>:At least this many occluders will be used, no matter how big they are. | ||
==Keyvalues== | == Keyvalues == | ||
{{KV Targetname}} | {{KV Targetname}} | ||
{{KV|Initial State|intn=StartActive|boolean|If the entity starts inactive, use the <code>Activate</code> or <code>Toggle</code> inputs to turn it on. Default value is 1. | {{KV|Initial State|intn=StartActive|boolean|If the entity starts inactive, use the <code>Activate</code> or <code>Toggle</code> inputs to turn it on. Default value is 1. | ||
Line 50: | Line 34: | ||
{{KV|Occluder Number|intn=occludernumber|int|nofgd=1|Automatically inserted by VBSP to distinguish occluders; should not be handled manually.}} | {{KV|Occluder Number|intn=occludernumber|int|nofgd=1|Automatically inserted by VBSP to distinguish occluders; should not be handled manually.}} | ||
==Inputs== | == Inputs == | ||
{{I|Activate}} | {{I|Activate}} | ||
{{I|Deactivate}} | {{I|Deactivate}} |
Revision as of 18:31, 16 September 2025



func_occluder
is a semi-internal brush entity available in all Source games. It hides models that are entirely covered by it in the player's view, according to how it has been textured.
![]() |
---|
CFuncOccluder |
![]() |
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.

Occluder "" straddles multiple areas. This is invalid!
. This warning is obsolete and will not affect functionality. Removed 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'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.
Texturing
The occlusion will only work if the player is looking at the side that has the Occluder texture applied, any Nodraw
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
ortarget
).
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
orToggle
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
- Visibility Optimization
- Wikipedia on Antiportals (another word for occluders)