...
The Version Added field only is filled in if the value wasn't available to begin with when shaders were first added.
| Define Name | Example | Version Added | Notes | ||
|---|---|---|---|---|---|
#version 300 es precision highp float; | If mobile this will be defined (open GL version etc.) | ||||
#version 330 core #define mediump #define lowp #define highp | If not mobile this will be defined (open GL version etc.) | ||||
#define MAX_NUM_LIGHTS | 3 | Same as the client setting for Maximum Number of Lights | |||
#define MAX_NUM_BONES | 64 | This can vary across some versions but now is standardised to 64. | |||
#define GAMMA_CORRECTION | 1 or 0 | Gamma Correction game setting on/off | |||
#define FRAGMENT_LIGHTING | 1 or 0 | Fragment Lighting game setting on/off | |||
#define SHADER_QUALITY_MODE | 0, 1 or 2 | Shader quality mode game setting (low, medium, high) | |||
#define KEYHOLING_ENABLED | 1 or 0 | Keyholing game setting on/off | |||
#define SHADER_DEBUG_MODE | 1 or 0 | Shader debug mode on/off | |||
#define BUILD_VERSION | 8193 | This is very unlikely to change for MP servers - since the server version must match the client version - but can perhaps matter for SP modules if they want to support older versions. You can still safely use this with the BUILD_REVISION to get a more accurate picture. | |||
#define BUILD_REVISION | 35 | This is the incremental patch number at the end of the patch version. Omits the last part, eg: 1.87.8193.35.5 won't show the 5, just be "35" | |||
#define NO_DISCARD | 1 or 0 | Discard enabled or not | |||
#define POSTPROCESSING_TYPES_ENABLED | Bitmask value | See inc_postpr.shd for the bitmask values
| |||
#define varying | out or in | out = is the for types GL_VERTEX_SHADER and in = not vertex shader | |||
#define attribute | in | ||||
#define texture2D | texture | ||||
#define textureCube | texture | ||||
#define gl_FragColor compat_glFragColor out vec4 compat_glFragColor; | Only added if a fragment shader |
Shader Attributes / Variables
These are essentially variables in a sense of they are determined at that particular frame for a particular pixel depending on what the engine has there at the time. These need adding if not already defined in the shader (many default game shaders define these already).
| Attribute Name | Variable Name | Type | Example | Version Added | Already Defined? | Source of Data Notes |
|---|---|---|---|---|---|---|
Vertex Colors | vCustomColor | vec4 | attribute vec4 vCustomColor; | 1.74.8159 | No | The colors attribute of the trimesh MDL files. Only RGB is defined in the MDL spec (3 vectors). This can be used for colouring, obviously, but also for other data since the game by default doesn't use this much. |
SHD Format
Shaders are relatively standard text files, written in c-like code.
...