Multiple Skins for a Single Model: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Picky)
m (→‎General definition: didn't work out otherwise)
Line 55: Line 55:
Here's a general definition for reference if you have to use several skins:
Here's a general definition for reference if you have to use several skins:


$texturegroup skinfamilies
<pre>$texturegroup skinfamilies
  {
  {
  {  "original1.vtf",      "original2.vtf",      ...,      "originalX.vtf" }
  {  "original1.vtf",      "original2.vtf",      ...,      "originalX.vtf" }
Line 61: Line 61:
{            "...",                "...",      ...,                "..." }
{            "...",                "...",      ...,                "..." }
  { "replaceX_1.vtf",      "replaceX_2.vtf",      ...,      "replaceX_X.vtf" }
  { "replaceX_1.vtf",      "replaceX_2.vtf",      ...,      "replaceX_X.vtf" }
  }
  }</pre>


== Further annotations ==
== Further annotations ==

Revision as of 01:10, 31 March 2006

In some cases it can be helpful for a mapper if he can choose between different skins for the model. It's easy to add more variety to your custom models with multiple skins without as much work as creating a totally new model and skin.

The advantage of having several skins in one model instead of compiling several new models are:

  • easier to find because the model overview isn't cluttered
  • less disc space and ingame model load
  • faster than compiling a new model for each skin


Basic example with one skin replaced

The example here is a lamp that is either on or off, a different skin for each situation will make the model look a lot better.

$modelname mymodelfolder/mylamp.mdl
$cdmaterials modeltextures/mytexturefolder
$surfaceprop metal
$staticprop
$body studio "mylamp.smd"
$texturegroup skinfamilies
{
	{ "lampon" }
	{ "lampoff" }
}
$sequence idle "mylamp.smd" fps 1
$collisionmodel "mylamp_phys.smd"
Note.pngNote:$texturegroup needs to follow $body.

You define your different textures between $texturegroup skinfamilies { and }. The name of the first texture (in this case "lampon") needs to be similar to the texturename you used in your model (If you are not sure, open the .smd with a text editor, in the triangles block you'll find the name). Otherwise studiomdl.exe doesn't know which one to replace.

In the following lines you can define the new textures between { and } that will be rendered instead of the original one.

Example with two skins replaced several times

If your model does have several textures, you can replace all of those. Here's another example: You got a lamp in which you want to insert either a red, green or blue lightbulb. However the lamp itself can either be new or old and rusty.

$texturegroup skinfamilies
{
	{ "lampnew", "lightbulbred" }
	{ "lampnew", "lightbulbgreen" }
	{ "lampnew", "lightbulbblue" }
	{ "lamprusty", "lightbulbred" }
	{ "lamprusty", "lightbulbgreen" }
	{ "lamprusty", "lightbulbblue" }
}

Once again you have to make sure that your model uses the material names in the first line.

However, using multiple materials on the same model creates a significant performance hit, so this should be done sparingly!

General definition

Here's a general definition for reference if you have to use several skins:

$texturegroup skinfamilies
 {
 	{  "original1.vtf",       "original2.vtf",      ...,       "originalX.vtf" }
	{ "replace1_1.vtf",      "replace1_2.vtf",      ...,      "replace1_X.vtf" }
	{            "...",                 "...",      ...,                 "..." }
 	{ "replaceX_1.vtf",      "replaceX_2.vtf",      ...,      "replaceX_X.vtf" }
 }

Further annotations

  • Translucent models will only cast the shadows of the first skin

With the use of $shadowlod you should be able to address the problem