Today we take a look at making a few different types of glass, placing them in a map and then compiling our finished work. Start off by using the block tool to create a basic room. For this tutorial, I think 256x512x768 (HxWxL) should be pretty generous. Right-click the block you create and select
Make Hollow and when it asks for the width of the walls put in -12 so that it hollows
outward.
Next you will need to make two solids (in different places) which we will need to work with. For this guide we will be making them in a large, bulky fashion so remember you can do this with your own sizes and settings. We will make our window 64x64x16, so create your solid box and then apply the
nodraw texture to the
entire box. By using the filter on the texture browser and typing
nodraw you will find at least two textures, just use the simple
nodraw, rinse and move on.
Select the face you are going to use for the window and find a suitable glass texture (you can search again for glass) and apply it to that face only. We are making a simple glass window, so the sides must be marked
nodraw or the game will "reject" the object entirely and simply not render it when running the compiled map. Once you are done texturing the object, move to the object panels and click
Tie to Entity or you may simply right-click the selected object. By default, it will have something like
env_bubbles in the drop-down list to the top. You need to select
func_breakable for our first window. Turning the object into a
func_breakable entity will result in large, chunky glass pieces when it shatters (can be seen easily from Counter-terrorist spawn on de_chateau). There are a few options (or keys and values) that should be set before you finish with your window, they are listed at the end of this article.
For the other block we made, we will do the same steps (applying a different glass texture or moving the block around so you can tell which window is which in-game would be helpful). When you tie the block to an entity, instead of
func_breakable we will select
func_breakable_surf this time. This is the key to creating the fancy glass windows you see, such as the glass from the CT spawn point on cs_office. You only need one face on the entire block to actually make it viewable from both sides, so make sure you apply the
nodraw texture to the other five sides. When both blocks are made, textured and put to entities we will tweak the glass some.
Just as always, there are keys and values to fill in for the entities. Hammer makes this a little easier with the
SmartEdit feature, which can be toggled on or off when you examine entity properties. For the sake of simplicity, we will be using
SmartEdit turned on, as there's not a real reason to turn it off for what we are doing.
To start off with, let's go over the
Object Properties window. To see this window, select the
func_breakable_surf entitypress
ALT+ENTER or go to
Edit>Properties. The class will be
func_breakable_surf and the the first key at the top will be name. For a value, type it in the box on the right. Since we will not be using a trigger we do not need to specifically name the window, but for this guide we will call this window surf. It is important to remember there will be no changes saved until you press the
Apply button at the bottom, so please take special note of this now and it will save you a world of heartbreak later.
Rather than going through the entire list of keys and values, we will take a look at the rest of the important keys that will make our glass shine (and shatter). Next up is the key
Disable shadows. If you do not want your glass windows to cast a shadow, set this to
Yes (this is a personal preference).
Performance mode is, by default, set to
normal and for good reason. This key can actually override values set on the client and force the window to break with full gibs, which could cause problems with some computers (especially on final releases of maps). Since we are testing, we will use
full gibs on all platforms (just remember always use
normal for regular glass and for distanced glass use
limit gibs). The windows we are creating are fairly large, so moving down to
Prop Data you should scroll all the way to the bottom of the list and select
Glass.Window for your type. The other glass type is
Glass.Small, for obvious reasons. Next is the
Health factor. This measures how much actual damage the glass entity will take before breaking completely -- a typical value is around (5) five.
Material type should be
Glass of course so make sure to check that before you move on. Gibs direction should be
random for normal glass windows, but if you want an explosion to blow the glass away then you can change this to
relative to attack or even go a step further with
Use precise gib dir (this requires the next key to be used). When using the latter, you must fill in the coordinates to show which direction the gibs will fly under the
precise gib direction key.
Pressure delay is important if you are trying to make glass bulge or break under pressure, for example a door window breaking from excessive heat. The purpose of the delay (measured in seconds) is to allow an audio file to play before and/or as it breaks.
If you ever noticed shooting the bottom of a glass window can make it break eventually then you already know what the
fragility key is for -- it sets how good the glass will hold when damaged. A number of 100 will cause it to really shatter, while 25 will only make parts of the glass fall out.
Surface type is the last of the keys and it should be set to
glass. Compile the map with no vis and rad, load it up and check it out. The *.VMF source map files and compiled map can be downloaded here.
This guide is dedicated to all those who would make 100% glass maps and lag us all to death.