BuddhaMaster@Posted: Fri Sep 21, 2007 8:49 pm :
Hey, i have just several hours tried to figure out how change one Material for just one variation of a Model.

Speaking about the Barrel!

Doom3 has 4 different Barrels, but all use the same Model. For my new Replace, i made two Models: One "open" and the other "closed".
Now i wanted to Replace only the Red Barrel with the "open", all other "closed".
But whatever i do, i cannot make it use the other Model! (or Skin).

The Rest is blabla...
I have made several different Skins to Replace the Original. (And a model of course).
It has bump-maps and everything...
Image

But even if i replace the Red version in file skins.skin It does not even change anything.

Code:
//CB Classic Barrel Skins! default Model Skin = closed. Others changed here
skin skins/exp_barrel_red {
   model                      models/mapobjects/fuel_barrel/[color=#FFBF00][b]exp_barrelOpen.lwo[/b][/color]
   models/mapobjects/fuel_barrel/exp_barrel      models/mapobjects/fuel_barrel/exp_barrel_red
   models/mapobjects/fuel_barrel/top_masked      models/mapobjects/fuel_barrel/top_masked
   models/mapobjects/fuel_barrel/exp_barrel2      models/mapobjects/fuel_barrel/exp_barrel2_red
   models/mapobjects/fuel_barrel/exp_barrel2a   models/mapobjects/fuel_barrel/exp_barrel2a_red
}

skin skins/exp_barrel_blue {
   model                      models/mapobjects/fuel_barrel/exp_barrel.lwo
   models/mapobjects/fuel_barrel/exp_barrel      models/mapobjects/fuel_barrel/exp_barrel_blue
   models/mapobjects/fuel_barrel/exp_barrel2      models/mapobjects/fuel_barrel/exp_barrel2_blue
   models/mapobjects/fuel_barrel/exp_barrel2a   models/mapobjects/fuel_barrel/exp_barrel2a_blue
}

skin skins/exp_barrel_white {
   model                      models/mapobjects/fuel_barrel/exp_barrel.lwo
   models/mapobjects/fuel_barrel/exp_barrel      models/mapobjects/fuel_barrel/exp_barrel_white
   models/mapobjects/fuel_barrel/exp_barrel2      models/mapobjects/fuel_barrel/exp_barrel2_white
   models/mapobjects/fuel_barrel/exp_barrel2a   models/mapobjects/fuel_barrel/exp_barrel2a_white
}


Huumm ? I tell it to use the "open" Model for the red barrel but its still the same Model in the game... why isnt that working ?

It would be enough to just tell the red barrel/skin to use another material for the top.
Because the top of the Barrel has a own Material and i have prepared two Materials: One which shows the Top and the other makes it invisible: so you can see the Slime.

...either all are open - or all are closed :cry:
Image

Here a focus in the skins.skin code again:

Code:
skin skins/exp_barrel_red {
   model                      models/mapobjects/fuel_barrel/[color=#FFBF00][b]exp_barrelOpen.lwo[/b][/color]
   models/mapobjects/fuel_barrel/exp_barrel      models/mapobjects/fuel_barrel/exp_barrel_red
[color=#FFBF00][b]   models/mapobjects/fuel_barrel/top_masked      models/mapobjects/fuel_barrel/top_masked[/b][/color]
}



models/mapobjects/fuel_barrel/top_masked = material-name as declared in the exp_barrelOpen.lwo Model. Since the Model isn't actually replaced! it will also not know and use the name(skin).

So. How/where do i change Top_masked Material for only the Red Barrel ? ??

Please, pleasy pleasy help me :(
I cant figure it out.


If ya wanna see the rest of the code...:
senetemp.mtr. The Material-file

Code:
//barrel_red
models/mapobjects/fuel_barrel/exp_barrel2a_red
{
   noshadows
{   // 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.25 + 0.5 * (time - parm7)
   }
   {
      blend      bumpmap         
      map      addnormals (models/mapobjects/fuel_barrel/DoomBarrelSkin_local, heightmap (models/mapobjects/fuel_barrel/DoomBarrelSkin_bmp2, 2) )
   }
   {
      if ( parm7 == 0 )
      blend      diffusemap      
      map      models/mapobjects/fuel_barrel/exp_barrel2_red
      alphatest   .45
      rgb      .2
   }
   {
      if ( parm7 )
      blend      diffusemap      
      map      models/mapobjects/fuel_barrel/exp_barrel2_red
      // alphatest   .45
      rgb      .2
   }
}

models/mapobjects/fuel_barrel/exp_barrel2_red
{
   noshadows
{   // 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.25 + 0.5 * (time - parm7)
   }
   {
      blend      bumpmap         
      map      addnormals (models/mapobjects/fuel_barrel/DoomBarrelSkin_local, heightmap (models/mapobjects/fuel_barrel/DoomBarrelSkin_bmp2, 2) )
   }
   {
      if ( parm7 == 0 )
      blend      diffusemap      
      map      models/mapobjects/fuel_barrel/exp_barrel2_red
      alphatest   .45
   }
   {
      if ( parm7 )
      blend      diffusemap      
      map      models/mapobjects/fuel_barrel/exp_barrel2_red
      // alphatest   .45
   }
   specularmap      models/mapobjects/fuel_barrel/DoomBarrelSkin_s
}

//CD Slime for "classic barrel"
models/mapobjects/fuel_barrel/Slime
{
   translucent
   //nonsolid
   //noimpact
   //twosided
        noSelfShadow
       noshadows
   //polygonOffset
   qer_editorimage   models/mapobjects/fuel_barrel/Slime.tga
   
   {
      blend add
      map models/mapobjects/fuel_barrel/Slime
      scroll time * .1 , time * -0.1
//        alphatest (0.01 + alpyTable[time / 4])
   }
   {
      blend add
      map textures/washroom/water01
      scroll time * .16 , time * -0.2
      scale    1.9 , 2.1
//       alphatest (0.01 + alpyTable[time / 3])
   }
}

//CD Classic Barrel - top and bottom. For Closed Version (yellow-barrel etc)
models/mapobjects/fuel_barrel/bottom
{
   twosided      //ohhhhhhh, now its working, why??.....
   noSelfShadow
   {
      blend      bumpmap         
      map      addnormals (models/mapobjects/fuel_barrel/Top_and_Bottom_local, heightmap (models/mapobjects/fuel_barrel/Top_and_Bottom_bmp, 2) )
   }
   diffusemap      models/mapobjects/fuel_barrel/Top_and_Bottom
   specularmap      models/mapobjects/fuel_barrel/Top_and_Bottom_s
}

models/mapobjects/fuel_barrel/top
{
/*   qer_editorimage   textures/base_trim/grate1a.tga
   noshadows
   twoSided
   nonsolid
   noimpact
   playerclip
   monsterclip
   {
      blend bumpmap
      map models/seneca/textures/grate1_local.tga
   }
   {
      blend diffusemap
      map models/seneca/textures/grate1a_d.tga
      alphaTest 0.5
   }
*/
//   twosided
   noshadows
   noSelfShadow
//   noSelfShadow   //whatever..

   {
      blend      bumpmap         
      map      addnormals (models/mapobjects/fuel_barrel/Top_and_Bottom_local, heightmap (models/mapobjects/fuel_barrel/Top_and_Bottom_bmp, 2) )
   }

   {       
      blend diffusemap
      map         models/mapobjects/fuel_barrel/Top_and_Bottom
      alphaTest   0.5
   }

   specularmap      models/mapobjects/fuel_barrel/Top_and_Bottom_s
}


//CD Classic Barrel - top invisible. For open Version (original)
models/mapobjects/fuel_barrel/top_masked
{
   noshadows
}

//CD changed Skin: Red Barrel to "Classic Barrel"
models/mapobjects/fuel_barrel/exp_barrel_red
{
   twosided      //ohhhhhhh, now its working, why??.....
   noSelfShadow
   {
      blend      bumpmap         
      map      addnormals (models/mapobjects/fuel_barrel/DoomBarrelSkin_local, heightmap (models/mapobjects/fuel_barrel/DoomBarrelSkin_bmp, 2) )
   }
   diffusemap      models/mapobjects/fuel_barrel/DoomBarrelSkin
   specularmap      models/mapobjects/fuel_barrel/DoomBarrelSkin_s
}

//barrel_white
models/mapobjects/fuel_barrel/exp_barrel2a_white
{
   noshadows
   {
      blend      bumpmap         
      map      addnormals (models/mapobjects/fuel_barrel/DoomBarrelSkin_local, heightmap (models/mapobjects/fuel_barrel/DoomBarrelSkin_bmp2, 2) )
   }
   {
      blend      diffusemap      
      map      models/mapobjects/fuel_barrel/exp_barrel2_white
      alphatest   .45
      rgb      .2
   }
}

models/mapobjects/fuel_barrel/exp_barrel2_white
{
   noshadows
   {
      blend      bumpmap         
      map         addnormals (models/mapobjects/fuel_barrel/DoomBarrelSkin_local, heightmap (models/mapobjects/fuel_barrel/DoomBarrelSkin_bmp2, 2) )
   }
   {
      blend      diffusemap      
      map         models/mapobjects/fuel_barrel/exp_barrel2_white
      alphatest   .45
   }
   specularmap      models/mapobjects/fuel_barrel/DoomBarrelSkin_s
}

models/mapobjects/fuel_barrel/exp_barrel_white
{
   twosided      //allright, here we have TWOSIDED, why isn't ??
   noSelfShadow
   {
      blend      bumpmap         
      map      addnormals (models/mapobjects/fuel_barrel/DoomBarrelSkin_local, heightmap (models/mapobjects/fuel_barrel/DoomBarrelSkin_bmp, 2) )
   }
   diffusemap      models/mapobjects/fuel_barrel/BarrelSkin_based_on_scratch_only
   specularmap      models/mapobjects/fuel_barrel/DoomBarrelSkin_s
}
// etc..

shows my prepared stuff and the top & top_masked material... i repead: either all these barrels use the open or all use the closed :(



Ivan_the_B@Posted: Fri Sep 21, 2007 9:26 pm :
Are you trying to replace a model by changing the skin?
It's impossbile.

You need to replace the "model" key in the entity definition (see moveable_explodingbarrel in moveable.def as example)
You can also set the "skin" key in the def so that the materials used in your model will be replaced by the specidied ones.
But not the model.



BuddhaMaster@Posted: Sat Sep 22, 2007 3:25 am :
See, thats what i'm talking about. I haven't moved to that file yet.
moveable.def contains model and skin entry
Not sure if that helps me yet. Probably not. But i'am really wondering about this:
"skin" "skins/exp_barrel_red"
The default Barrel normaly is the yellow and the red is a variation of it... here it seems different

But it must be possible to give the red skin an additional material change! since the Barrel already has a changing skin to make the blue, yellow, white and red versions out of of itl. I also need to indepent change the "Top". When it works for the default Material, it must be possible to another.

clearly speaking: Original Barrel has 1 Material. My Barrel actually has 4, yeh, thats alot. But should not matter. I just need to change 2 of these Materials for the "red skin" instead of only the default :) it "should" really be that easy


...............IF really nothing helps.... I have to re-create all textures to include the top on the same texture, having only 1 Material (expect for the slime) and then just make the top "invisible" to reveal the slime and make it "open", for the one i want. But oh dear...
It's always the same dude, more tech and more tech but the easyst stuff sucks always :|



rich_is_bored@Posted: Sat Sep 22, 2007 6:35 am :
You need to do some reading my man...

http://www.modwiki.net/wiki/Skin_%28decl%29

Skins don't swap models out. The model parameter you're tinkering with does not do what you think it does.

I've updated the wiki page to make it's function more clear.



BuddhaMaster@Posted: Sat Sep 22, 2007 7:22 pm :
It was almost clear to me. I dont need to replace the model for on one skin version of a model.

I need to declare a already existing skin def, to change another part of that model when it uses that skin. Instead of defining a skin for 1 material, i want it for 2 :)
Think of following: You take a human model, he has several skins to let his eyes glow in every color. But now you add him a third eye which uses a different color each skin. Not Possible?

You say i'am wrong, the model is not declared by one of its skin-def. Was almost clear. But the skin by its model. you say that yourself in that text: An optional model keyword can be included in the declaration. This keyword defines what model the skin is intended to be used with.
See, why is my Barrel not using this Material (top_masked) that i declared beside the model's name. (expBarrel_open.lwo) ? this Material is a null_mask to "remove" the top.

As you wrote yourself again: Skins are also used to make parts of a model invisible, by replacing a material with the "nodraw" material (textures/common/nodraw). This is often used if multiple weapons are attached to a model, and only one weapon should be visible at a time.

Exactly what i want: Making a Part of my model invisible only under a special circumstance (in this case being the "exp_barrel_red", else using the visible Material)

Or am i limited in 1 Material when doing skins ?

Pointing to the important part:
Code:
skin skins/exp_barrel_red {
   model                      models/mapobjects/fuel_barrel/exp_barrelOpen.lwo
   models/mapobjects/fuel_barrel/exp_barrel      models/mapobjects/fuel_barrel/exp_barrel_red
   models/mapobjects/fuel_barrel/top_masked      models/mapobjects/fuel_barrel/top_masked
}


I'am already using the Same Model for all Barrels.
One of its Materials-names is models/mapobjects/fuel_barrel/top_masked (set in the modeller, not def's or anything). Better Lets call it SURFACE ! That should point to which material is used to that name. Or not ? Exactly that way i assigned the other materials , and it worked. Exactly how the original d3 barrel.lwo also does it.
But this top_masked declaration here is definatively doing nothing..

I just think it should exactly doing that. But now i wonder where else..



Ivan_the_B@Posted: Sat Sep 22, 2007 7:40 pm :
I'll be short and clear, I hope.
in the def you need to set the model and the skin keys

entityDef your_object_name { //your object
//other stuff here
"model" "models/mapobjects/fuel_barrel/exp_barrelOpen.lwo" //your model
"skin" "skin" "skins/exp_barrel_red" //your skin
}

This (and only this) tells the game to apply that skin to the specified model.

Your skin should be used to use alternative materials instead of the default ones used in your model.
For example: (forget about the "model" keyword in the skin... it's useful for the editor only)
Code:
skin skins/exp_barrel_red {
   models/mapobjects/fuel_barrel/exp_barrel      models/mapobjects/fuel_barrel/exp_barrel_red
   models/mapobjects/fuel_barrel/top_masked      models/mapobjects/fuel_barrel/top_masked
   models/mapobjects/fuel_barrel/exp_barrel2      models/mapobjects/fuel_barrel/exp_barrel2_red
   models/mapobjects/fuel_barrel/exp_barrel2a   models/mapobjects/fuel_barrel/exp_barrel2a_red
}


That means that your model uses the material:
models/mapobjects/fuel_barrel/exp_barrel
but it'll be replaced by the material named:
models/mapobjects/fuel_barrel/exp_barrel_red

And so on for the other materials.

So, assuming that you want to hide the part of the model that uses models/mapobjects/fuel_barrel/top_masked, you can write in you skin:
Code:
skin skins/exp_barrel_red {
models/mapobjects/fuel_barrel/top_masked    textures/common/nodraw
//other stuff here
}



BuddhaMaster@Posted: Sat Sep 22, 2007 9:24 pm :
Oh wait! i think now i got it:

Code:
skin skins/exp_barrel_red {
   model                      models/mapobjects/fuel_barrel/exp_barrel.lwo
   models/mapobjects/fuel_barrel/exp_barrel      models/mapobjects/fuel_barrel/exp_barrel_red
   models/mapobjects/fuel_barrel/top_masked      models/mapobjects/fuel_barrel/top_masked
   models/mapobjects/fuel_barrel/exp_barrel2      models/mapobjects/fuel_barrel/exp_barrel2_red
   models/mapobjects/fuel_barrel/exp_barrel2a   models/mapobjects/fuel_barrel/exp_barrel2a_red
}


That actually REPLACES a given material instead of assign a material to the here declared name, to get used when a models surface uses that name. ?? oooh :shock:

By the way: Thats my code. Everything was just fine

I was soooooo wondering whats going on. I mean everything was done ! I use my own "invisible" material, thats top_masked. Its just a variation of the default "closed"top to have a open skin. But all Materials, skin def's were done etc. Bump maps and my extremly extraordinary shader :D:wink: well.. THANKS, but everything functioning perfectly. Just had no idea why cant get the skin changed.

What a waste of useless tips. I knew nobody would understand me. ;)

Now if that works. That simple line should solve all my problems:

Where being skins/exp_barrel_red {
change:
Code:
   models/mapobjects/fuel_barrel/top      models/mapobjects/fuel_barrel/top_masked


Means:
Will that JUST (as simple as it gets) change, .....the top material... to, ....top_masked .....when - it - is : skins/exp_barrel_red [color=#BF0040]RIGHT[/color] ?
were wonderfull :D



BuddhaMaster@Posted: Mon Sep 24, 2007 9:16 am :
Ok, it works now !

Different Barrels:
Image

all use the same model but only 1 skin invisible top

Thanks alot - problem solved.

Now, can i make the open emit light to its surrounding enviroment - lightshader ? :)
And i wish to make the slime better.
Image
Now only 2 transparent panning textures.
I wish to make it somewhat similar to that extreme bump-mapped hazardous stuff from Doom3.
But i cannot find it ! How do i best view/ scroll trough the textures ?



rich_is_bored@Posted: Tue Sep 25, 2007 7:15 am :
To make the barrels emit light you either need to make them light entities or use a scriptobject to spawn and bind light entities to them.

As far as locating textures, that can be difficult to do. The level editor isn't stable enough for browsing all the available texture assets reliably.

IMO, the best way to find a texture is to run through various maps while using the CVar r_showsurfaceinfo.



BuddhaMaster@Posted: Wed Sep 26, 2007 11:36 am :
Yes i wish to make it its own Light entity
Have found this code in misc.def

Code:
entityDef light {
   "editor_color"            "0 1 0"
   "editor_mins"            "-8 -8 -8"
   "editor_maxs"            "8 8 8"
   "editor_rotatable"         "1"

   "editor_usage"            "Light source.  If health is set, light becomes breakable and turns off when shot."
   
   "editor_material texture"      "light shader to use."
   "editor_color color"         "light color"
   "editor_var shaderParm3"   "shaderParm 3"
   "editor_var shaderParm4"   "shaderParm 4"
   "editor_var shaderParm5"   "shaderParm 5"
   "editor_var shaderParm6"   "shaderParm 6"
   "editor_var shaderParm7"   "shaderParm 7"
   "editor_var count"         "how many times light must be triggered to toggle."
   "editor_var break"         "break when triggered."
   "editor_model model"         "model to use."
   "editor_model broken"         "model to use when the light is broken (defaults to model name with '_broken' appended to name)"
   "editor_var hideModelOnBreak" "hides the model when broken"
   "editor_var health"         "amount of damage to recieve before becoming broken.  0 is nonbreakable."
   "editor_var target"         "entities to trigger if shot."
   "editor_var levels"         "the number of times a light must be triggered until it turns off.  Each time it's triggered, it's dimmed to a lower level."
   "editor_var start_off"      "causes the light to be off when the level starts."
   "editor_var snd_broken"      "sound shader to use when broken"
   "editor_var mtr_broken"      "material to use when broken"
   "editor_color color_demonic"   "demonic color to use if in demonic mode."
   "editor_material mat_demonic"   "demonic shader to use if in demonic mode."
   "editor_var leave_demonic_mat" "leaves the demonic shader when the effect expires.. color is still reverted back."

   "spawnclass"            "idLight"
   "health"               "0"
   "levels"               "1"
   "start_off"               "0"
   "count"                  "1"
   "break"                  "0"
}


Probably thats what i need, but how should i add that to the barrel?

I have now added this code, taken from projectiles...

Code:
   "mtr_light_shader"            "lights/impflyflash"
  &n