Page tree
Skip to end of metadata
Go to start of metadata

With the new lighting engine introduced in patch 81.8193.15, the core shaders of NWN:EE now accepts a number of inputs for generating more advanced content that benefits from the new PBR lighting engine. These can be set by supplying a custom material file that a given model can then refer to, using either the standard "bitmap" field or the designated "materialname" field, as described in the material file format section.

These inputs are used to modulate how meshes applied the material are rendered, generally by informing the renderer with the desired physical properties of the surface of the objects, which the engine will then use to generate results with a high level of realism.

Texture inputs

The main way of supplying these inputs is by special texture maps. You specify these by adding a "texture*" entry in the material file, where "*" is replaced with the index in the table below, followed by your texture name for that input. If using NWN Crunch (recommended), you can also get the tool to generate the material file for you by simply adding certain standardized suffixes to the texture map names instead.

Note that the new standard texture map inputs also all require that the "renderhint" in either the model or the material file is set to either "NormalAndSpecMapped" or "NormalTangents".

Below is an overview of the texture map inputs supported by default.

IndexColor ChannelsDescriptionExample
03 or 4

Base color / diffuse map with optional alpha.

This map affects the color of the diffuse reflection from the material. For metals, it also adjusts the specular reflection color.

If omitted, the material will simply use the texture matching the material name.

Notice: PLT textures can not be designated through material files, so for those, the texture0 entry must be omitted (and the material file must match the name of the PLT texture).

12

Normal map.

Used to generate the illusion of higher levels of geometric complexity of models when doing lighting. For a basic introduction, see this.

You can supply three channel normal maps (RGB), but only two color channels (red and green) will be used, where green is up (the OpenGL standard).

21

Specularity map.

Sets the material specularity. As the value goes toward 1 (white), this will also result in the material behaving as metallic, where the diffuse texture will be used for tinting the specular reflection color. For the same reason, a metallicness map can usually work as input for this texture (NWN Crunch also takes metallicness maps as inputs).

If omitted, the renderer will try to approximate a value based on diffuse texture alpha if environment mapped, and use a basic value that fits the average non-metal materials otherwise.

31

Rougness map.

Sets the material roughness. This map is essential for creating realistic results with the enhanced lighting engine.

If omitted, the renderer will try to approximate values based on specularity (see above).

41

Height map.

Used for parallax displacement as well as basic light occlusion.

By default, 1 (pure white) is the base level, with lower values resulting in the appearance of depressions in the surface geometry.

If omitted, light occlusion is partly derived from diffuse texture brightness.

53

Self-illumination map.

Makes the material light up in the color and pattern

The example textures combined produce this result:

Example material file:

renderhint NormalTangents

texture0 tcn01_glas02_D 
texture1 tcn01_glas02_N 
texture2 tcn01_glas02_S 
texture3 tcn01_glas02_R 
texture4 tcn01_glas02_H 
texture5 tcn01_glas02_I 

Parametric Inputs

In addition, the standard shaders accept a number of standard parametric inputs, listed below.

For these to work, you must specify a shader to use in the material file, even if using the default. Usually you will want to just use the standard "vslit_nm" and "fslit_nm".

TypeNameValue rangeEffect
floatRoughness0.001 - 1.0Sets the roughness for the material.
floatSpecularity0.001 - 1.0Sets the specularity for the material.
floatMetallicness0.001 - 1.0Sets the metallicness for the material, which again determines the saturation of the specular reflection color. Normally, this is derived from specularity, but this parameter can be used to override that setting.
floatDisplacementOffset0.0 - 1.0Sets an offset to the base level for displacement when reading the height map. By default, 1.0 (white) is the base level, but with a DisplacementOffset of 1.0, the base level is 0.0, etc.

This is an example material file (used in the core game to make ice appear non-metallic):

customshadervs vslit_sm
customshaderfs fslit_sm
parameter float Metallicness 0.001
parameter float Specularity 0.0179
  • No labels