The .skin files are used to place multiple skins on the same geometry. The purpose of the .skin file, in the loosest terms, is to tell the game to switch a shader over to a new one if the user asks for it. You’ll need to write two shaders and then go to another file type to link it in a way the game can read it to switch out the shader. The benefit of using .skin files is that you can get a lot of mileage out of the same geometry.
5.1 Write all of the shaders you need for the .skin file. Generally you’ll start out with a base shader file the geometry uses. Ignore the render line, since it’s only used for render stage. First example shader:
models/mapobjects/strogg/console/arcade_machine/a_machine { noselfShadow unsmoothedtangents renderbump -size 512 512 -aa 2 -trace .05 -MergeHigh models/mapobjects/strogg/arcade_machine/arcade_local.tga models/mapobjects/strogg/arcade_machine/arcade_main_hi.lwo bumpmap addnormals (models/mapobjects/strogg/console/arcade_machine/a_machine_local.tga, heightmap (models/mapobjects/strogg/console/arcade_machine/a_machine_h.tga, 2)) diffusemap models/mapobjects/strogg/console/arcade_machine/a_machine_d.tga specularmap models/mapobjects/strogg/console/arcade_machine/a_machine_s.tga }
Next you’ll need to write a variant shader for the same geometry. This new file will have something different about it, like the disuse pass is different, or you’re replacing all of the support files except the _local map. Second example shader:
//yellow .skin for the arcade machine-------------------------------------------- models/mapobjects/strogg/console/arcade_machine/a_machine_yellow { noselfShadow unsmoothedtangents bumpmap addnormals (models/mapobjects/strogg/console/arcade_machine/a_machine_local.tga, heightmap (models/mapobjects/strogg/console/arcade_machine/a_machine_yellow_h.tga, 2)) diffusemap models/mapobjects/strogg/console/arcade_machine/a_machine_yellow_d.tga specularmap models/mapobjects/strogg/console/arcade_machine/a_machine_yellow_s.tga }
In this case, we’ve kept most of the name the same, but added a _yellow to the end of the shader title name and the targas. Note: we’ve only replaced the _d, _h, and _s targa since we’d probably use the same _local map for the geometry. Don’t forget to save.
5.2 Now that you have two shaders, what do you do with them? First, make sure you have temp targa files in the correct directories with the diffuse targa a different color than the main skin page (Disregard if you’ve already painted the new skin). You’ll need to make a .skin file to allow for the game to switch between the two shader entries.
5.3 You’ll need to create a .skin file folder in the same area as your material folder: Under the pk4 files and beneath your materials folder, you’ll need to create another folder and name it skins. You’ll need to create your skin files locally. Meaning you’ll have to create them on your computer and then save them out in the appropriate directory inside the Quake4 game.
- Through your computer’s Explorer, go into the Quake4 directories. (C:\Program Files\id Software\Quake 4)
- Open the q4base folder and find the pk4 files.
- Underneath the pk4 files and beneath the materials folder, you’ll need to create a skins folder. Name it skins in all lower case letters. You’ll also want to create sub-folders inside the skins folder for models , mapobjects, etc.
- Open notepad on your computer and write out your model’s .skin file.
- After writing your .skin file, name it and save it as an .skin file in your newly created skins folder. Don’t save as a .txt file, but as an .skin file. You can easily rewrite the suffix to .skin.
The skin directory should mirror the material directory. The difference is that all of the path names are in the folders. In the above case, you would use skins/mapobjects/strogg/console/arcade_machine.skin. Example:
skin skins/mapobjects/strogg/console/arcade_machine/a_machine_yellow { "models/mapobjects/strogg/console/arcade_machine/a_machine" "models/mapobjects/strogg/console/arcade_machine/a_machine_yellow" }
This is a skin entry. It breaks down pretty simple:
skin – A keyword telling the game that this is an active skin
skins/mapobjects/strogg/console/arcade_machine/a_machine_yellow – This is the name of the skin entry. This is the name the game looks for when you call out a .skin file in radiant.
{ - open bracket – Exactly like the open bracket for material files. All .skin files MUST have an open and close bracket.
"models/mapobjects/strogg/console/arcade_machine/a_machine" – The first set of quotes is the original skin the model has on it. It’s usually the main version of the shader.
"models/mapobjects/strogg/console/arcade_machine/a_machine_yellow” – The second set of quotes is the shader that will replace the original skin.
} – close bracket – This closes the .skin entry.
Save file.
5.4 So, I have this all set up…now what? Ok, now you need to check if the .skin will work. You’ll need to load the model’s geometry in radiant and check your work.
- Run q4local.exe
- Drop down the console (hit ~) and type in editor.
- Let the editor load up and right click in the XY top window
- In the pop down menu select “new model…”
- A dialog box will appear with a “base” folder.
- Find your low poly model
- Highlight it and click OK
- Allow the model to load
- With the model highlighted go to the Inspectors window
- DO NOT HIT THE SKIN BUTTON (it is currently broken, or at least it was)
- Go the Key window and type in skin
Underneath it is the Value window type in the skin name: In the above example: skins/mapobjects/strogg/console/arcade_machine/a_machine_yellow
- Hit enter
- Place a light in the level.
- Deselect the model by hitting “esc”.
- Right click in the XY top window.
- In the pop down menu select light.
- A light entity should appear.
- View the model with dynamic light by pressing F3 and F4 and look in their Render window.
- You should be seeing new skin on the old geometry. 5.5 If everything works correctly, you're good to go!