Tip 36 - Custom skins

URL: http://freespace.morat.net/Vitenka/Guides/tfc_36.txt.html

A VERY basic skin editing tutorial

Some programs which will help:

  1. Halflife model viewer
  2. Milkshape
  3. Pak explorer
  4. Paintshop pro

Lets start with a brief discussion of how halflife models work.

Halflife models are stored in 'mdl' format - but it's pretty heavily modified since the quake model format it was based upon.

Models consist of a number of 'meshes' - triangles which make up the surface of the model.

These meshes are connected to a skeleton, which is made up of bones. It is this skeleton which is animated.

The model also contains hitboxes (which are simple boxes around each bone, to make it easier for the gamee to quickly throw away shots which have no chance of hitting) and a number of hooks (named farmes of animation which the engine can trigger)

The final thing a model contains is one or more 'skins' - which are bitmaps that are painted on top of the mesh when it is rendered.

The compilation of all of this is controlled by a 'qc' file - which gives the engine a whole heap of information (names to framenumber mappings, which bit of mesh maps to which bit of skin, which bones control which mesh, where the origin of the model is, and any special properties)

Halflife supports multitexturing of skins. A single model can have as many skins making it up as it wants - and they are allowed to overlap.

Overlapped skins can give particularly flashy effects when one is an environment map - which means it looks reflective. This can be used to give highlights, and to make surfaces look shiny.

You can also change which skin a model has on mid-game. Halflife doesn't use this much, but it's noticeable that flags have five different textures, rather than being five seperate models.

Now - onto the skinning. A step by step tutorial.

  1. Boot the model viewer.
  2. Open the pak file
  3. Search through the list on the right for the model you want.
  4. Open it up
  5. Hit the 'export skin' button - it'll save the skin out as either bitmap or pcx. (Note, dm_base is the skin you want)
  6. Open it in your favorite image editor
  7. Now, lets examine the skin. You will notice that the bottom 32 colours of the pallette are special. These are the 'team colour' and will be replaced by shades of [blue/red/yellow/green] in game.
  8. You will also notice that the skin is for the most part an 'unfolded' version of the model - but that some parts of it are seperated out. There's no 'standard' way a model unfolds into its skin - you will have to experiment to work out where each piece goes on the real thing.
  9. So edit your skin, make it loko as pretty as you like - use the team colours well. (They're often set to orange)
  10. Do not change the colour depth, don't let the image editor re-arrange your pallette.
  11. Same as quake1, don't go over the lines - the areas used for each bit of skin *can* be changed, but it's far simpler not to.
  12. Then save it out, in the same format. It should be a multiple of 2 in size
  13. Go back to the model viewer, and 'import skin'
  14. Now look at your pretty model. Rotate it, admire it. Make it animate.
  15. Now save it out - it's best NOT to save into the pak, instead save it to the same path as it is in the pak, but as a normal file. (You may need to create a whole bunch of subdirectories)
    For example, halflife/tfc/models/player/
  16. Certain models for certain mods will cause a CRC failure. If you get the 'consistency failure' after changing a model, then you know that that model isn't permitted to change.
  17. Please note, you SHOULD be able to change the skins for most models without encountering this.

That should allow you to create a basic altered skin.

Ok - now, you CAN do more than this. Halflife supports multiteturing, including environment mapped effects (look closely at the apparent reflections on shiny metal things in game)

To alter these effects, you want to export one of the other skins - and edit that. You will also need to edit its properties (shininess, ambeint colour etc.) which I don't THINK you can do inside of the model viewer. You will need to export the .c file and edit that, or use a more powerful tool (such as milkshape - this also has options to decompile mdl's and recompile them)

Some other web sites worth looking at: