This tutorial assumes you have basic knowledge of Hammer, either from Half-Life 1, or Source engine level design experience. You are expected to know how to place and create brush based entities, and know how to make at least a simple room.
By the end of the tutorial, you should be able to understand the different kinds of glass available, and how to make them.
There is an example map available (below), however this tutorial will assume you are building it all from scratch.
New style glassThere are three types of glass in the Source engine. The first kind is the new kind. This is the glass that you will have seen if you have played Half Life 2 (or cs_office in Counter Strike: Source), its defining feature is the ability to shatter when shot but stay intact – instead the glass is destroyed a bit at the time. E.g.:
This type of glass is fairly simple to make, but there are a few things you need to know to get the best out of the effect.
Firstly, make a room, lights and start point etc. Then you need to make a brush for your glass, any size will do. Any material that has been defined as glass can be used for this, but in the example map I used "glass/glasswindowbreak070a".
Now, the very important thing to remember is that only 1 surface on the glass brush should contain the glass material. All the other sides should have the nodraw texture on it. When it's rendered in game the glass texture will appear on both sides and the glass will have no thickness.
There is one more step: turning the brush into an entity! For this kind of glass we use the
func_breakable_surf entity. Go ahead and tie the glass brush to that entity now, then open its properties.
There are lots of options in the list, but I will only explain the pertinent ones:
"Prop Data" should be set to "Glass.Small".
The help file says that the "Health" field controls how much damage the glass takes before breaking, but it doesn't seem to have an effect. I think this is controlled in the material file, so for now just leave it set to 5.
"Material type" should be set to "Glass", as should "Surface Type".
"Fragility" controls how fragile the glass fragments are after being broken. For instance if this is set to a very high number (like 300) all the glass will shatter the moment it's broken. If you set the number very low (to 5 for instance) it will take a lot of built hits to completely destroy the glass. A number between 100 and 200 emulates real glass pretty well.
Note that unlike glass in Half-Life 1, you don't need to change its "Render mode" or similar options as its transparency is defined in the textures alpha channel.
Old style glassThis is the glass you know so well from Half-Life. It's built the same way you built the glass for the previous type, remembering to texture every side but one with the nodraw texture.
However instead of
func_breakable_surf, we tie it to a normal
func_breakable entity.
Again I will only explain the relevant attributes.
"Prop Data" as before, should be set to "Glass.Small".
Like the "Health" field above, "Strength" does not seem to have an effect, so leave it set to 10.
"Material type" should be set to "Glass".
And that's it. The moment the glass is shot it will shatter and disappear completely (unlike the new style glass that leaves a broken rim of glass).
Unbreakable glassThis is the easiest of the three to make. It starts the same way as the others, glass brush with the nodraw texture all on sides but one. Then all you have to do is tie it to the
func_detail entity, and you're done! No settings to configure.
That's it for this tutorial. It's all pretty straight forward but if you have any questions (or spot any omissions/mistakes) please post them in the comments below.