Enter Half-Life Re-imagined, our current competition!
Check out Skewing textures in Hammer, our newest tutorial!
Say hello to Bear, our newest member!

logo

Site Stuff

Reference

Maps

Community

ShoutBOX

Poll

Valve Predictions 2017

What's the most likely thing Valve will release this year?

Nothing

18

A new game

3

More overpriced hardware

8

Source 2 SDK

11

An army of evil killer cyborgs

5

The hounds

8

Onliners

4 mins

Penguinboy

7 mins

Jessie

10 mins

Admer456

12 mins

Victor-933

29 mins

abbadon

38 mins

Bruce

46 mins

SpannerSpammer

Affiliates

A gaming and technology blog by TWHL admins Penguinboy and Ant. A music blog by TWHL users Ant and Hugh.

Glass and Transparency

By Chris 'autolycus' Bokitch

Introduction

Glass. Its everywhere. Windows... um... glasses... 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.

     

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

  • Render Mode (rendermode) - Set this to Texture (2)
  • Render Amount (renderamt) - Set this to 96. This value can range between 0 and 255. The higher the value, the more opaque the object will be (meaning, the less you'll be able to see through it).

If you're using the func_breakable entity, you'll want to make sure the following additional property is set correctly:

  • Material Type (material) - Set this to Glass (0)

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:

  • Render Mode (rendermode) - Set this to Texture (2)
  • Render Amount (renderamt) - Set this to a value between 0 and 255. The higher the value, the more opaque the NPC will be (meaning, the less you'll be able to see through him). A value of between 128 and 196 should be good.

With that, you'll have a ghost NPC or monster. One extra step is required to give them the hologram effect. Set this property:

  • Render FX (renderfx) - Set this to Hologram (Distort + Fade) (16)

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.


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:

  • Render Mode (rendermode) - Set this to Solid(4)
  • Render Amount (renderamt) - This must be set to 255.

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.