Tetzlaff@Posted: Tue Oct 03, 2006 2:19 pm :
I made an alternative skin for the Z-Sec, consisting of a custom diffuse map, specular map and normal map. What I want to do is apply my custom skin to a model in the editor, just like you can apply the alternative a_hellimp skin to the Imp.
So, my goal is to have a regular zsec_pistol standing in my level side by side with a zsec_machinegun who is wearing my new custom skin.

I tried to set it up this way. The 3 new skin textures are named

mgsecurity.tga
mgsecurity_local.tga
mgsecurity_s.tga

and placed in

models/characters/male_npc/security

(just like the regular dsecurity skin). I also put .dds versions of the textures in the respective directory.

Then I created a new .mtr file in "materials" named tetz_monsters.mtr :
Code:
models/characters/male_npc/security/mgsecurity
{
        noselfShadow
        clamp
      unsmoothedTangents
      flesh
      forceOverlays

   {   // burning corpse effect
      if   parm7         // only when dead
      // make a burned away alpha test for the normal skin
      blend   gl_zero, gl_one         // don't draw anything
      
      map models/monsters/spectre/global_dis.tga   // replace this with a monster-specific texture
      alphaTest 0.05 + 1.5 * (time - parm7)
   }


      diffusemap     models/characters/male_npc/security/mgsecurity.tga

      {
        blend bumpmap
          map  addnormals(models/characters/male_npc/security/mgsecurity_local.tga, heightmap(models/characters/male_npc/security/security_h.tga, 5 ) )
       
        }
        specularmap   models/characters/male_npc/security/mgsecurity_s.tga
}


Then I created a skin file in "skins" named skins_monsters_tetz.skin, but I´m totally confused, don´t know how I should set this all up correctly. Is the mtr file done right, and if yes, how do I reference it in the .skin file?

All files are packed in a pk4 file named skn_zsec.pk4 and put in the Doom3 base directory. The skin textures are working allright when I set them up as replacement skins (replacing all the Zsec skins alike), so the problem really lies in the mtr. and .skin files.


edit: I can select my skin in the editor, and when I apply it to the model the value is

skins/models/monsters/mgsecurity

but in game, it still shows the standard Zsec skin instead of my custom skin.
My skin file:

Code:
skin skins/models/monsters/mgsecurity {
   models/characters/male_npc/security/security models/characters/male_npc/security/mgsecurity
   }



der_ton@Posted: Tue Oct 03, 2006 4:48 pm :
These links might help:
http://www.modwiki.net/wiki/Skin_%28decl%29
http://iddevnet.com/doom3/skins.php

If you still have problems, also post your skin file. :)

You can test if your material is working by applying it to level geometry in the map editor, or by modifying a .md5mesh file so that it uses your new material directly.



Tetzlaff@Posted: Tue Oct 03, 2006 6:17 pm :
Thanks, I will see if I can figure it out.



Tetzlaff@Posted: Wed Oct 04, 2006 8:50 am :
I still can not get it to work. I updated my post above with the .skin file.

I can select my skin in the editor, but after I apply it to the model, it still shows the standard Zsec skin. Could somebody maybe check the code? I can´t see where the error is.



der_ton@Posted: Wed Oct 04, 2006 9:14 am :
I think I read somewhere that skins are not applied in the editor, but ingame.

Can you check this?



6th Venom@Posted: Wed Oct 04, 2006 9:28 am :
more simple to create a new entity like:
Code:
model npc_mgsecurity {
   inherit            model npc_security
        skin                             skins/models/monsters/mgsecurity
}


...cause the standard npc_security model define a skin too:
Code:
model npc_security {
   inherit                     npc_base
   mesh                     models/md5/chars/security.md5mesh
   skin                     skins/characters/npcs/regsec.skin
   channel torso               ( *Waist )
   channel legs               ( origin Body Body2 *Hips -*Waist SPINNER eyecontrol chair)

}

Maybe that's the problem, so rather than define a skin in the editor, define a model (the new one with the right skin).



Tetzlaff@Posted: Wed Oct 04, 2006 9:47 am :
der_ton wrote:
I think I read somewhere that skins are not applied in the editor, but ingame.

Can you check this?


I don´t think so, you can apply the a_hellimp skin to the Imp in the Editor, I think that´s the way it´s supposed to work.

@ 6th Venom: when I create a new entity like that, will it still work with the Zsec monster?



rich_is_bored@Posted: Wed Oct 04, 2006 10:44 am :
Applying a skin is as simple as setting an entity's "skin" key/value pair.

You can do that from within the editor, in a script, or in a custom entity declaration. Anywhere you can set key/value pairs.



Tetzlaff@Posted: Wed Oct 04, 2006 11:23 am :
So what am I doing wrong here? I put a Zsec into my map, applied to the key "skin" the value "skins/models/monsters/mgsecurity", but there is no result in game.



6th Venom@Posted: Wed Oct 04, 2006 1:18 pm :
the original shader for the security model (and the dead one too) is models/characters/male_npc/security/dsecurity, so you skin should be:
Code:
skin skins/models/monsters/mgsecurity {
models/characters/male_npc/security/dsecurity models/characters/male_npc/security/mgsecurity
}

that's the real problem i think. :)



Tetzlaff@Posted: Wed Oct 04, 2006 1:46 pm :
Thank you very much Venom, now it´s working!

Only a small problem left: there is the underlying skeleton model visible at some points, probably have to make it nodraw somehow. I think someone had a similar problem, will do a search.

edit: And another problem... the skin works fine until the Zsec is dead - then suddenly the standard skin is displayed.

edit 2: found some info here http://www.doom3world.org/phpbb2/viewtopic.php?t=15993



rich_is_bored@Posted: Thu Oct 05, 2006 5:06 am :
Determine what model is used for that entity and open it in a text editor to find out what material shaders are referenced. You can then edit your skin to accomidate whatever shader is responcible for the skeleton portion of the mesh.

Most of the enemies in the game are removed when they die and are replaced by ragdoll entities. But because the ragdoll does not have the same "skin" key/value pair, it's no surprise that the skin is not applied.

The trick here is to create a new ragdoll entity by writing a new entity definition. In this new definition you'd inherit the key/value pairs from the original ragdoll but add a "skin" key/value pair that uses your custom skin.

From that point it's simply a matter of pointing the "ragdoll" key/value pair of the actor to your custom ragdoll definition.



Tetzlaff@Posted: Fri Oct 06, 2006 9:49 am :
Thanks, I will try this.

rich_is_bored wrote:
The trick here is to create a new ragdoll entity by writing a new entity definition. In this new definition you'd inherit the key/value pairs from the original ragdoll but add a "skin" key/value pair that uses your custom skin.


For this new entity definition, I`ll have to write a new .def file, where I have to add my custom definitions? So I basicly create a new monster type, which references to the standard Zsec, except for the skins?



rich_is_bored@Posted: Fri Oct 06, 2006 10:09 am :
You put custom definitions files in a "def" folder.

And no, you're not creating a new monster type. You're creating a new ragdoll type.

For clarification, look at the zsec's entity declaration. Find the "ragdoll" key/value pair. That entity is the ragdoll entity used for the zsec.

You create a new entity declaration that looks something like this...

Code:
entityDef myCustomRagdoll
{
   "inherit" "whatever the old ragdoll is called"
   "skin"   "myCustomSkin"
}


Now I'm not sure where you are setting the skin key/value pair for the zsec but you'd set the ragdoll key/value pair in the same manner only this time you point it to your custom entity declaration.