Welcome, Guest! Login | Register

How to make glass [Print this Article]
Posted by: Bulk
Date posted: Nov 22 2004
User Rating: 4.3 out of 5.0
Number of views: 27402
Number of comments: 10
Description: A guide on the three diffrent types of glass the source engine is capable of
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.

Zip FileFilename: tut_glass.zip
File Size: 2.8 KB

New style glass

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

user posted image

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 glass

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

user posted image

Unbreakable glass

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

user posted image

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.

Rate This Article
This article is currently rated: 4.3 out of 5.0 (4 Votes)

You have to register to rate this article.
Related Files
Zip FileFilename: glass2.jpg
File Size: 52.8 KB
Zip FileFilename: glass3.jpg
File Size: 52 KB
Zip FileFilename: glass1.jpg
File Size: 55.7 KB
Zip FileFilename: tut_glass.zip
File Size: 2.8 KB

User Comments Showing comments 1-10

Posted By: pplante on Nov 25 2004 at 02:14:44
pretty good tutorial, i was actually wondering howto do this when i was checking out hammar earlier.

but as you can guess i didnt investigate very far :)

Posted By: PiTT_DoGG on Dec 11 2004 at 17:38:38
i just cannott get this to work.

Posted By: Bulk on Dec 11 2004 at 23:59:46
In what way "not work" ?

Posted By: PiTT_DoGG on Dec 19 2004 at 21:15:27
ok how can i make this so that you cannot shoot through the glass?

Posted By: Bulk on Dec 19 2004 at 22:55:55
I havn't tested it, but I assume if you create a second brush covered entirely in the tools/clipbullits material, and place it behind the glass brush, it should work as you wish.

Posted By: PiTT_DoGG on Dec 20 2004 at 03:34:46
will that work for both sides of the glass?

Posted By: Bulk on Dec 20 2004 at 05:00:50
The side where the brush is, probably wont have any bullit decals, but it should work (Again this is all in theory, the best way is to experiment).

Posted By: SoUlFaThEr on Dec 24 2004 at 16:39:08
i dont like this glass at all.....you cant have 2 sides of it showing the bullet decals and for many windows that arent to be broken at all...this really sucks....and placing 2 of these back to back looks like hell if the window is a stained glass texture :(

ill try that clipbullets idea and tell if it worked tonight...i sure hope it does.

i also have a problem with glass disappearing after a compile but only on one side

albeit...this is for a MP mod im working on........i have 18 wiondows in this cathedral that cant be broken and sometimes the very ends of the building from the inside you cant see the glass.....and can also shoot right through it

clipbullets material better host decals :)

Posted By: Venerati0 on Jun 21 2005 at 07:05:00
Every time i make a window in my level it errors out as soon as it comes into view. Yet I made a level with 8 levels of big glass plans. Why would that work but putting two plans in my other level not work???

Posted By: child_of_despair on Jul 28 2006 at 02:57:51
So how do I edit how many bullets or how mutch damege the glass material can take befor it breacks. See I am tying this to a brick brush and I want to make it so it dosn't breack in like 2 shots.


You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005


Latest Comments
knock knock
General | News
By: omega | Dec 22 2016
 
knock knock
General | News
By: MIFUNE | Oct 10 2015
 
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
 
knock knock
General | News
By: Whistler | Nov 05 2011
 
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
 
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Persuter | Aug 02 2009
 

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (5 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!