WiseLayeredGlass: HL2 Layered Glass
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
Introduction
A common feature of the windows you see in HL2 along the coast levels are windows that seal the house (area portals) and also create illusionary effects:
- From a little further away the window blocks your view.
- A little closer and the view through the window is clear.
- Break the glass and part of the frame breaks with it.
Creation
There are 4 glass panels and two dynamic props involved.
Glass layers (From outside in)
func_illusionary
panel 0.5 units thick. Textured on outer side withglass\glasswindow026a
, inner side withdev\dev_windowportal
- func_illusionary panel 0.5 units thick. Textured on outer side with
tools\toolsnodraw
, inner side withlights\white002
. - Brush 0.5 units thick textured with
tools\toolsareaportal
. - func_breakable textured with
glass\glasswindow017a
.
The func_breakable
glass panel needs an Output to force the inner frame prop to change to its broken look:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
OnBreakName | window_bars | SetBodyGroup | 1 | 0.00 | No |
Frame parts
- Outer frame is prop_dynamic.
- World model: models/props_wasteland/plasterwall029c_window01a.mdl
- Disable Shadows: Yes
- Inner frame is also
prop_dynamic
.- World model: models/props_wasteland/plasterwall029c_window01a_bars.mdl
- Disable Shadows: Yes
- Name: window_bars
- Collisions: Not Solid
- Randomly animate: No
- Body group: 0
- Start disabled: No
Notice when the inner frame spawns the Body group is set to 0
. Once the glass panels are layered they will appear to be one unit and because they are only 0.5 units thick the overall thickness is only 2.0 units. The Transform tool is very helpful in creating and moving super thin brushes.
In the sample project below I’ve created all of the panels and a frame for them. I’ve left the brushwork spaced outside of the window, so you can practice.