Func occluder: Difference between revisions
(Unify and correct the wording of r_occluderminarea description) |
(→Debugging Commands: Removed, this command is concerning sprite visiblity) |
||
(25 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
[[File:Occlusion example.jpg|350px|thumb|Green boxes represent occluded props, red boxes unoccluded ones.]] | {{LanguageBar}}[[File:Occlusion example.jpg|350px|thumb|Green boxes represent occluded props, red boxes unoccluded ones.]] | ||
{{this is a|semi-internal=1|brush entity|name=func_occluder|sprite=Toolsoccluder.gif}} | |||
{{clr-left}} | {{clr-left}} | ||
==Entity | {{CD|CFuncOccluder|file1=func_occluder.cpp}} | ||
It hides [[model]]s that are entirely covered by it in the player's view, according to how it has been textured. They are used to control visibility in places where | ==Entity Description== | ||
It hides [[model]]s that are entirely covered by it in the player's view, according to how it has been textured. They are used to control visibility in places where {{ent|func_areaportal}}s or [[world brush]]es are unsuitable or not working correctly. Calculations of model visibility in-game is done in real time and is not in the final compile process. Use <code>func_occluder</code>s wisely, because they do calculations in real time and can cost a lot of CPU if there are too many in a map. | |||
{{ | 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 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. | ||
Usually, all faces of a <code>func_occluder</code> are Nodraw or Skip (as seen in {{csgo|2}} maps), with the occluding faces using the Occluder or Trigger texture.<br> | |||
The occlusion will only work if the player is looking at the side that has the occluding texture "visible." If the back side is Nodraw, the occlusion will not take place if looked at from the other side. | |||
{{bug|tested={{tf2}}|Occluders placed inside an [[instance]] will not function once the map is compiled.}} | |||
== Usage == | == Usage == | ||
{{clr}} | |||
{| class=wikitable style="float:right; text-align:center" | {| class=wikitable style="float:right; text-align:center" | ||
! Texture on a func_occluder !! Effect of that face | ! Texture on a func_occluder !! Effect of that face | ||
|- | |- | ||
| [[File:Toolsoccluder.gif|link=tool textures#occluder | | [[File:Toolsoccluder.gif|link=tool textures#occluder]] || Occlude | ||
|- | |- | ||
| [[File:Toolsnodraw.gif|link=nodraw]] || Don't Occlude | | [[File:Toolsnodraw.gif|link=nodraw]] || Don't Occlude | ||
Line 19: | Line 24: | ||
===Texturing=== | ===Texturing=== | ||
This entity works according to how materials has been applied to it: | This entity works according to how materials has been applied to it: | ||
* All sides covered with the '''[[tool textures#occluder| | * All sides covered with the '''[[tool textures#occluder|Occluder]]''' materials will occlude. | ||
* All sides covered with the '''[[nodraw]]''' material will not occlude. | * All sides covered with the '''[[Tool textures#nodraw|Nodraw]]''' material will not occlude. | ||
===Occluders and Areaportals=== | ===Occluders and Areaportals=== | ||
There are several important differences between occluders and areaportals: | There are several important differences between occluders and areaportals: | ||
Line 29: | Line 33: | ||
* An occluder does not split [[visleafs|visleaves]]. | * An occluder does not split [[visleafs|visleaves]]. | ||
* An occluder can be free standing and does not need to separate two areas. | * An occluder can be free standing and does not need to separate two areas. | ||
{{Note|[[VBSP]] will display a warning saying <code>Occluder "" straddles multiple areas. This is invalid!</code> if the func_occluder is not fully enclosed in world geometry. This warning can be ignored if you intend to occlude models that may still be visible otherwise, and will not affect functionality. {{Tip|If you have a basic understanding of disassembly, you can easily jump over this warning. Binary search for <code>4F 63 63 6C 75 64 65 72 20 22 25 73</code> in a disassembly tool like IDA to find the sub-routines.}} This warning is removed in {{mapbase}} VBSP. }} | |||
===Debugging | ===Debugging Commands=== | ||
;<code>r_occlusion</code>:Activate/deactivate the occlusion system. | |||
;<code>r_occlusion</code> | ;<code>r_visocclusion</code>:Activate/deactivate wireframe rendering of what the occlusion system is doing. | ||
:Activate/deactivate the occlusion system. | ;<code>r_occludeemaxarea</code>:Prevents occlusion testing for entities that take up more than X% of the screen. 0 means use whatever the level said to use. | ||
;<code>r_visocclusion</code> | ;<code>r_occluderminarea</code>:Prevents occlusion testing for entities that take up less than X% of the screen. 0 means use whatever the level said to use. | ||
:Activate/deactivate wireframe rendering of what the occlusion system is doing. | ;<code>r_occlusionspew</code>:Activate/deactivates spew about what the occlusion system is doing. | ||
;<code>r_occludermincount</code>:At least this many occluders will be used, no matter how big they are. | |||
;<code>r_occludeemaxarea</code> | |||
:Prevents occlusion testing for entities that take up more than X% of the screen. 0 means use whatever the level said to use. | |||
;<code>r_occluderminarea</code> | |||
:Prevents occlusion testing for entities that take up less than X% of the screen. 0 means use whatever the level said to use. | |||
;<code>r_occlusionspew</code> | |||
:Activate/deactivates spew about what the occlusion system is doing. | |||
;<code>r_occludermincount</code> | |||
:At least this many occluders will be used, no matter how big they are. | |||
==Keyvalues== | ==Keyvalues== | ||
{{KV|Initial State|intn=StartActive| | {{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. | |||
:*0: Inactive | :*0: Inactive | ||
:*1: Active | :*1: Active}} | ||
{{KV | {{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|Deactivate}} | |||
{{I|Toggle|Control the state of the occluder.}} | |||
{{optim_brush}} | |||
==External links== | |||
* [[Visibility optimization|Visibility Optimization]] | |||
* [[w:Antiportal|Wikipedia on Antiportals]] (another word for occluders) | |||
{{ | |||
== | |||
* [[w:Antiportal|Wikipedia on Antiportals]] |
Latest revision as of 12:33, 26 July 2025



func_occluder
is a semi-internal brush entity available in all Source games.
![]() |
---|
CFuncOccluder |
![]() |
Entity Description
It hides models that are entirely covered by it in the player's view, according to how it has been textured. They are used to control visibility in places where func_areaportals or world brushes are unsuitable or not working correctly. Calculations of model visibility in-game is done in real time and is not in the final compile process. Use func_occluder
s wisely, because they do calculations in real time and can cost a lot of CPU if there are too many in a map.
Occluders are very useful in cases where you have reasonably large func_detail, prop, func_brush, or displacement walls. These walls 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.
Usually, all faces of a func_occluder
are Nodraw or Skip (as seen in Counter-Strike: Global Offensive maps), with the occluding faces using the Occluder or Trigger texture.
The occlusion will only work if the player is looking at the side that has the occluding texture "visible." If the back side is Nodraw, the occlusion will not take place if looked at from the other side.


Usage
Texture on a func_occluder | Effect of that face |
---|---|
![]() |
Occlude |
![]() |
Don't Occlude |
Texturing
This entity works according to how materials has been applied to it:
- All sides covered with the Occluder materials will occlude.
- All sides covered with the Nodraw material will not occlude.
Occluders and Areaportals
There are several important differences between occluders and areaportals:
- An occluder only hides props, not world geometery or static brushes.
- An occluder does not split visleaves.
- An occluder can be free standing and does not need to separate two areas.

Occluder "" straddles multiple areas. This is invalid!
if the func_occluder is not fully enclosed in world geometry. This warning can be ignored if you intend to occlude models that may still be visible otherwise, and will not affect functionality. 
4F 63 63 6C 75 64 65 72 20 22 25 73
in a disassembly tool like IDA to find the sub-routines.
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)