The Source engine is a 3D game engine developed by Valve Corporation. Its unique features include a large degree of modularity and flexibility, an artist-driven, shader-based renderer, accurate lip sync and facial expression technology, and a powerful, efficient and completely network-enabled physics system.

Report article RSS Feed Texture Lighting

A detailed tutorial on how to set up a .RAD file for texture lighting, which is most likely the neatest lighting solution in Source.

Posted by hiyougami on Feb 14th, 2011
Intermediate Level Design/Theory.

Ever heard of a .RAD file? It's a simple notepad-able document you can throw into mapsrc to make textures emit light. Texture Lighting is a form of static lighting, built into the lightmaps of your BSP when VRAD is run during the compile process. Map-specific RADs are created as mapname.rad, and placed in your VMF's mapsrc directory (the more general method would be to make a .RAD file in the same directory as your game's gameinfo.txt). An example of a line in a .RAD:

examples\ceilings\ceiling_blue 80 80 255 20

This specifies that whenever you compile your map and there are world brushes textured with ceiling_blue from the examples\ceilings materials folder, a light blue glow will seem to come from that brush - simply put, faces with ceiling_blue will emit pale-ish blue light onto the world around them. The first part is quite obviously the material name and path, starting from materials (no .vmt is needed at the end). The second half are the RGB and Brightnessvalues of the light to be emitted, just like static light entities in Hammer - except here's the catch. This amount of light will be cast from every single lightmap grid square of that face, meaning that faces using the "texture light" should have a reasonable lightmap scale (anything below 8 or above 32 is not reasonable, although can still be used if you want the effect they give). To add more materials to the RAD file, just hit your Enter key to start a new line, and put it there. An example of texture lighting in Freecity Plaza.

The stripey floor, using $selfillum and an alpha channel for the bright effect, is set to emit blue light in mapsrc\gm_freecity_plaza.rad . So, how does this apply to imitating Beast, you may ask? The answer is cheating. In Beast, light bounces around like crazy. Colour goes everywhere and gets everywhere - just like in real life. Which is why it looks so darn perfect and gives me interesting dreams at night. Now, suppose we were to copy this effect by making our coloured textures emit coloured light.....? See? Now you're getting it! Effectively, we can cheat Source into making light look like it's bouncing around by having the textures emit light themselves. A good example of this in Plaza is on red doors and jumping planks - it just makes them fit in a whole lot more. At the same time, it highlights them out of the scenery (like they would need it, of course), providing gameplay mechanics that differ from the norm. Think of having a red door obscured by a corner - usually, the player has to look around for a bit for the door, because they don't see it at first glance. This takes up valuable time and can even cause frustration in a few cases. Now, take the same scenario, except lots of red glowy light is on the wall and floor behind the corner. The player can instantly see where to go, or at least know a possible place where they could find the exit.
An example of intensifying the bounce effect:
(Not the best example, a lot of light is being bounced already - but it's worth it!)
RAD file:

mirrorsedge/red 255 0 0 18

mirrorsedge/lightgreen 168 244 21 10

mirrorsedge/blue 40 103 237 15

A more subtle use of texture lighting in Plaza is for simple coloured walls, both indoors and outdoors. In this picture of the mall offices corridor, the room is very blue and the fire exit sign at the end also emits a green light without a light entity having to be there.
I hope you enjoyed reading these posts, so that you might try these methods yourself!

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Platforms
Windows, PS3, X360, XBOX
Company
Valve
Contact
Send Message
Official Page
Valvesoftware.com
Licence
Commercial
Release Date
Released Oct 31, 2004
Engine Watch
Track this engine
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Engines
Source
Source Commercial Released Oct 31, 2004
Related Groups
Valve
Valve Developer & Publisher