Valve Developer Union

Colored Lighting in the Quake Engine

(December 20, 2017)


One of the major selling points of the Quake II and GoldSrc engines over the aging Quake engine was their ability to support colored lighting. Lights in the real world are very rarely pure white, and colored lighting is a very effective and subtle way to affect the atmosphere of the scene.

A custom scene making use of colored lighting
A custom scene making use of colored lighting

Of course, if you're willing to switch to a newer set of compilers, Quake can have colored lighting just the same. The problem is, not all versions of Quake support it.

Does my version of Quake support colored lighting?

If you're playing Quake at this point, you're likely using what's known as a source port. A source port is a version of the original Quake source code that comes with bug fixes and a host of modifications and upgrades. You can read more about them in our "Features of Modern Quake Source Ports" guide. Suffice to say, you'll need one to see any colored lighting. The original id executables do not support colored lighting.

And what about my compilers?

The other thing you'll need are custom compilers. The main compilers that support colored lighting are Tyrutils and the fork of it by Eric Wasylishen. The latter branch is what we recommend, as it also supports a host of other lighting improvements, including texture lighting, ambient and direct lighting from the skybox, bounce lighting, and ambient occlusion. (If you're installing the Windows builds, remember to grab the Visual C++ Redistributable Packages along with it.)

Installing the compilers

To install the compilers, simply unzip the build for your system into a folder. You'll likely want to install your compilers in the same location as your level editor itself, or in a subdirectory of it. J.A.C.K. keeps its default compilers in the quake subdirectory of its install directory, and Worldcraft keeps its compilers in the Q1tools subdirectory. you can either replace them, move the defaults and move the new compilers into that folder, make a subdirectory for the new compilers, or anything else you can think of. Just keep them in a place that's easy to get to.

The rest of the installation requires you to edit the game configurations for your level editor of choice. If you know how to do this, or you've already done it, skip to the "Giving your lights some color" section below.

J.A.C.K.

Go to the "Game Profiles" tab of J.A.C.K.'s "Options..." menu, found in the Tools dropdown. Select your Quake configuration and switch to the "Build Programs" tab. From here, you'll set the three paths of the three compile tools, QBSP, VIS, and LIGHT. These should point to wherever you installed the compilers.

J.A.C.K.'s options for compile tools
J.A.C.K.'s options for compile tools

Worldcraft

Worldcraft keeps its compilers in the "Options..." menu as before, but under the "Build Programs" tab. Select your Quake configuration from the dropdown and set the paths of the three compile tools, QBSP, VIS, and LIGHT. The paths should point to where you installed the compilers.

Worldcraft's options for compile tools
Worldcraft's options for compile tools

Giving your lights some color

Information

My level editor doesn't have a setting for light color. Did I install the compilers wrong?

Just because you switch out your compilers for ones with more features doesn't mean your level editor will automatically give you the options for those new features. Worldcraft-like editors require you to edit your FGD before they'll give you an option for color in SmartEdit mode. In a pinch, you can simply turn SmartEdit off and enter the keyvalue manually, as we've described here.

To color your lights, add a new keyvalue to the light called _color. It takes three parameters, much like GoldSrc and Source Hammer, for the red, green, and blue values of the light's color. This will also work for any of the light entities, including the three light_flame entities and light_torch_small_walltorch.

The _color keyvalue, added to a light
The _color keyvalue, added to a light

If you're looking for some sample colors to try, the bluish, cloudy SKY4 texture can be paired with a color value of 157 157 213, while the ominous, reddish SKY1 texture works with 168 117 138. Fire and torch entities look good with a color value of 252 190 35. Try sampling colors off of textures using an image editor if you're taking advantage of the _surface keyvalue, which, when given a texture name as a parameter, will make all uses of that texture give off light. The rest of the process is entirely up to experimentation.

Now, when you compile, the compilers will output something like this into the Compile Process Window:

Colored light entities/settings detected: .lit output enabled.

Modern source ports like Quakespasm and Mark V will load this file instead of the lightmaps embedded in the file, providing for colored light. If the LIT file is missing, the game will fall back to using standard monochrome lightmaps as embedded in the BSP and supported by the original versions of the game.

If you're curious to compare between the monochrome lighting and colored lighting, here's a comparison:

The red fluorescent base textures with and without paired colored lighting
The red fluorescent base textures with and without paired colored lighting