Texture Modding

OpenMW 0.39 and later versions support new texture mapping techniques that were not available in the vanilla MW engine.

Historic notes (for OpenMW 0.36 and earlier) see TextureModding_(old).

"Normal mapping" is a technique used to fake lighting of bumps, cracks and other small details.

"Specular mapping" is used to vary the shininess / specularity along the surface of an object.

The prerequisite to using these techniques are shaders. OpenMW automatically uses shaders for objects with these mapping techniques.

Normal mapping
To plug in a normal map, you can edit the NIF mesh file(s) using NifSkope and assign the normal map texture to the BumpTexture slot in the NiTexturingProperty.

Note that while the original MW engine does support the BumpTexture slot, it is using a strange form of normal mapping that applies to an environment map. OpenMW uses standard normal mapping which can achieve much better results. This difference can however result in incompatibilities. Some mods e.g. [http://www.nexusmods.com/morrowind/mods/42406/? Redoran Bump Mapped] look much darker compared to the vanilla engine and will have to be recalibrated.

Specular mapping
The RGB channels of the specular map are used as the specular color. The alpha channel specifies shininess in range [0, 255]. If a specular map is used, it will override the shininess and specular color set in the NiMaterialProperty / osg::Material.

NIF files do not support specular maps. In order to use them anyway, see the next paragraph.

Automatic use
In addition to editing mesh files, there is another way of plugging in these texture maps. Simply create the textures with appropriate naming convention (e.g. when the base texture is called foo.dds, the normal map would have to be called foo_n.dds). To enable this automatic use based on filename pattern, you will have to add the following to your user settings: [Shaders] auto use object normal maps = true

auto use object specular maps = true

normal map pattern = _n normal height map pattern = _nh

specular map pattern = _spec

A normal map with the _nh pattern additionally enables use of the normal map's alpha channel as height information. This can be used by a parallax mapping shader to offset the texture depending on the viewing angle and height, creating a fake 3d effect.

The above settings are not enabled by default, to prevent incompatibilities with mods that may be inadvertently using these naming schemes.

On the topic of shader settings, you may be interested in these three settings as well. In particular, 'clamp lighting = false' makes normal maps look much better! [Shaders] force shaders = false
 * 1) Force rendering with shaders. By default, only bump-mapped objects will use shaders.
 * 2) Enabling this option may cause slightly different visuals if the "clamp lighting" option
 * 3) is set to false. Otherwise, there should not be a visual difference.

force per pixel lighting = false
 * 1) Force the use of per pixel lighting. By default, only bump mapped objects use per-pixel lighting.
 * 2) Has no effect if the 'force shaders' option is false.
 * 3) Enabling per-pixel lighting can result in visual differences to the original MW engine. It is not
 * 4) recommended to enable this option when using vanilla Morrowind files, because certain lights in Morrowind
 * 5) rely on vertex lighting to look as intended.

clamp lighting = true
 * 1) Restrict the amount of lighting that an object can receive to a maximum of (1,1,1).
 * 2) Only affects objects that render with shaders (see 'force shaders' option). Always affects terrain.
 * 3) Setting this option to 'true' results in fixed-function compatible lighting, but the lighting
 * 4) may appear 'dull' and there might be color shifts.
 * 5) Setting this option to 'false' results in more realistic lighting.

Terrain
The terrain shader also supports normal, normal-height and specular maps, with one difference compared to objects: the specular value must be packed into the layer texture's alpha channel.

For example, if you wanted to add specular mapping to a terrain layer called rock.dds, you would copy this texture to a new file called rock_diffusespec.dds, and then edit its alpha channel to set the specular intensity.

The relevant settings are:

[Shaders] auto use terrain normal maps = true

auto use terrain specular maps = true

terrain specular map pattern = _diffusespec

normal map pattern = _n normal height map pattern = _nh
 * 1) Also used for terrain normal maps

OSG native files
OpenMW supports all the above shader features for meshes in the Native Mesh Format. To have the shader generator recognize specific textures, the osg::Texture2D must be named appropriately.

Available texture types are the following (most of which also have NIF equivalents):


 * diffuseMap: base texture
 * normalMap: normal map, as described earlier
 * normalHeightMap: same as normal map, but including height information in alpha channel to be used for parallax effects
 * emissiveMap: controls the material's emission, useful for objects that glow in the dark
 * darkMap: multiplied onto the base texture
 * detailMap: multiplied by 2 and then multiplied onto the base texture
 * envMap: spherical environment map
 * specularMap: specular map, as described earlier

The first texture unit automatically acts as diffuseMap if no recognized type is specified.

Example: .osgt file excerpt of a normal mapped mesh TextureModeList 2 { Data 1 { GL_TEXTURE_2D ON                   } Data 1 { GL_TEXTURE_2D ON                   } }                 TextureAttributeList 2 { Data 1 { osg::Texture2D { UniqueID 37 Name "diffuseMap" WRAP_S REPEAT WRAP_T REPEAT WRAP_R REPEAT MIN_FILTER LINEAR_MIPMAP_LINEAR MAG_FILTER LINEAR Image TRUE { UniqueID 60 FileName "textures/BuddhaStatue_Dif.jpg" WriteHint 2 2 }                     }                      Value OFF }                   Data 1 { osg::Texture2D { UniqueID 38 Name "normalMap" WRAP_S REPEAT WRAP_T REPEAT WRAP_R REPEAT MIN_FILTER LINEAR_MIPMAP_LINEAR MAG_FILTER LINEAR Image TRUE { UniqueID 61 FileName "textures/BuddhaStatue_Nor.jpg" WriteHint 2 2 }                     }                      Value OFF }                 }