Glowing Textures

From Valve Developer Community
(Redirected from $selfillum)
Jump to: navigation, search

A glowing texture is one that does not require another form of light to be lit up. It can create its own lightmap independent of all lighting sources and may even create light itself. This does not mean that the surface will appear pure white, just that the face will ignore any light it would receive. This is a key feature as a "glowing" black stays black and does not get brighter. The face achieves what is called fullbright, where the texture's pixels appear exactly the same color as they were saved.

There are several different ways to create this effect available in the Source engine.

For glowing textures on models:

  1. $selfillum parameter, specified in a material's VMT. - Use this for most purposes
  2. UnlitGeneric shader, specified in certain material's VMT - does not emit light, forces face to be fullbright
  3. Using info_lighting to fool a model into thinking it is brightly illuminated.

For glowing textures on brush faces:

  1. Using Minimum Light Level value
  2. .rad file, mainly used for glowing textures on brushes. rad files are the only form of glowing textures that generate any light. 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.

Common selfillum textures can be found in White.

$selfillum textures

Warning:Cannot be used with $translucent or similar values on models. Use UnlitGeneric shader instead

By default, $selfillum takes the alpha channel of the base texture and uses it as the $selfillummask (turns it into a map for how bright each pixel of the image should appear.)

This means partial brightness or even only small areas of brightness can exist. A partially bright face can still receive light that is added to the default light on the face. The VMT property must exist.

    $basetexture props/tvscreen005a
    $selfillum 1

If using a separate $selfillum texture

    $basetexture props/tvscreen005a
    $selfillum 1
    $selfillummask <texture>

Additional parameters

$selfillumtint "[<red float> <green float> <blue float>]"
Adjusts the colour of the self-illumination effect. Default value is "[1 1 1]".
$selfillummaskscale <normal>
Scale the self-illumination effect strength. Default value is 1.0.
$selfillummask <texture>
Note: Source 2007 MUST use this!
A dedicated mask texture for the effect. Might not work in Ep1.
$selfillum_envmapmask_alpha <bool>
Has the material derive its self-illumination mask from the alpha channel of the $envmapmask. Requires DirectX 9.
$selfillumtexture <texture>
Use a selfillum texture.
Deprecated with Source 2007; doesn't work.
Allows the material to use Fresnel ranges. To do: Confirm
$selfIllumFresnelMinMaxExp [n n n]
Default: 0.0 1.0 1.0. Like the phong Fresnel ranges, but with selfillum.
A selfillum texture in use

.rad files

Warning: This method will only work on world brushes
example\exampletexture 128 192 96 400

Unlike $selfillum or the UnlitGeneric shader, lights of the specified color and brightness are generated in front of the world brush's face during VRAD complation. The brightness of the created lights is also affected by the density of the lightmap. Higher densities will produce a greater effect. The texture itself does not become fullbright, but the lights in front often make it seem so.

If a texture is specified in multiple places, it will be overridden by the latest information, for example: If both lights.rad and <game>.rad specified the same texture but <game>.rad was brighter, the light emitted in the compiled map would be the brighter <game>.rad version.

A .rad texture in use

UnlitGeneric textures

The UnlitGeneric shader forces the entire face to be full bright. The surface does not emit light, and light has no visible effect on the surface. Mainly used when the texture should appear to be a light source without forcing any light into creation. All that is required for the effect is to specify the materials shader as unlit generic. Because UnlitGenerics are their own shader they can be applied to both models and world brushes.

	$basetexture example\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.

Warning:You need to include the command $model 1 in your .vmt if your using an UnlitGeneric on a model, otherwise the surface may not show up.
A unlitgeneric texture in use

Minimum Light Level values

This is not strictly a glowing texture per se, but another way that a texture can be made to appear to glow (without shedding any actual light) is by placing it on a surface that allows you to set the Minimum Light Level float value to control the minimum amount of ambient light the surface will reflect. The most common of these is func_brush. Setting the Minimum Light Level high (from 5 to 50 or more, depending on how light the texture is) will result in the textures on the brush glowing brightly.

Warning:Increasing the Minimum Light Level can have a disproportionate effect on cubemap sampling, causing the scene to compile too brightly.
Minimum Light Level changes. From left to right: 0, 0.5, 2, 10, 25, and 50

Use of info_lighting

Models and prop_static entities can be made to glow brightly (though they do not actually emit any light) if their lighting origin key value is set to the name of an info_lighting that is placed in a lightbox isolated from the rest of the map. In the illustration below, the model to the right has been linked to an info_lighting placed in a small hollow cube with nine Light entities, each set to a brightness of 5000.

One possibly useful feature of this method of manipulating lighting is that it dynamically updates in real time. That is, if the lights in the lightbox are linked to a switch or trigger, or pre-set to pulse, flicker, or so on, the lighting on the model or prop_static will reflect these changes immediately. This might be used, for instance, to slowly darken modeled terrain to simulate the coming of evening.

Effect of linking a model to an info_lighting in a lightbox