Skyrim NIF Files: BSShaderTextureSet and Textures

Home/Tutorials/Skyrim NIF Files: BSShaderTextureSet and Textures

Skyrim NIF Files: BSShaderTextureSet and Textures

NIF (Netimmerse Gamebryo) files in Skyrim are the files that hold the 3D Model information necessary to display objects in the game. When you open a NIF file in NifSkope, every NiTriShape represents a 3D Object instance. A single NIF file can have multiple instances of these and they can reside under various parent nodes.

A NiTriShape can have the following child properties among others:

    • NiTriShapeData is the actual mesh.
    • BSDismemberSkinInstance is the information necessary to handle limbs being dismembered from the base mesh.
    • BSLightingShaderProperty holds lighting and texture information.
    • NiAlphaProperty tells the game how to handle transparency in the mesh.

BSLightingShaderProperty and NiAlphaProperty will be covered in this article.

BSLightingShaderProperty will have a child node called BSShaderTextureSet. This node holds a list of textures used to skin the mesh. This is an ordered list of 9 textures in Skyrim NIF files.

BSShaderTextureSet

I will be going through this list of textures and explaining each one in detail, but first lets explain textures and UV Maps in general.

Understanding BSShaderTextureSet textures and Skyrim

Textures are the only way for you to paint your mesh and make it look the way you want which means that, apart from the mesh itself, the textures will be the single most important work.

As the mesh is built using triangular faces, to know what to draw on each face, you create what are known as UV Maps in Blender or 3D Studio Max. The UV Map is where you take the 3D triangles of your mesh and map them on to a flat plane. This way the game can project a texture back on to the mesh based on the information in this UV Map.

The Beyond Skyrim Hammerfell Logo UV Map

The Beyond Skyrim Hammerfell Logo UV Map

The Beyond Skyrim Hammerfell Logo UV Map projected on to the mesh

The Beyond Skyrim Hammerfell Logo UV Map projected on to the mesh

The Beyond Skyrim Hammerfell Logo with textures applied to the UV Map.

The Beyond Skyrim Hammerfell Logo with textures applied to the UV Map.

It is therefore important to understand that when vertices are moved, they will stretch and shrink the face and can cause the texture to look strange. This is more an issue with how 3D engines work and not anything you can control. Just keep in mind and work around it if needed.

The shader will apply light and effects based on 2 things:

  1. The BSShaderTextureSet textures which we will discuss further
  2. Flags set for the BSLightingShaderProperty. We will explain which flags are needed to use each texture.

The List of Textures in More Detail

Slot01 – Diffuse Map and (Alpha) Transparency Map

This texture is the base texture of the mesh and contains the main coloring your texture will use as well as the transparency information in the alpha channel. All other textures will only be detail additions and effects.

Compression:

  • Use DXT1 if transparency is not needed.
  • Use DXT3 if only full transparency is needed.
  • Use DXT5 if the texture needs partial transparency.

Required properties:

  • For Alpha Transparency
    • Automatically enabled for outer layer if using MultiLayer Parallax shader, otherwise requires that a NiAlphaProperty be added to the NiTriShape (right-click the NiTriShape > Node > Attach Property > NiAlphaProperty)
    • NiTriShapeData > Has Vertex Colors
    • NiTriShapeData > Vertex Colors

Appearance Controller(s):

  • For Alpha Transparency
    • NiAlphaProperty > Flags (Click the flag to view settings)
    • BSLightingShaderProperty > Alpha
      • 0 is fully transparent (invisible)
      • 1 is fully visible (opaque)
    • Transparency Map (Alpha Channel)
      • Black is fully transparent (invisible) *dependent on NiAlphaProperty flag settings
      • White is fully visible (opaque) *dependent on NiAlphaProperty flag settings
      • Transparency increases as shade approaches black *dependent on NiAlphaProperty flag settings

Suffix: none


The NiAlphaProperty

Click the flag icon next to flags to view the settings.

  • Enable Blending should be checked
    • For Alpha Blending
      • Source Blend Mode: Src Alpha
      • Destination Blend Mode: Inv Src Alpha
    • For Additive Blending
      • Source Blend Mode: One
      • Destination Blend Mode: One
    • For Multiplicative Blending
      • Source Blend Mode: Zero
      • Destination Blend Mode: Src Color
    • For 2x Multiplicative Blending
      • Source Blend Mode: Dst Color
      • Destination Blend Mode: Src Color
  • For Alpha Testing check Enable Testing
    • Alpha Test Function sets how transparency channel grey values (0 to 255 or black to white) will be compared to the Alpha Test Threshold value to determine what is opaque
      • Less or Equal: Lighter will be more transparent
      • Greater or Equal: Darker will be more transparent
    • Alpha Test Threshold: Value from 0 to 255 (black to white)

Color Blending

Color Blending Equation

(Source * SourceBlendMode) + (Destination * DestinationBlendMode)

  • “Source” is the color of the model materials in that pixel before blending
  • “Destination” is the color of what is behind the model in that same pixel before blending
  • The two values are modified by the value of the blend mode in that same pixel, then they are added together.

Blend Modes (a.k.a. Blend Factor)

  • One: multiply by one (no modification)
  • Zero: multiply by zero
  • Src Color: multiply by “Source”
  • Inv Src Color: multiply by inverse “Source”
  • Dst Color: multiply by “Destination”
  • Inv Dst Color: multiply by inverse “Destination”
  • Src Alpha: multiply by value of the model’s alpha channel (diffuse and vertex colors) present at that pixel
  • Inv Src Alpha: multiply by inverse value of the model’s alpha channel (diffuse and vertex colors)present at that pixel
  • Dst Alpha: multiply by value of the background model’s alpha channel (diffuse and vertex colors)present at that pixel
  • Inv Dst Alpha: multiply by inverse value of the background model’s alpha channel (diffuse and vertex colors)present at that pixel

Additional information on color blending.

Slot02 – Normal and (Alpha) Greyscale Specularity Map

The normal map, very similar to a bump map, will add the illusion of depth to the mesh. This is accomplished by creating varying shades of violet using various software including Mudbox, Zbrush, xNormal, Maya, the Gimp normal map plugin, or the Nvidia normal map plugin for Photoshop. Here is a video tutorial for creating high quality normal maps with ZBrush. The shader will then use the violet levels to determine the light levels for the texture, bending it if you wish, giving you what looks like height and depth details to the mesh.

Model Space Normal files created by Bethesda have the suffix _msn and are normal maps with no alpha channel. I prefer to use _n tangent space normal maps with the alpha channel instead of using another image and more video ram. I personally find the ability to add a specular alpha too good a thing to pass up.

It is important that NiTriShapeData > BS Num UV Sets is set to 4097 in NifSkope. If it is not, the Creation Kit, Nifskope, and the game itself will not display the Normal Map properly in game.


Alert-Icon

The Alpha Channel of the Tangent Space Normal Map

The tangent space normal map’s alpha channel will be ignored in the Skyrim game engine for transparency and instead, the intensity of the the different greyscale levels will determine how bright (specularity) that part of the mesh will be in game.

  • Black is minimum intensity, no specular highlight.
  • White is maximum intensity.
  • Intensity increases as shade approaches white.

A quick and dirty way to make this brightness mask is to take your diffuse map and darken it substantially, then copy it in to the alpha channel of the normal map in Gimp or Photoshop.


Compression: Use DXT5 because of the importance of the alpha layer in this file. Bethesda uses DXT5 in all tangent space normal maps that I have observed.

Required properties:

  • NiTriShapeData >BS Num UV Sets = 4097
  • NiTriShapeData > Has Normals = yes
  • BSLightingShaderProperty > Shader Flags 1: SLSF1_Specular

Appearance Controller(s)

  • BSLightingShaderProperty > Specular Strength
    • 1 is normal intensity
    • Less than 1 is lower intensity
    • Greater than 1 is higher intensity
  • BSLightingShaderProperty > Specular Color
    • The color of the specular highlight
  • BSLightingShaderProperty > Glossiness
    • Glossiness is the width of the specular highlight
      • 10 is a wide specular highlight
      • 50 is a thinner specular highlight
      • 100 is an even thinner specular highlight
      • Value ranges from 0 to 999

Suffix:

  • _n: Tangent Space Normal Map
    • Required to use the alpha layer specular map.
    • Tangent space normal maps are easily recognized by their mostly blue appearance. Tangent space normals almost always look bluish because normals in tangent space are always considered “up” (coordinates 0, 0, 1 ), even if in world space this is not true. The normals mapped on this triangle are thus encoded, and that’s the key point, relatively to ( 0, 0, 1 ). Because most normals are majorly “up”, and since the vector ( 0, 0, 1 ) is colorized as blue-purple-ish, the result is a blue-purple-ish normal map.
    • The benefits of tangent space maps are the removal of the restrictions imposed by World Space and Object Space normal maps. Tangent Space normal maps can rotate and deform, therefore they are ideal for characters or objects that need to have vertex deformation, like water or tree limbs.
  • _msn: Model Space Normal Map
    • Does not have a specular alpha, SLSF1_Specular must be false.
    • Slot 8 can contain a specular map if model space normals are used.
    • Object Space normal maps can be moved, but the vertices of the mesh cannot be deformed or the shading is wrong.
    • Object space normals are best for things that can move, but not deform, like swords, shields, doors, etc.

Also note that the Creation Kit expects the normal map to be present for the mesh and will give an error message if not present.

Slot03 – Emissive (Glow, Soft Lighting, or RIM Lighting) or (MultiLayer Parallax) Subsurface Color Map

This slot can either be used for an Emissive Map or for a Subsurface Color Map which is used in the MultiLayer Parallax section below.

The Emissive Map texture will add lighting to the mesh based on a few settings being set. The game will glow any color that you use / add but ignore black making this a very easy texture to apply. However, because you need to use Emissive Color for the glow base it may wash out the texture color.  You may need to try different settings for this color but it will most often work fine if you use similar colors or set Emissive Color to a greyscale color.

Compression: DXT1

Required properties:

  • BSLightingShaderProperty > Shader Type: Glow Shader
  • BSLightingShaderProperty > Shader Flags 1:
    • SLSF1_Own_Emit
    • SLSF1_Environment_Mapping disabled
  • BSLightingShaderProperty > Shader Flags 2:
    •  SLSF2_Glow_Map
    • For Soft Lighting: SLSF2_Soft_Lighting
    • For RIM Lighting: SLSF2_Rim_Lighting (Rim lighting overwrites soft lighting)

Appearance Controller(s):

  • BSLightingShaderProperty > Emissive Multiple
    • Glow intensity increases as emissive multiple increases
  • BSLightingShaderProperty > Emissive Color

Suffix: _g

Slot04 – Greyscale Height/Parallax map

This slot is used for a Height/Parallax Map. This is a greyscale image in RGB format. Height is determined by the darkness or lightness of each pixel as follows:

  • Mid grey (RGB 127,127,127) is zero depth and height
  • Black is maximum depth
  • White is maximum height

Compression: DXT1

Required Properties:

  • An ENB is required for this texture to function properly.
  • BSLightingShaderProperty > Shader Flags 1: SLSF1_Parallax

Shader Type: Heightmap

Suffix: _p

Slot05 – Environment/Cube Map

Environment/Cube Maps more or less add another layer of textures and can help get a more detailed look to your mesh. Cube mapping is preferred over other methods of environment mapping because of its relative simplicity. Also, cube mapping produces results that are similar to those obtained by high quality, slow rendering, but takes much less processing power – the moderate reduction in quality is compensated for by large gains in efficiency.

Also, cube mapping provides a much larger capacity to support real-time rendering of reflections relative to other mapping methods because the combination of inefficiency and viewpoint dependency severely limit the ability of these mapping techniques to be applied when there is a consistently changing viewpoint.

These maps are a bit different than other one layered textures:

  • A cube use 6 faces, counting 2 faces for each axis, xyz.
  • Each face can be calculated with positive and negative x, y and z.
  • They are sorted from +x, -x, +y, -y, +z and lastly -z.
  • Each of these would be their own layer in an image editor, for instance, Gimp or Photoshop.

Compression: DXT1

Required Properties:

  • BSLightingShaderProperty > Shader Type: Environment Map
  • BSLightingShaderProperty > Shader Flags 1: SLSF1_Environment_Mapping
  • BSLightingShaderProperty > Shader Flags 2: SLSF2_Glow_Map disabled

Appearance Controllers:

  • BSLightingShaderProperty > Environmental Map Scale
    • 1 is normal intensity
    • Less than 1 is lower intensity
    • Greater than 1 is higher intensity

Suffix: _e

Slot06 – Greyscale Environment/Reflection Mask

Environment/Reflection Mask is a Greyscale Image. Simply a lighting control texture sometimes referred to as a specular map with the purpose to soften or diminish the level of light affecting the mesh reflection. Brightness of individual pixels determine the effect: white will reflect all light and black will reflect no light.

Compression: DXT1

Required Properties:

  • An environment/cube map is required.
  • BSLightingShaderProperty > Shader Type: Environment
  • BSLightingShaderProperty > Shader Flags 1: SLSF1_Environment_Mapping

Appearance Controllers:

  • BSLightingShaderProperty > Environmental Map Scale
    • 1 is normal intensity
    • less than 1 is lower intensity
    • greater than 1 is higher intensity
  • Black is minimum intensity, environment/cube map has no effect in these areas
  • White is maximum intensity
  • Intensity increases as shade approaches white

Suffix: _m

Slot07 – Subsurface Tint Map or (MultiLayer Parallax) Inner Layer Diffuse and (Alpha) Inner Layer Depth

Subsurface tint maps are used for subsurface scattering. This is a rendering effect that simulates the diffusion of light inside a translucent medium. The effect can be seen as an extension on the principles of translucency and is appropriate for realistically simulating a wide range of materials including wax, marble, liquids (like milk), plant leaves, fruit, snow, and most importantly, human skin.

Compression: DXT1

Required Properties:

  • BSLightingShaderProperty > Shader Type: Skin Tint
  • BSLightingShaderProperty > Shader Flags 1: SLSF1_FaceGen_RGB_Tint

Appearance Controllers:

  • Brightness of the texture controls translucency while the game defines the underlying color (Set in the race menu.) Typically a very dark greyscale texture.
  • Black is opaque
  • White is entirely transparent

Suffix: _s

Slot08 – Backlight Map

Slot09 – Currently Unused

By | 2016-10-28T22:50:52+00:00 May 27th, 2015|Tutorials|0 Comments

About the Author: