VERC: Glass and Transparency Last edited 5 years ago2019-04-21 12:01:23 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

Introduction

Glass. Its everywhere. Windows... um... glass es... um... well, it is a fairly common material, and it seems to be one of the first things people new to editing ask about.

Method

The method for making glass is applicable to the creation of any semi-transparent object. An obvious example would be a window. A less obvious example would be the hologram from the Half-Life hazard course.
User posted image
User posted image
The results of both effects are quite different, but they both use the same basic method for the transparency.

Simple Glass

The first thing to do is start with an appropriate texture. Almost any texture could be used, depending on the application, but there are several textures made specifically for windows or other large sheets of glass. Below are 3 examples, though there are several others to choose from.
standard glass textures from the halflife.wad WAD filestandard glass textures from the halflife.wad WAD file
First, select the texture you'd like to use. Let's say we're using the first texture above, GLASS_BRIGHT. After this, switch to Block Mode and create the object that will be your window.

That is the obvious part, where most people stop, then wonder why it doesn't work. A common point of confusion among new mappers is that, once they use one of the above textures, they expect their object to be transparent, like glass. However, Half-Life textures don't have innate properties, so it's a little more complicated than that.

Now, select that glass object and press Ctrl+T to turn it into an entity. Windows are usually either a func_wall (for bulletproof glass) or a func_breakable (for normal glass that shatters when shot or hit). In its properties, set the following properties. If you're using the func_breakable entity, you'll want to make sure the following additional property is set correctly: That's all there is too it. The object will now appear to be transparent glass, once you compile and run your map.

Transparent NPCs / Holograms

In the Half-Life hazard course, you are lead through your trials by a female hologram. At least, to anyone who's watched much science fiction, she's easily identifiable as a hologram.

Transparent NPCs are quite easy to make. Place any monster, friendly or not, and set the properties as you previously did for glass: With that, you'll have a ghost NPC or monster. One extra step is required to give them the hologram effect. Set this property: For a better hologram effect, set the Render Mode property to Additive (5). This will cause the NPC to glow slightly. It gives a nice effect when the holographic character is located in a dark area, as seen in the example map.

Texture vs. Additive Transparency

Transparency can be accomplished using either Texture or Additive rendering modes. Texture transparency seemingly fades an object into the background, while Additive transparency adds the background and the object together and produces a brighter effect.

The two render modes can be expressed mathematically like this:
  • additive output = background + foreground * brightness
  • texture output = background * (1 - opacity) + foreground * opacity
The Render Amount parameter varies the brightness in the additive case, and the opacity in the texture case.

Masked Textures

There is one more form of transparency, which is when you use masked textures. You will recognize a masked texture by two things: The name of a masked texture always starts with a { character, and the portions of the texture that are supposed to be transparent are a solid color, generally blue. Below is an example, {FENCE3.
User posted image
To make the blue areas transparent, textures like these must be placed on a brush entity, most commonly on func_wall or func_illusionary entities. The following entity properties must be set: Note that, unlike other types of transparency, the Render Amount must be set to 255 for masked textures, otherwise their blue area will still be showing.

Notes

That's about it. Transparent effects are just like any other special effect: when used appropriately they will add to the atmosphere of your level. When abused, they will detract from it. It would definitely be a good idea to experiment with the different render modes and different render amounts to see what kind of effects you can produce.

For more information on the different rendering properties, check out the Rendering Properties article.

Example

For a more concrete illustration, check out the example map linked below.
This article was originally published on the Valve Editing Resource Collective (VERC).
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

You must log in to post a comment. You can login or register a new account.