Tutorial: Texture Lighting Last edited 1 year ago2022-09-01 12:32:38 UTC

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

2 Comments

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