The Shader File Format Overview E-mail
Supplemental Object Documentation

1. Overview

The Shaders are ASCII (plain text) files that define the properties of any surface used primarily to calculate rendering effects at run time with a high degree of flexibility.

2. Shader Format Syntax

Each shader consists of an opening and closing bracket along with parameters, and one or more layers which specify the source images, and various other effects that modify the appearance of the surface that it may be applied to. If you want further information on what a shader is and how they work, then please have a look at the online shader manual.

2.1 Parameters

The shader may contain parameters which affect the shader globally, and changes physical attributes of all the layers. Be aware that some parameters may be order dependent, so it's good practice to place them at the very beginning and to place any layers at the end.

Q3Map2 Specific Keywords

 cull <function>

Cull determines the type of face culling for the surface that is marked with it.

 deformVertexes <function> <...>

Deform Vertexes performs a general deformation on the surfaces vertexes, changing the actual shape of the surface before rendering the layers.

 surfaceparm <parm>

Surface Parameters define the physical nature of the surfaces that are marked with them.

GLSlang Specific Keywords

 program <vertex> <fragment>

Program executes the vertex and fragment programs using the available layers for each texture unit.

2.2 Layers

The shader may contain one or more layers which consists of an opening and closing bracket along with the supported commands.

 animmap <frequency> <texture1> ... <texture8>

Animation Mapping displays a sequence of multiple images.

 cubemap <location>

Cube Mapping displays a sequence of six images arranged like the faces of a cube.

 map <texture>

Texture Mapping specifies the source image.

General Layer Keywords

 alphaGen <single>

Alpha Generator specifies the transparency channel.

 alphaFunc <function>

Alpha Functions are used when determining if a pixel should be rendered.

 blendFunc <source> <destination>

Blend Functions tell the engine how graphic layers are to be mixed together.

 depthFunc <function>

Depth Function specifies the value used for depth buffer comparisons.

 depthWrite

Depth Write enables blended surfaces to have the depth values forced.

 rgbGen <function>

Colors are generated using the specified function.

 tcGen <function>

True Code Generator specifies how texture coordinates are generated and where they come from.

 tcMod <function> <...>

True Code Modification specifies how texture coordinates are modified after they are generated.

3. Example

The following example is a set of instructions to construct a simple shader with a loaded texture map. The file name can be saved with the extension *.shader, and loaded directly into the running engine.

textures/example
{
    cull none
    {
        map "./textures/example.name"
    }
}