Creating Multiple Skins For A Model

From The DarkMod Wiki
(Redirected from Skin)
Jump to navigationJump to search

The skins functionality in D3 allows a single model to have a number of textures ("skins") which can be selected from a dialog in the editor. This provides ease-of-use for mappers and provides a great variability for the models.

File Structure

An entry in the skin file has the following basic structure: skin [name] { model [complete path of the model] [name of material definition to be replaced] [name of replacement material definition] }

TIP: You can view the skins that ship with the game in tdm_models_decls01.pk4\skins\

Creating a New Skin

The header has the format skin [your_skin_name] Your skin name has to be unique and (like all definitions in TDM) should not contain any hyphens (-).

In the inner part of the brackets, you first define for which model the skin can be applied. If you do not define this, the skin will not show in the model menu in DR. Regardless, it can still be applied via the skin spawnarg. In this place you can define several models at once, if they share textures. Make sure to use the complete path inside the TDM folder and to include the file extension of the model. The easiest way to do this (and to avoid any spelling errors) is by inserting the model into DR and copying the "model" spawnarg to your skin file. Note that the file ending is not recognised if written in caps.

In order to replace materials, you first need to know which materials are present in a given model. One easy way to do that is to open the model preview window in DR. On the left side, directly beneath the models list, there is a list of all materials used in the selected model. To replace one or several of these, you insert the whole path of the material you want to replace and, separated with a space (or for better readability a tab), write the path of the material you want as a replacement behind it. If you want to replace more than one material you can simply list the materials in the aforementioned style beneath each other. Each texture that gets not listed here, is not replaced. If you want any part of the model to not appear at all you can use the nodraw material ("textures/common/nodraw").

Common Errors

If the model should appear completely black in game, this means that TDM cannot find your definition for the skin. Check for spelling errors! Similarly, if any part of your model appears black, the defined texture cannot be found. Keep in mind, that any custom texture you want to use has to have a material definition!

Another reason could be that you used a number at the start of your skin-name. This does not work in tdm. You can use a number in the skin-name, but not at the start.

If the skin does not show up as an option for your model, you have an error in the "model" line. Make sure you have included the file extension of the model and that this is in lower cases, as an upper case file extension might not be registered.

Example

Let's say you want to exchange one material of Springheel's module "mansion01_wall04", so the white part is stone instead.

First, create a file named "stone_wall.skin" (or any other name) in the folder [your_FM]/skins and open it. Then, create a skin entry:

skin mansion01_stone
{
}

(Make sure that the skin-name does not start with a number, because that won't work. So for example using 01mansion_stone will not show up in tdm. You will see a black texture.)


Personally, I would recommend to write the brackets right away, so you will not forget it later. In order to show the skin in DR, give the complete path of mansion01_wall04, including its file extension:

skin mansion01_stone
{
model models/darkmod/architecture/modules/interior_mansion01/mansion01_wall04.lwo
}

As described before, the easiest way to find the material you want to exchange is to choose "Create model..." and search for the model you want to work on. In the "Choose Model" window, you can find all used materials in the model; in this case:

"textures/darkmod/wood/boards/white_painted_wood01"

"textures/darkmod/wood/panels/molding_walnut"

"textures/darkmod/wood/panels/panel_carved_rectangles_01_walnut"

"textures/darkmod/wood/panels/walnut_panel01"

"textures/darkmod/wood/panels/wood_walnut_panel02"

By unticking each "Visible" mark, we can see, which material we need. The white part is "textures/darkmod/wood/boards/white_painted_wood01". As a stone material I have chosen "textures/darkmod/stone/brick/blocks_brown". This will just be put into the next line (for better readability, I recommend to leave one line free in between) and we get:

skin mansion01_stone
{
model	models/darkmod/architecture/modules/interior_mansion01/mansion01_wall04.lwo

textures/darkmod/wood/boards/white_painted_wood01	textures/darkmod/stone/brick/blocks_brown
}

When you want to test, if your skin is registered and works, you can update all existing skins in DR via File -> Reload Skins

Wildcard skins

If you want to replace every material on a model with the same material, you can use the * character (to mean "every material").


For example, this skin will turn any entire model to stone, regardless of what materials it used originally:

 skin all_dark_rough_stone {
 	* textures/darkmod/stone/natural/dark_rough
 }

Another swap example, for an invisible skin:

 skin invisible {
 	* "textures/common/nodraw"
 }

Or suppose you want to get rid of all decals on a model, say, for performance reasons:

 skin no_decals {
  	textures/darkmod/decals/* textures/common/nodraw
 }