Func areaportalwindow: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(added some more info on how this entity may be used, along with adding a link to the optimization page)
Line 5: Line 5:


{{bug|(Known to affect Half-Life 2) 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).}}
{{bug|(Known to affect Half-Life 2) 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).}}
{{note|Depending on how large the window or doorway is, and how much distance you can get between yourself and the areaportal, the longer the fade distance should be.<br>
You do not want to be walking up to a doorway for a while and see it fade from black to whatever is behind it.}}
It is recommended that the rendered window brush should use <code>tools/black.vmt</code> when seen from the outside, because fading from black to a dark interior is less jarring.<br>
Alternatively, if the room is lit in a specific color, make a simple texture that uses the same color as the light inside the room to make it appear as if the light was illuminating the room.<br>
Looking from the inside out, <code>dev/dev_window.vmt</code> (or <code>dev/dev_windowportal.vmt</code>) would be a good idea. You can even movidy a nearby {{ent|env_cubemap}} outside the building to assign the window brushes sides to it, via "brush sides". Which forces the areaportal window brush to use the outside cubemap to make it a little more believable.


==Keyvalues==
==Keyvalues==
Line 20: Line 27:
==See also==
==See also==
*{{ent|func_areaportal}}
*{{ent|func_areaportal}}
*[[Optimization/Level_Design|Optimization (Level Design)]]

Revision as of 11:00, 19 May 2024

English (en)Translate (Translate)
C++ Class hierarchy
CFuncAreaPortalWindow
CFuncAreaPortalBase
CBaseEntity
C++ func_areaportalwindow.cpp
An example of its use on d2_coast_09Half-Life 2. 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.

A func_areaportal_window that hides interior geometry by turning black at a distance.
Icon-Bug.pngBug:(Known to affect Half-Life 2) The dev/dev_window 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).  [todo tested in ?]
Note.pngNote:Depending on how large the window or doorway is, and how much distance you can get between yourself and the areaportal, the longer the fade distance should be.
You do not want to be walking up to a doorway for a while and see it fade from black to whatever is behind it.


It is recommended that the rendered window brush should use tools/black.vmt when seen from the outside, because fading from black to a dark interior is less jarring.
Alternatively, if the room is lit in a specific color, make a simple texture that uses the same color as the light inside the room to make it appear as if the light was illuminating the room.
Looking from the inside out, dev/dev_window.vmt (or dev/dev_windowportal.vmt) would be a good idea. You can even movidy a nearby env_cubemap outside the building to assign the window brushes sides to it, via "brush sides". Which forces the areaportal window brush to use the outside cubemap to make it a little more believable.

Keyvalues

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.
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

Inputs

SetFadeStartDistance <integerRedirectInput/integer>
Sets Fade Start Distance.
SetFadeEndDistance <integerRedirectInput/integer>
Sets Fade End Distance.

See also