Tutorial: Texture Lighting Last edited 1 month ago2019-02-19 15:58:00 UTC by Solokiller Solokiller

This article was converted from a previous version of TWHL and may need to be reviewed

  1. The formatting may be incorrect due to differences in the WikiCode processing engine, it needs to be revised and reformatted
  2. Some information may be out of date
  3. After the article is re-formatted and updated, remove this notice and the Review Required category.
  4. Some older tutorials are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.

Download attachment

Texture lighting is, as the name implies, lighting your map using textures. Sounds a bit odd, doesn't it? Well, it's actually very simple, but, for some odd reason, VALVe decided to stop helping you do it.

All you need is one little text file, which you should open in Notepad. When you compile your map, the compile tools will look for this file, which, for whatever reason, VALVe don't give it to you any more (since an old version of WorldCraft). However, there are many copies of this file available on the internet. The file is called LIGHTS.RAD, and you can easily edit it to make your own texture lights. You could, for instance, decide that you wanted all the STEEL textures in your map to emit light. I'll use this as an example for this tutorial.

Here's a line from LIGHTS.RAD:
+0~FIFTS_LGHT01 160 170 220 4000
Now, as you can probably see, the first bit of text is a texture name. It's that simple - you want STEEL to emit exactly the same light as +0~FIFTS_LGHT01? Just copy the line and change the texture name, like so:
STEEL 160 170 220 4000
It's that easy. All you need to divide the texture name from the numbers with is two tabs (hit the TAB key twice, just above CAPS LOCK). I'll now explain what those numbers mean.

These numbers affect the colour of the lighting: 160 170 220. The first number is red (0-255), then green (0-255) and blue (also 0-255). So, if you wanted to make STEEL emit white light, you'd put this:
STEEL 255 255 255 4000
Bright pinky-purple would be this:
STEEL 255 0 255 4000
The last number is the brightness of the light. In the example, I have made a very bright light, but if you wanted to create subtle lighting effects, you'd probably want dimmer lights at some point. Try using different numbers. [It depends on the surface area of the texture - a very high number on a small texture won't be as bright as that same number on a huge texture. You'll just have to experiment.]

I hope I have shown you how to use Texture Lighting. If you have further questions, please post then on the forum or e-mail me.

NOTES: Download the example map for my copy of LIGHTS.RAD. You need to put this file in the same directory as ZHLT [or wherever your compilers are - the tools look for this file when you compile maps.]

3 Comments

Commented 10 years ago2008-06-01 04:56:11 UTC Comment #100595
Switchable Texture lighting (textlights) by MuzzleFlash
(found in this this thread by (c)striker.

I found this enormously useful, so thought it would be a good idea to add it. Maybe it should be it's own mini tutorial too! = )
Commented 10 years ago2008-06-01 04:57:31 UTC Comment #100596
Oops! Here's the relevant info posted by Muzz:

Why I can't get the lights turn off ? They're func_walls and when I press the button they only change their texture .

My second problem is something about sounds. For example , a triggered sound will only work if you press twice a button ( or walk 2 times through a trigger_multiple ) => it only works the second time it's triggered .

What should I do ?
29 Mar 08, 19:38
By TheGrimReafer
In reguards to your first problem,

It's your tex-lighting that's doing it. There's a tex-light file with the ORIGINAL texture (the one that's "on") that makes it put out light. Since the light entities being created are part of the texlight, you cannot name the light so it is built into the map. That light is impossible to turn off, changing a texture does not necessarily change it's texlighting properties too.

You're only bet is to find the text-light file with that texture and it's light values in it and remove it. Then you'll need to add your own lights via hammer and turn them on/off through triggers.
29 Mar 08, 20:35
By MuzzleFlash
Here's how you can make your texturelight switchable (Requires ZHLT 3.4):

Turn your light fixture into a func_wall, which i believe is already done.

Open its properties and name the brush. Now select Grouped in the Texture Light Style property. If this property does not exist, you can add it manually by turning off SmartEdit, and adding these keyvalues:

Key: style
Value: -3

Now create a light entity with the same name as the brush entity. Hlrad will now pretend that the light emitted by the texlight is "really" being emitted by your light entity. In other words, turning the light on and off will now turn the texlights on and off, too.

You'll probably want to set the brightness of the light entity to 1 1 1 0.1, so that it emits no light of its own (this trick is unnecessary if you're using Spirit of Half-Life, which supports switchable texlights directly).

If you hit Alt+P to check for problems, you'll notice one or more invalid keyvalues errors. Just ignore it, this happening because the Texture Light Style property is missing from the FGD that you're using. If want to fix this, find the func_wall FGD code and replace it with this code:

@SolidClass base(Targetname, Appearflags, RenderFields, Global, ZHLT) = func_wall : "Wall"
[
_minlight(string) : "Minimum light level"

style(choices) : "Texture Light Style" : 0 =
[
0 : "Normal"
-3 : "Grouped"
10 : "Fluorescent flicker"
2 : "Slow, strong pulse"
11 : "Slow pulse, noblack"
5 : "Gentle pulse"
1 : "Flicker A"
6 : "Flicker B"
3 : "Candle A"
7 : "Candle B"
8 : "Candle C"
4 : "Fast strobe"
9 : "Slow strobe"
12 : "Underwater"
]
]
Commented 10 years ago2008-06-01 04:59:45 UTC Comment #100597
Oops x2! (please delete previous message!) Here's the relevant info posted by muzz regarding switchable textlights:

Here's how you can make your texturelight switchable (Requires ZHLT 3.4):

Turn your light fixture into a func_wall, which i believe is already done.

Open its properties and name the brush. Now select Grouped in the Texture Light Style property. If this property does not exist, you can add it manually by turning off SmartEdit, and adding these keyvalues:

Key: style
Value: -3

Now create a light entity with the same name as the brush entity. Hlrad will now pretend that the light emitted by the texlight is "really" being emitted by your light entity. In other words, turning the light on and off will now turn the texlights on and off, too.

You'll probably want to set the brightness of the light entity to 1 1 1 0.1, so that it emits no light of its own (this trick is unnecessary if you're using Spirit of Half-Life, which supports switchable texlights directly).

If you hit Alt+P to check for problems, you'll notice one or more invalid keyvalues errors. Just ignore it, this happening because the Texture Light Style property is missing from the FGD that you're using. If want to fix this, find the func_wall FGD code and replace it with this code:

@SolidClass base(Targetname, Appearflags, RenderFields, Global, ZHLT) = func_wall : "Wall"
[
_minlight(string) : "Minimum light level"

style(choices) : "Texture Light Style" : 0 =
[
0 : "Normal"
-3 : "Grouped"
10 : "Fluorescent flicker"
2 : "Slow, strong pulse"
11 : "Slow pulse, noblack"
5 : "Gentle pulse"
1 : "Flicker A"
6 : "Flicker B"
3 : "Candle A"
7 : "Candle B"
8 : "Candle C"
4 : "Fast strobe"
9 : "Slow strobe"
12 : "Underwater"
]
]

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