Skip to content

SWTOR materials and texture files

ZeroGravitas edited this page Jan 7, 2024 · 9 revisions

A look at SWTOR's 3D materials and their texture files (WIP)

  1. SWTOR's texture map types

  2. SWTOR's material types and how they use the texture maps (WIP)

SWTOR'S TEXTURE MAP TYPES

These are the main types of texture maps SWTOR uses. As per BioWare's naming conventions for SWTOR, typically there is a suffix before the extension (quite useful when doing searches) such as _d.dds, _n.dds, etc. In other cases there is a prefix that usually is more self-explanatory than technically rigorous: for example, although there are files prefixed with pattern_, facepaint_, makeup_ and tattoo_ they all are used in the same way and in the same material input.

So, each of the following entries are written as: suffix or prefix in filename, internal name in materials' attributes and others, and a short description.

Prefix/Suffix Label description
_d DiffuseMap diffuse color as RGB, plus optional extra information in the alpha channel
_h PaletteMap diffuse color as Hue/Saturation/Lightness + Ambient Occlusion (not in that order)
_m PaletteMaskMap primary and secondary hueing masks plus metallic reflectivity mask
_n RotationMap normal map, plus emissiveness and opacity maps
_s GlossMap specular color and shininess (not PBR-style!)
facepaint_
pattern_
tattoo_
makeup_
FacepaintMap tattoos, make-ups, skin and fur patterns, etc., as RGB plus alpha channels
complexion_ ComplexionMap complexion as RGB applied through multiplication, and Dark Side corruption maps
age_ AgeMap scars and age wrinkles' normal maps
facehair_ FaceHair for anisotropic-like hair and metal sheen
wrinkles_ _w
wrinkles_ _wm
AnimatedWrinkleMap
AnimatedWrinkleMask
animated facial wrinkles

The way the game's materials system uses them can get to be a bit convoluted. The .gr2 importer add-on for Blender adds template materials that handle all that complexity for us. Still, it's good to know what's what (especially if we use a different 3D app and want to build an approximation to the game's workings).

All texture map files are meant to be used as non-color corrected images, and must be handled so in Blender and other DCC apps (using "raw", "non color", or equivalent settings). This is especially critical for files that contain actual non-color data such as normal maps. This means that, at some point in the shading and rendering process, some sort of colorspace correction becomes necessary (conversion to sRGB, gamma adjustments, etc.). The Blender add-on's template materials include a gamma correction.


_d ("DiffuseMap"): object's diffuse color as RGB.

  • RGB: diffuse color.
  • Alpha: sometimes not present or empty. Multiple uses.

The diffuse color texture is shown in full in objects that use the Creature and Uber shader material (creatures, furniture, architectural and landscape objects, mainly). For objects that are recolorable (either pre-colored or dyeable), the game masks areas of the object and uses a more complicated system to color them, leaving the DiffuseMap show in the unmasked areas if any.

Regarding the alpha channel (if present): it's very rarely used for opacity (which is usually stored in the "RotationMap" files). It has different meanings depending on the shader which will use it. In the case of the Skin shader and characters' head objects, it masks the eyes, nostrils, and mouth areas to keep them from being affected by SWTOR's simulated rim lighting (an effect not yet implemented in Blender but already tested in Unreal).


_h ("PaletteMap"): object's diffuse color as Hue/Saturation/Lightness + Ambient Occlusion.

  • R: Ambient Occlusion.
  • G: Hue.
  • B: Saturation.
  • Alpha: Lightness.

These HSL+AO textures constitute the base colors for all the "dyeable" areas of the game objects (be it preset by default or applied through player-adquired dyes). Non dyeable areas in an object show the _d DiffuseMap texture colors instead.

The alpha's Lightness defines most of the object's soft shadowing: it is very much like a grayscale version of the _d diffuse map. If SWTOR's re-coloring system can't be replicated, a very simplistic but fairly effective approach would be to multiply this alpha channel by a color (the skin color, dyes's ones, etc.).


_m ("PaletteMaskMap"): primary and secondary hueing masks plus metallic reflectivity mask.

  • R: Palette1 mask for hue/saturation/specularity/contrast/brightness adjustments.

  • G: Palette2 mask for hue/saturation/specularity/contrast/brightness adjustments.

  • B: MetallicMask: determines how the color of the specular will be calculated in order to simulate metallic surfaces. It's not just a simple mask but a value that ranges between:

      0 -> Uses the material's Palette Specular color.
      0.5 -> Uses white.
      1 -> Uses the material's Palette Metallic Specular color.
    

    (SWTOR doesn't use a Physically Based Rendering system (PBR), but this is kinda sorta analogous to a PBR Metal/Roughness workflow, if one squints a whole lot)

  • Alpha: unused.

The areas covered by the Palette1 and Palette2 masks disregard the DiffuseMap and use the _h PaletteMap's HSL+AO coloring system, instead. The rest shows the original _d DiffuseMask's RGB colors (for example, the insides of a character's mouth, or a piece of armor's non-dyeable areas).


_n ("RotationMap"): object's normal map (plus emissiveness and opacity maps).

  • R: opacity mask (0.0 = opaque, 1.0= transparent).
  • G: normal map's G channel (inverted when used in OpenGL-type apps like Blender).
  • B: emissiveness (0.0 = no emissiveness, 1.0 = full emissiveness).
  • Alpha: normal map's R channel.

Conversely, to build a conventional "blue" Normal Map out of that data, one would use:

  • R: RotationMap's Alpha channel.
  • G: RotationMap's Green channel (inverted when used in OpenGL-type apps like Blender).
  • B: 1.0 (white) value. This is actually a hack that produces passable results and can be easily implemented via 3D apps' material nodes or image editing apps such as Photoshop or GIMP. The correct formula for Blender would be:
    B: sqrt ( 1.0 ^2 - RotationMap's Alpha channel ^2 + RotationMap'a Green channel ^2 )

    (this can vary depending on the target app's 3D engine. We know it's different for, say, GMod)

The reason SWTOR's normal maps are "green" instead of the conventional "blue" is actually out of common Windows DirectX game development practices regarding the DDS image format: as the specific .dds variant used in SWTOR uses lossy compression with different degrees of compression per channel (it takes advantage of our eyes' different sensitivity to red, green and blue color resolution), it's typical to rearrange the normal map's channels to avoid the ones where compression is most damaging. See: http://wiki.polycount.com/wiki/Normal\_Map\_Compression

Also, DirectX's normals differ from OpenGL's ones (typical in 3D DCC apps such as Blender) in having the green channel inverted. See: https://docs.substance3d.com/bake/what-is-the-difference-between-the-opengl-and-directx-normal-format-182256965.html If converting a material to a DirectX-based game or application such as Tabletop Simulator, don't invert this channel.


_s ("GlossMap"): object's glossiness.

  • RGB: specular color.
  • Alpha: shininess.

These textures aren't modern physically based rendering-type (PBR) ones but old-style glossiness ones and require some massaging before being fed to modern shaders such as the typical Principled BSDF Shader.


facepaint_ / pattern_ / tattoo_ / makeup_ ("FacepaintMap"): tattoos and make-ups, Twi'lek lekku and Cathar fur patterns, NPCs skin aging and markings.

  • RGB: Diffuse color.
  • Alpha: Alpha.

Image with an opacity map. Even if the game only has facepaint maps for the characters' heads, one could easily create maps for the rest of the body parts and apply them in the same manner in order to have, say, full body tattoos and the like.


complexion_ ("ComplexionMap"):

  • RGB: Diffuse color.
  • Alpha: none.

Image applied as a Photoshop-like Multiply layer transfer mode over the results of other textures.

There are two Dark Side Corruption variants for each Dark Side character's complexion.

Note that even if the game only has complexion maps for the characters' heads, one could easily create maps for the rest of the body parts and apply them in the same manner.


age_ ("AgeMap"): scars and agings' normal maps (see RotationMap).

  • R: 0.0 value.
  • G: normal map's inverted G channel.
  • B: mask to avoid applying the ComplexionMap on the scar area.
  • Alpha: Normal map's R channel.

Normal map meant to be blended with the _n RotationMap one. The blending seems to use an overlay-type approximation.


facehair_ ("FaceHair").

The folder contains only a single pair of DiffuseMap and RotationMap with flat values in their channels. Actually useful in any way? (YET TO BE VERIFIED).


wrinkles_: maps for facial wrinkle animations.

Two types of files:

  • _w ("AnimatedWrinkleMap"): Each channel holds what looks like four traditional bump maps or maybe two pairs of normal map channels for compressed and stretched versions of facial wrinkles. VERIFY THIS.

  • _wm: ("AnimatedWrinkleMask"): UNKNOWN. Each channel holds what looks like masks for different areas of the face, but they show as white and black areas over neutral grey backgrounds, so they might act as bump or normal map values instead (YET TO BE VERIFIED).

The .mat files include animatedWrinkleIntensity values and animatedWrinkleMult1 and animatedWrinkleMult2 vector4 values. INVESTIGATE


Other maps that need determining their functioning:

LookupTables: hair materials use them as "DirectionMaps". They seem to provide with an anisotropic-like specularity typical in stylized hair and fur. There aren't that many.

Miscellanea:

Eyecubemap.dds seems to be the cubic environment map Bioware is currently using for the eyes' main catchlights, mixed in some manner and to some degree with the environment maps corresponding to each locale in the game.

Blender doesn't understand the typical "cross"-style cubic sky maps formats, so their use requires conversion.


SWTOR'S MATERIAL TYPES AND HOW THEY USE THE TEXTURE MAPS

(WIP)

Types of materials

Grosso modo, SWTOR has two types of materials: those that have a fixed color and those that are re-colorable.

  • Fixed color ones are usually applied to architectural and landscape elements (buildings, roads, walls, mountains, rocks…), furniture, NPCs (characters and creatures), etc.

  • Re-colorable ones are all those whose textures' colors can be changed, such as our characters (their skin, hair, eye, etc.), armor pieces (variations created by BioWare, or by us through the application of dyes), etc.

Once again, we are following BioWare's terminology for them, as that helps when determining which model uses what material type. SWTOR's basic materials (basic shaders, actually, although it's more useful to think about them at the materials level when implementing and using them in a 3D app such as Blender) are:

Fixed color materials:

  • Uber: tipically used in single mesh, non-animated assets such as building parts, landscape parts, weapons, vehicles, etc. It uses the DiffuseMap, RotationMap, and GlossMap.

  • Creature: typically used in single mesh, animatable assets such as most non player characters. It uses the DiffuseMap, RotationMap and GlossMap, plus the PaletteMaskMap's MetallicMask data.

    Our .gr2 importer add-on for Blender, when importing objects that use Uber and Creature materials, names their default Blender materials with the name of their related .mat files! That means that locating those .mat files and reading their texture file references is just a copy-paste into Windows Explorer's instant search field away.

Re-colorable materials:

  • Garment: typically used in armor gear parts. In addition to the DiffuseMap, RotationMap, and GlossMap, for the recoloring process it uses the PaletteMask and the PaletteMaskMap.

  • SkinB: used for characters with re-colorable skin. It uses the same texture map types as the Garment shader, but when dealing with head bodyparts it may add to those a ComplexionMap, a FacePaintMap, an AgeMap, and a WrinkleMap pair (for the rest of the body, default "neutral" maps are applied for those).

  • Eye: used for characters' eyes. It uses the same texture map types as the Garment shader. It happens to use, too, an specific cubic sky map, "eyecubemap.dds", for the eyes' catchlights, which it mixes with the scene's general cubic sky map.

  • HairC: used for characters' hairs: it uses the same texture map types as the Garment shader, plus a DirectionMap look-up table to produce anisotropic-like hair glossiness. Currently TORCcommunity.com's Character Creator doesn't export the reference to the DirectionMap, so, it doesn't get automatically added when importing a character into Blender, but the importer add-on's materials support it and it can be assigned manually.

How does the re-coloring work?

Skipping the precise details for now, it goes like this:

  • The re-colorable shaders use the DiffuseMap as a base color.

  • The areas to re-color are determined by the masks stored in the PaletteMaskMap.

    The important part is that the re-coloring doesn't try to modify the DiffuseMap's data, at all: instead, it takes the information stored in the PaletteMap, alters it, and "pastes it on top" through the masks, so to say.

    While the DiffuseMap stores the diffuse color in RGB format, the PaletteMap stores what amounts to the same color information in HSL+AO format (Hue Saturation Lightness plus Ambient Occlusion). That makes the diffuse color easier to manipulate and in a more exact manner: the color modification information is stored in the game as changes in hue, saturation, contrast and brightness, omitting the properties that don't vary.

  • So, if there are areas in the model not covered by the PaletteMaskMap's masks, the DiffuseMap will show up in them.

(By the way: alongside the color modification information for each PaletteMaskMap area there is also glossiness's specular and metallic strength values)

Table of Contents


INTRODUCTION

IMPORTING SWTOR MODELS INTO BLENDER: A BRIEF OVERVIEW.
Check this intro first. Afterwards, you can jump directly to the guides on extracting PCs, NPCs and others.


TOOLS

No need to read this section right now: each extracting/assembling guide explains its required tools anyway.

Applications and Blender Add-on tools:

Online Tools:

Deprecated Tools:

  • EasyMYP (Windows app).
  • Noesis (Windows app).

THE COMPLETE GUIDE TO AUTO-EXTRACTING AND ASSEMBLING PLAYER CHARACTERS AND NPCs:

READ THE BROAD STROKES FIRST: YOU'LL SEE IT'S EASIER THAN YOU THINK!


ASSEMBLING GAME LOCATIONS AUTOMATICALLY:


LOCATING AND ASSEMBLING ASSETS MANUALLY:


OTHER GUIDES (WIP):


MODDING (to do)

Modding isn't working at the moment due to SWTOR's change to a 64bit codebase. It's going to take a while 🙁.


DATAMINING (to do)

  • Overview.
  • Tools.

SWTOR TECHNICAL INFORMATION:


OTHER RESOURCES:

Clone this wiki locally