Creating Multiple Skins For A Model: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Tels (talk | contribs)
m re-org
No edit summary
Line 1: Line 1:
{{missing-image}} {{Original_Reference|Orbweaver|3098}}
{{Original_Reference|OrbWeaver|3098}}


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 (possibly) reduced memory usage as the model only needs to be loaded once.
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 (possibly) reduced memory usage as the model only needs to be loaded once.
Line 6: Line 6:
Model your object using your 3D application of choice. Here a simple pillar is being created.
Model your object using your 3D application of choice. Here a simple pillar is being created.


http://img407.imageshack.us/img407/711/skin15lp.jpg
[[Image:Skins1.jpg|300px]]


== Default Skin ==
== Default Skin ==
As usual, the model file points to the material paths that should be applied to that model in-game. This is the "default skin". In this example, I have given the model a default skin consisting of test colours only, to illustrate the process.
As usual, the model file points to the material paths that should be applied to that model in-game. This is the "default skin". In this example, I have given the model a default skin consisting of test colours only, to illustrate the process.


http://img517.imageshack.us/img517/6096/skin28cw.jpg
[[Image:Skins2.jpg|300px]]


The material file for this is as follows:
The material file for this is as follows:
Line 100: Line 100:
When all is set up correctly, the skins become available in the Skin Browser, which is accessed by clicking the '''Skin...''' button in the Entity Inspector.
When all is set up correctly, the skins become available in the Skin Browser, which is accessed by clicking the '''Skin...''' button in the Entity Inspector.


http://img305.imageshack.us/img305/6662/skin38qi.jpg
[[Image:Skins3.jpg|300px]]


Notice how the model's alternative skins are automatically located and listed under Matching Skins, due to the existence of a "model" line in the skin declarations. If no matching skins are found, check that the model path has been entered correctly.
Notice how the model's alternative skins are automatically located and listed under Matching Skins, due to the existence of a "model" line in the skin declarations. If no matching skins are found, check that the model path has been entered correctly.
Line 106: Line 106:
== The finished Product ==
== The finished Product ==


http://img510.imageshack.us/img510/9215/skin43qi.jpg
[[Image:Skins4.jpg|300px]]


Note that the use of vertex colours is a stage-specific keyword, therefore this can be selected on a per-skin basis. This model has vertex colours which are applied in only one skin (second from left).
Note that the use of vertex colours is a stage-specific keyword, therefore this can be selected on a per-skin basis. This model has vertex colours which are applied in only one skin (second from left).

Revision as of 22:45, 17 November 2007

Originally written by OrbWeaver on http://forums.thedarkmod.com/topic/3098

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 (possibly) reduced memory usage as the model only needs to be loaded once.

Model your object in the usual way

Model your object using your 3D application of choice. Here a simple pillar is being created.

Default Skin

As usual, the model file points to the material paths that should be applied to that model in-game. This is the "default skin". In this example, I have given the model a default skin consisting of test colours only, to illustrate the process.

The material file for this is as follows:

sk/templecolumn1_gndsupport
{
  {
     blend diffusemap
     map _white
     red 0.5
  }
}

sk/templecolumn1_pillar
{
  {
     blend diffusemap
     map _white
     red 0.0
  }
}

sk/templecolumn1_pillarbase
{
  {
     blend diffusemap
     map _white
     green 0.5
  }
}

sk/templecolumn1_topsupport
{
  {
     blend diffusemap
     map _white
     blue 0.5
  }
}

As you can see this model consists of four parts (submeshes), each of which can have its texture changed independently. This allows a greater variety of skins to be produced, just from stock textures.

Create the Skin File

Now the .skin file is created. This is a simple declaration which substitutes new textures for the default ones ("sk/templecolumn_whatever"). It contains an optional model specification which allows the skin to be easily matched to the model.

skin templecolumn1_whitemarble
{
   model models/custom/structural/column_pillar/templecolumn1.ase
   sk/templecolumn1_gndsupport textures/custom/marble/whitemarble
   sk/templecolumn1_pillar textures/custom/marble/whitemarble
   sk/templecolumn1_pillarbase textures/custom/marble/whitemarble
   sk/templecolumn1_topsupport textures/custom/marble/whitemarble
}

skin templecolumn1_whitemarble_vcol
{
   model models/custom/structural/column_pillar/templecolumn1.ase
   sk/templecolumn1_gndsupport textures/custom/marble/whitemarble_vcol
   sk/templecolumn1_pillar textures/custom/marble/whitemarble_vcol
   sk/templecolumn1_pillarbase textures/custom/marble/whitemarble_vcol
   sk/templecolumn1_topsupport textures/custom/marble/whitemarble_vcol
}

skin templecolumn1_speckedmarble
{
   model models/custom/structural/column_pillar/templecolumn1.ase
   sk/templecolumn1_gndsupport textures/custom/marble/whitemarble
   sk/templecolumn1_pillar textures/custom/marble/specked_marble
   sk/templecolumn1_pillarbase textures/custom/marble/specked_marble
   sk/templecolumn1_topsupport textures/custom/marble/whitemarble
}

skin templecolumn1_greystone
{
   model models/custom/structural/column_pillar/templecolumn1.ase
   sk/templecolumn1_gndsupport textures/custom/stone/crackedgreystone
   sk/templecolumn1_pillar textures/custom/stone/crackedgreystone
   sk/templecolumn1_pillarbase textures/custom/stone/crackedgreystone
   sk/templecolumn1_topsupport textures/custom/stone/crackedgreystone
}

Each skin has a name (which must be unique), a link to the model file, and a set of subtitutions in the form "old/texture/path new/texture/path". In this case the test colour textures are being replaced with stock textures that are already in my textures list, however they could just as easily be replaced by specific per-model skins or even nodraw textures if parts of the model should be hidden.

Notice that the skin "templecolumn1_speckedmarble" is applying different textures to different parts of the model (the top and bottom square supports will get a whitemarble texture, whereas the round pillar will get a specked marble texture).

Save this file in the skins/ folder with a .skin extension.

Choose your Skin in the Entity Inspector

When all is set up correctly, the skins become available in the Skin Browser, which is accessed by clicking the Skin... button in the Entity Inspector.

Notice how the model's alternative skins are automatically located and listed under Matching Skins, due to the existence of a "model" line in the skin declarations. If no matching skins are found, check that the model path has been entered correctly.

The finished Product

Note that the use of vertex colours is a stage-specific keyword, therefore this can be selected on a per-skin basis. This model has vertex colours which are applied in only one skin (second from left).

Note: You don't need modelling software unless

  • You want to add vertex colours to modulate a texture or blend between textures
  • You want to divide the mesh into submeshes in order to apply a different texture to each
  • You want to precisely fit a "trim" texture onto a specific part of the model (UV editing required)
  • You need to determine the UV face layout, and this has not been provided by the modeller