Most of the surfaces in Quake3 reference shaders that do not exist. When they are rendered a shader is generated for them using a default shader template. The template used depends on what the surface is. In the examples below the text shaderName is replaced with the name of the non-existent shader.
Technical note: actually, the surfaces in the .bsp reference a .tga file. The .tga is ignored however and the shader with the same name used instead.
shaderName
{
{
map $lightmap
}
{
map shaderName.tga
blendFunc GL_DST_COLOR GL_ZERO
}
}
shaderName
{
{
map shaderName.tga
rgbGen diffuseLighting
}
}
If a shader contains a syntax or logic error (e.g. missing a curly bracket or a specified .tga file does not exist), Quake3 will print an error message to the console in yellow as the level is loaded. You might need to use the Page UP key to scroll up and find it.
genFuncs are used by the Quake3 engine to vary things over time. An example of this is using rgbGen with a genFunc to fade a texture map in and out.
<genFunc> <yOffset> <yScale> <startOffset> <speed>
This is the format of a standard genFunc. First is the name of the genFunc, which can be either sin, triangle, square, sawtooth, inverseSawtooth, or noise. The graphs below show the shape of each function for one cycle, with the returned value on the y axis and time on the x axis.
|
|
|
sin
| triangle
| square
|
|
|
sawtooth
| inverseSawtooth
|
The last genFunc, noise, is random and behaves rather like a sin wave after a few too many beers.
The behaviour of a genFunc can be changed by offsetting and scaling it. yOffset moves the graph up or down by the given amount. startOffset changes the start of a cycle, so a value of zero leaves the graph as shown above, and a value of 0.5 shifts them along by half a cycle. yScale scales the height of the graphs - a value of 1 leaves them as shown above, a value of .5 halves them and a value of 2 doubles them. speed is in cycles per second.
Defined as mathematically as the three alcohol filled years since my Maths A-level will allow, the genFunc performs as follows:
y = genFunc(time*speed)*yScale + yOffset
rgbGen wave sin .5 .5 0 1
This will smoothly fade a map in and out once per second. Note the two .5's make the function vary from 0 to 1 rather than from -1 to 1.
noise genFunc with a very large scale will cause it to flick randomly from one to zero. Can you say lightning?
A region of memory which holds the 'screen' as Quake3 draws it.
This effect is caused when the Quake3 engine fails for some reason to draw on part of the framebuffer. Whatever was in the framebuffer before is left there, often giving a flashing trail effect.
A file ending with the .tga extension is a Targa Graphics file. This is a format for storing graphics, like a .bmp or .jpg. The images must be stored in 24-bit (8-bit RGB) or 32-bit (8-bit RGBA) uncompressed format.
A buffer which holds the depth of each pixel in the current framebuffer.