furrycat's guide to SWAT3 facial expressions

SWAT3 characters can be made to make several different grimaces and glances with expression maps. The concept is not hard to grasp but it is a little tricky to describe, so I'll explain how an existing expression map works rather than show you how to create one from scratch. Once you've figured the demonstration out you should be able to make your own.

Requirements

To make an expression map you need:

Our test case

Who better to use as a guinea pig to demonstrate the techniques needed to make expressions than everyone's favourite target, Martin Brenner?

The FACE material

Here's the relevant output of gsmhacking when describing BG3_MAR_BRE_HIGH.GSM.

Texture 00 at 0x93a5: H:\SWAT3_cqb\FINAL_CHARACTERS\A_MAR_BRE\BG3_MAR_BRE_TEX\BG3_MAR_BRE_FACE.bmp
Material 00 at 0x98b5: FACE is diffuse (#00) (groups: 1)

That tells us that there's a material called FACE in the model and that its texture file is BG3_MAR_BRE_FACE.bmp, shown below.

BG3_MAR_BRE_FACE

If you were creating your own expressions and you found there was no FACE material, you could create one with gsmhacking --material-name.

Sierra specify that the face texture must be 128x64 pixels. I can neither confirm nor deny this but I do know that the dimensions 128 and 64 are explicitly listed in skins.dat for every entry. This would make an interesting experiment...

The expression sheet bitmap

This file is BG3_MAR_BRE_FACE_EXP.bmp.

BG3_MAR_BRE_FACE_EXP

Although the face texture was named BG3_MAR_BRE_FACE, to tie in with the skin name BG3_MAR_BRE, it could take an arbitrary name. The expression sheet file, however, must be named skinname_FACE_EXP, where skinname is the character skin's name from skins.dat. Here that's BG3_MAR_BRE. For Victor Getts it's BG1_VIC_GET. And so on.

The bitmap must be 128x128 pixels. As you can see, it is split into eight sections, some or all (or none, I suppose) of which will be mapped on to the face material as appropriate.

The expressions

Neutral eyes
(64x32)
Angry eyes
(64x32)
Surprised eyes
(64x32)
Blinking eyes
(64x32)
Eyes looking right
(64x32)
Eyes looking left
(64x32)
Neutral mouth
(32x32)
Small mouth
(32x32)
Medium mouth
(32x32)
Wide mouth
(32x32)

Martin has the full range of emotions. If you didn't want to draw a particular expression you could leave a section blank. Any pixels coloured bright purple (RGB values 255,0,255) are considered transparent.

skins.dat entries

The format of skins.dat has changed with each patch of SWAT3. Since Sierra have stated that there will be no patch after 2.1 it's safe to assume that the current format is here to stay. The ten fields are as follows, with the ones we're interested in highlighted:

Field Brenner
Name BG3_MAR_BRE
High-poly model BG3_MAR_BRE_HIGH
Low-poly model BG3_MAR_BRE_LOW
Footstep sneaker
Gas-resistant 0
Eye top-left corner co-ordinates 32 20
Eye size 64 16
Mouth top-left corner co-ordinates 48 40
Mouth size 32 24
Face texture size 128 64

Notes

DISREGARD what you read in the Mod HQ FAQ or the actual .dat files. Both those sources are documented incorrectly!

Strictly speaking there are fifteen fields, not ten, since each pair of co-ordinates needs two fields but it's easier to think of the two numbers as being one field.

Relationship between skins.dat and the textures

A picture tells a thousand words so let's look at a zoomed-in mugshot of Brenner.

BG3_MAR_BRE_FACE.bmp closeup

The bright colours (sorry about that) show the co-ordinates as described in skins.dat. The green box is a 64x16 rectangle drawn from (32,20). It represents the eyes area. The red box is a 32x24 rectangle drawn from (48,40). It represents the mouth. Draw rectangles of the right size on your own copy if you want to confirm this.

When the game wants Martin to display a specific emotion, it find the right image in the expressions sheet and maps it on to the area above. So, to make him mad, it would put the "angry" eyes in the green box and the "wide" mouth in the red box.

BG3_MAR_BRE_FACE.bmp angry closeup

Note that the game will scale the expression to the right size. You just need to make sure your image is the right aspect ratio and fits into the expressions sheet bitmap.

What about SWAT officers?

Playable officers can have expressions but not on a per-character basis. Officers' expressions are based on the Asian/Hispanic/White race settings. Mods like Armed Forces will show you how to change the expressions but you can't make an expression sheet for a particular character.

Making your own expressions

Having noted that you can only make an expression sheet for NPCs, you'd have to carry out these steps:

Feedback

Send any comments to swat3@furrycat.net.