Glowing Textures

From Valve Developer Community
Revision as of 13:36, 12 June 2006 by Angry Beaver (talk | contribs) (and I said let there be texture lights)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Basics

This is a description of the steps required to achive a glowing texture. While there are a several approaches to take each will be covered here independantly. Which one you wish to use is based entirley upon the situation of your use.

A glowing texture at its base is one that does not require another form of light to be lit up. It creates its own Lightmap independant of all lighting sources and may even create light itself. This does not mean that the surface will appear pure white, just the face will ignore any light it would recive. This is a key difference as a glowing black stays black and does not get brighter. The face achive what is called fullbright, the texture appears exactly the same brightness as it is saved.

There are three different forms of this effect avalible in the source engine. The first is .rad files. A file parsed and run during the vrad compile process. The second the unlit generic shader, specified in certain material's vmt. The third is the $selfilum parameter, again specified in the material's vmt.

.rad files

An old method, supported mostly for legacy purposes .rad files are the only form of glowing textures that generate any light. Processed only during the compile process they are a text file found in the same directory as the .vmf file. The file is processed line per line, on each line is simply the name of the texture, the rgb value of the light, and then the brightness of the light.

exmaple\exampletexture 128 192 96 400

When compiled there will be automatically generated lights of the specified colour and brightness infront of the face. The face will also ignore any light applied to its face and it will appear to be fullbright.

When it comes to processing the file there are three names it looks for lights.rad, <game>.rad, then <mapname>.rad. Processed in that order any texture specified in any file will be given the lighting effect. If a texture is specified in multiple files it will be overriden by the latest information, for example if both lights.rad and <game>.rad specified the same texture but <game>.rad was brighter. Then the light emitted in the compiled map would be the brighter <game>.rad version.

To do: add img

unlitgeneric textures

The unlitgeneric shader forces the entire face to be full bright. The surface does not emit light nor does light have any visible effect on the surface. Mainly used when the texture should appear to be a light source but not wanting any light to be forced into creation. All that is required for the effect is to specify the materials shader as unlit generic.

'unlitgeneric'
{
"$basetexture" "exmaple\exampletexture"
}

A common use is that of Skybox textures, the sky is always bright and the face the texture will appear on has no form of lighting itself.

To do: add img

$selfillum textures

The $selfillum parameter is akin to the unlitgneric shader. The key difference is the flexibility selfillum grants, the selfillum paramters takes the alpha channel of the base texture and turns that into a map for how bright each pixel of the image should appear. This means parital brightness or even only small areas of brightness can exsist. A partially bright face can still recive light if it out weighs the defualt light on the face. The alpha channel has to be made when creating the material but the vmt property has to exsist aswell.

'lightmappedgeneric'
{
"$basetexture" "exmaple\exampletexture"

"$selfillum" 1
}

This effect ends up most commonly being used when the "light" part of a texture is not the entire surfaces, such as a window on a building.

To do: add img