Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


DefineTypeDefined ByPurpose
SHADER_TYPEintEngine or MTR file

1 = Vertex Shader
2 = Fragment Shader

LIGHTINGintEngine or MTR file1 = Will get and perform lighting information in both vertex and fragment shaders
KEYHOLINGintEngine or MTR file1 = Will allow keyholing to clip away fragments which could obscure player view
FOGintEngine or MTR file1 = Will get and perform fog application
NORMAL_MAPintEngine or MTR file1 = Expects to find a normal map in material texture1 line
Will enable normal map functions
SPECULAR_MAPintEngine or MTR file1 = Expects to find a specular map in material texture2 line
Will enable specular map functions
ROUGHNESS_MAPintEngine or MTR file1 = Expects to find a specular map in material texture3 line
Will enable roughness map functions
HEIGHT_MAPintEngine or MTR file1 = Expects to find height map in material texture4 line
Will enable height map calculations and fragment displacement
SELF_ILLUMINATION_MAPintEngine or MTR file1 = Expects to find illumination map in material texture5 line
Will enable self illumination coloring and lighting
ENVIRONMENT_MAPintEngine or MTR file1 = Expects to use an environment map
POSITION_WORLDintMTR file1 = Will calculate world position in the vertex shader and pass that info to the fragment shader
Handy information for UV coordinates based on world space
Used for water rendering
SPECULAR_LIGHTintEngine1 = This vertex will get specular light. Enables specularity, roughness, and metalicness features
FRAGMENT_NORMALintEngine1 = Normal will be derived from fragment normal
VERTEX_COLORintEngine1 = Vertex color will be passed forward from vertex shader
LIGHTINGintEngine1 = Vertex color will come from lighting
MATERIAL_READ_SELF_ILLUMINATION_FROM_SPECULAR_MAPintMTR1 = Will read B&W self-illumination data from specular map (material texture2) blue channel, instead of full color from texture5

Various values equivalent to the shader debug mode options on the in-game debug GUI panel
0 = Disabled
1 = Normals
2 = Material Base Texture
3 = Material Ambient
4 = Material Diffuse
5 = Material Emissive
6 = Material Specularity
7 = Material Roughness
8 = Material Metallicness
9 = Material Specular Color
10 = Material Light Occlusion
11 = Light Total
12 = Light Static
13 = Light Ambient
14 = Light Diffuse
15 = Light Specular
16 = Vertex Normals
17 = Vertex Tangents
18 = Vertex Handedness

NO_TEXTUREintEngine1 = if there is no texture map passed to shader
NO_TEXTURE_COORDSintEngine1 = if there is no UV data passed to the shader
POSITION_VIEWintMTR1 = Will calculate position view in the vertex shader and pass that info to the fragment shader
GAMMA_CORRECTIONintEngine1 = Will perform gamma correction type based on subtype
Also changes how lights are sent to the shader
Also changes light attenuation ranges
1 = Basic color clamp ("Neutral Brightness and Hue Preserve")
2 = ACES color correction
POSTPROCESSINGintEngine1 = Means this pass is the post processing pass
1 = GGX
other = Beckmann
SPECULAR_GEOMETRIC_SHADOWINGintEngine2 = Factors in roughness
SHADER_QUALITY_MODEintEngineModifies various shader quality outcomes
0 = Fast Fresnel, no light softening, no roughness shadowing


>1 = Slower Fresnel, extra light fading and mixing,
SPECULAR_FRESNELintEngine1 = Modifies specular intensity by Fresnel
2 = Mixes Fresnel specularity into specularity
LIGHT_SOFTENING_ENABLEDintEngine1 = Smooths light application
NO_DISCARDintEngine1 = Prevents discard calls, forcing 0% alpha to still try drawing on a fragment
MATERIAL_ROUGHNESS_OVERRIDEintEngine1 = Signals shader that roughness value will be in the form of a parameter from the MTR file. Used more explicitly in inc_water.
MATERIAL_SPECULARITY_OVRRIDEintEngine1 = Signals shader that specularity value will be in the form of a parameter from the MTR file. Used more explicitly in inc_water.
MATERIAL_METALICNESS_OVERRIDEintEngine1 = Signals shader that metalicness value will be in the form of a parameter from the MTR file. Used more explicitly in inc_water.
MATERIAL_READ_ROUGHNESS_FROM_SPECULAR_MAPintMTR1 = Will read roughness from texture2 green channel, instead of from texture3 red channel
MATERIAL_SPECULAR_COLOR_OVERRIDEintEngine1 = Changes how specular color is handled. Used more explicitly in inc_water.
MOBILEintEngine1 = User is on a mobile device. Handles differences in how bones and other aspects are handled.

Holds the flags for each enabled post processing subroutine that is turned on.
1 = Sharpen
2 = Depth of Field Blur
4 = Dynamic Contrast
8 = Vibrance
16 = Gamma Correction
32 = Preview 35 "Toon" Filter


Identifies the max number of lights available to the shader lighting loops and the array size of the light data arrays.
Value is modified by client options.

MAX_NUM_BONESintEngineIdentifies how many bones are being sent into the vertex shader for orientation and position calculation of that vertex.
BUILD_VERSIONintEngineContains the version number like "8192"

Contains the revision number like "35"


Shader Include


Files and Hierarchy

The OC shaders have include files which include other include files, not unlike supermodel structure in models and their animations.


As of preview build  v.87.8193.35[dd1322cd] custom shaders making use of uniforms copied from inc_water/fs_water will give "redefinition" error #198 in the toolset, such as:

ERROR: 1:4352: error(#198) Redefinition error: moduleMinutesPerHour

To fix that issue, simply remove any line using "uniform <type> <name>" where <name> is defined as a uniform within inc_uniforms

As of preview buld  vbuild v.87.8193.35[2070a8b9] an additional subset of uniforms was moved into inc_uniforms.

Include Files


Contains standard shader application functions, as well as debug modes, and input initialization.

Works as an include hub, bringing in code from other important includes.


Contains functions for calculating lighting.

Also includes the array of lights and their setup. Handles specular and fresnel content.


Sets up standard material maps 0 to 5.

Handles environment mapping, initializes specular mapping, and begins height map displacement.


Sets up enumerations and constant color values.

Makes sure many switches are at least set to 0 rather than null.

Contains uniforms related to screenspace, clipping, and projection matrices.

Contains functions related to matrix transforms and color correction.

inc_configShort file handling testing switches, such as light softening and specular distribution.
inc_keyholeSetup and use of keyholing.

Works like inc_standard for fancy water.


Sets up environment maps and cubes.

Includes functions for picking from those maps.


Handles construction and application of fog.

If not included, some important fog uniforms will not be available.


Sets up texture-handedness, handles bones for skins, and manages base transforms.

When requested, will also setup world, and projection positions for use in fragment shader.

inc_uniformsContains a bunch of uniforms previously dispersed throughout other files, such as fs_water.
inc_randomContains functions for producing random numbers, noise, and gradients.
inc_displacementHandles height map displacement
inc_targetHandles new spell targetning shapes
inc_tonemapContains a bunch of color correction functions previously found in inc_lighting and others.

Sets up framebuffer for color and depth.

Includes functions for convering screenspace to worldspace and back again.

inc_scriptableIncludes global shader uniforms commandable via nwscript.

The hub entrypoint for postprocessing shader.

Will include other post processing related files when enabled in client options.

Include Heirarchy

The current stable structure is:


The current patch water structure:








Red denotes repeated branch. Blue denotes the first instance of an include within the standard tree structure.