Func areaportalwindow: Difference between revisions
m (links) |
No edit summary |
||
(42 intermediate revisions by 22 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LanguageBar}} | ||
{{CD|CFuncAreaPortalWindow|file1=func_areaportalwindow.cpp}} | |||
{{This is a|semi-internal=1|brush entity|name=func_areaportalwindow|sprite=Toolsareaportal.gif}} | |||
[[File:Hl2 d2 coast 09 areaportalwindows.png|250px|thumb|right|An example of its use on {{ent|d2_coast_09}}{{hl2}}. When the player is close to the window, the entity is inactive and the player can see through the window. When the player backs up, the objects outside are culled from the [[PVS]] and replaced with a hazy low-res texture.]] | |||
It creates an [[areaportal]] that automatically closes as the camera moves away, fading a second, opaque brush in to fill the gap.<br> | |||
It still functions like a regular areaportal, which culls the props that are not visible through it, even if the areaportal is fully open. | |||
[[File:Areaportalwindow coast12.jpg|180px|thumb|right|caption|A <code>func_areaportal_window</code> that hides interior geometry by turning black at a distance.]] | |||
Usually a <code>tools/toolsblack</code> texture, or the the <code>dev/dev_window</code> (in some games <code>dev/dev_windowportal</code>) texture is used for the func_brush entity that will be shown.<br> | |||
Toolsblack is simple, as it just hides the world behind it entirely, while dev_window and dev_windowportal show the nearest [[env_cubemap]]. Which creates the illusion that you can still see the world behind the areaportal. | |||
This nearest cubemap will be on the same side as where you're looking from. Meaning you'll see the outside cubemap when looking into a window, and the inside cubemap when looking out.<br> | |||
Due to this, you may end up seeing an object from the outside projected onto the areaportal's func_brush from certain angles, making it appear as if it was inside the room. Therefore you may want to modify the env_cubemap's "Brush faces" option to deliberately assign the outside face to the inside cubemap and vice versa. However, since this texture can only be seen when far away, it will unlikely be any real issue. | |||
You can also use func_areaportalwindow with its func_brush inside a [[func_instance]]. The linkage between portal and brush will be kept through all instances. However, env_cubemaps inside instances do not work properly, so you can not link up brush faces if you wanted to do that. | |||
{{bug|tested= {{hl2}}| The <code>dev/dev_window</code> texture has to be on both sides of the brush, combining it with any other texture (except nodraw) will result in rendering glitches (objects popping in and out of the PVS depending on player position and view angle).<br>Seemingly not an issue in {{l4d2}}.}} | |||
[[ | |||
== Keyvalues == | |||
{{KV Targetname}} | |||
{{KV|Rendered Window|intn=target|targetname|The brush entity that fills the gap left by the portal when closed.}} | |||
{{KV|Fade Start Distance|intn=FadeStartDist|int|Distance that the fade into the '''Rendered Window''' brush entity begins. The further back the player views, the more visible the brush entity will be.}} | |||
{{KV|Fade End Distance|intn=FadeDist|int|Distance at which the '''Rendered Window''' is fully visible, and the portal closes.}} | |||
{{KV|Translucency limit|intn=TranslucencyLimit|normal|Prevents the ''Rendered Window'' brush from ever going completely transparent. Useful if your rendered window uses an opaque glass material.}} | |||
{{KV|Foreground [[bmodel]]|intn=BackgroundBModel|targetname|Optional brush entity that is drawn after the fading brush model. This model should have alpha in its textures so you can see through it.}} | |||
== Inputs == | |||
{{I|SetFadeStartDistance|param=int|Sets value of {{code|FadeStartDist}}.}} | |||
{{I|SetFadeEndDistance|param=int|Sets value of {{code|FadeDist}}.}} | |||
== See also == | |||
* {{ent|func_areaportal}} | |||
* [[Optimization/Level_Design|Optimization (Level Design)]] | |||
[[Category:Optimization Brush Entities]] |
Latest revision as of 14:51, 20 April 2025


![]() |
---|
CFuncAreaPortalWindow |
![]() |

func_areaportalwindow
is a semi-internal brush entity available in all Source games.


It creates an areaportal that automatically closes as the camera moves away, fading a second, opaque brush in to fill the gap.
It still functions like a regular areaportal, which culls the props that are not visible through it, even if the areaportal is fully open.
Usually a tools/toolsblack
texture, or the the dev/dev_window
(in some games dev/dev_windowportal
) texture is used for the func_brush entity that will be shown.
Toolsblack is simple, as it just hides the world behind it entirely, while dev_window and dev_windowportal show the nearest env_cubemap. Which creates the illusion that you can still see the world behind the areaportal.
This nearest cubemap will be on the same side as where you're looking from. Meaning you'll see the outside cubemap when looking into a window, and the inside cubemap when looking out.
Due to this, you may end up seeing an object from the outside projected onto the areaportal's func_brush from certain angles, making it appear as if it was inside the room. Therefore you may want to modify the env_cubemap's "Brush faces" option to deliberately assign the outside face to the inside cubemap and vice versa. However, since this texture can only be seen when far away, it will unlikely be any real issue.
You can also use func_areaportalwindow with its func_brush inside a func_instance. The linkage between portal and brush will be kept through all instances. However, env_cubemaps inside instances do not work properly, so you can not link up brush faces if you wanted to do that.
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
- Rendered Window (target) <targetname>
- The brush entity that fills the gap left by the portal when closed.
- Fade Start Distance (FadeStartDist) <integer>
- Distance that the fade into the Rendered Window brush entity begins. The further back the player views, the more visible the brush entity will be.
- Fade End Distance (FadeDist) <integer>
- Distance at which the Rendered Window is fully visible, and the portal closes.
- Translucency limit (TranslucencyLimit) <normal>
- Prevents the Rendered Window brush from ever going completely transparent. Useful if your rendered window uses an opaque glass material.
- Foreground bmodel (BackgroundBModel) <targetname>
- Optional brush entity that is drawn after the fading brush model. This model should have alpha in its textures so you can see through it.
Inputs
- SetFadeStartDistance <integer >
- Sets value of FadeStartDist.
- SetFadeEndDistance <integer >
- Sets value of FadeDist.