Jump to content

Creating Frob Highlight texture for existing model


jaredmitchell
 Share

Recommended Posts

Hey there,

 

I've been making a map for a few months now, and am finishing up with polish before I can pass it off for critique. One thing I want to fix is making it so that an instance of the model the_hammer_small1.lwo can highlight when frobbed, as the goal of my map is to steal this particular item. I understand that this particular model wasn't intended as a loot item (as I had to make it an atdm:loot_broach entity), but I figured getting a highlight wouldn't be too much work.

 

Several hours later, I'm ready to pull my hair out. I've managed to make a .mtr file:

sk/the_hammer_small_highlight
{

metal

	diffusemap models/darkmod/props/textures/thehammer_small_bronze_d_ed
    {
        if ( parm11 > 0 )
        blend       add
        map         models/darkmod/props/textures/thehammer_small_bronze_d_ed
        rgb         0.15 * parm11		
	}
}

As well as a .skin file, which is showing up in DarkRadiant:

skin small_hammer_highlight
{
	model models/darkmod/decorative/statues/the_hammer_small1.lwo
	sk/the_hammer_small_highlight models/darkmod/props/textures/thehammer_small_bronze_d_ed
}

However, the texture used in editor and the game isn't the bronze texture that I've specified, which makes me believe there's an issue with the .mtr file, either in its being read, or its syntax.

 

Would someone be able to explain to me how to get this working? Much appreciated!

Link to comment
Share on other sites

textures in the editor are jpg's, textures on your model should be either tga or dds or both tga and dds.

 

this is the material settings for a pumpkin I made that is frobable, not the pumpkins that are included with the darkmod.

 

textures/darkmod/samhaim/jack5body
{

surftype15
description "cloth"

//jpg image seen by the editor darkradiant
qer_editorimage textures/darkmod/samhaim/jack5body_ed

//tga and dds image files seen by the darkmod engine
diffusemap textures/darkmod/samhaim/jack5body
{//i think this is the high light
if ( parm11 > 0 )
blend gl_dst_color,gl_one
map _white
rgb 0.30*parm11
}
{//i think this is whats seen from a distance when not in frobable range
if ( parm11 > 0 )
blend add

//tga and dds image file
map textures/darkmod/samhaim/jack5body
rgb 0.15*parm11
}
{//not actually sure what this bit does but its on all frobable items materials
blend add

//tga and dds image file
map textures/darkmod/samhaim/jack5body
red global2
green global3
blue global4
}
}

the parm11 is what highlights the body, it starts of looking like a normal model, when in range it lights up to show that its frobable,

 

although to make custom items you should really use the atdm:moveable_custom_item entity its in items/custom then you just change its properties, model, skin and add a collision box to it. if it doesn't already have one (which is create a box with the collision texture, move your custom object and collision box on to the editors origin. eg. bottom of custom entity on origin,place the collision box over the custom object, save collision box as collision box for the custom object. if using a moveable entity already in game it will have a collision box already, you might have to change to the collision box first to a func_static before saving it as the collision box for the custom item.)

Edited by stumpy
Link to comment
Share on other sites

textures/darkmod/samhaim/jack5body
{

    surftype15
    description "cloth"

       //jpg image seen by the editor darkradiant
      qer_editorimage textures/darkmod/samhaim/jack5body_ed

      //tga and dds image files seen by the darkmod engine
      diffusemap textures/darkmod/samhaim/jack5body
      {//i think this is the high light
            if ( parm11 > 0 )
            blend gl_dst_color,gl_one
            map _white
            rgb 0.30*parm11
      }
      {//i think this is whats seen from a distance when not in frobable range
            if ( parm11 > 0 )
            blend add

            //tga and dds image file
            map textures/darkmod/samhaim/jack5body
            rgb 0.15*parm11
      }
      {//not actually sure what this bit does but its on all frobable items materials
            blend add

            //tga and dds image file
            map textures/darkmod/samhaim/jack5body
            red global2
            green global3
            blue global4
      }
}

This is not completely true. Both image stages that starts with if (parm11>0) are used for frobhilighting. The white stage lets the frobhilight look a bit more washed out.

 

The last stage is missing the condition. if (global5==1) iirc. This stage is used for simple ambient rendering, so instead of using the ambient_world light this additive stage gets used for ambience. global2 - global4 are the colors of the ambient_world light.

 

On file formats. You cna use tga for editor images, too. The reason why they are jpegs in most cases is the compression. Quality isn't that important in the editor preview. Jared, add the white stage to your materail, too. Additionally, make sure that the dimensions of the image you use is dimensioned in powers of two, for example 256x256 or 256x512 or similar.

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Several hours later, I'm ready to pull my hair out. I've managed to make a .mtr file:
sk/the_hammer_small_highlight
{

metal

	diffusemap models/darkmod/props/textures/thehammer_small_bronze_d_ed
    {
        if ( parm11 > 0 )
        blend       add
        map         models/darkmod/props/textures/thehammer_small_bronze_d_ed
        rgb         0.15 * parm11		
	}
}

As well as a .skin file, which is showing up in DarkRadiant:

skin small_hammer_highlight
{
	model models/darkmod/decorative/statues/the_hammer_small1.lwo
	sk/the_hammer_small_highlight models/darkmod/props/textures/thehammer_small_bronze_d_ed
}

 

If I read this right, sk/the_hammer_small_highlight is your new replacement material. In that case, try reversing the order of items in the last non-brace line of the skin def. so it's <material to replace> <with this one>. Also, you want the material name, not an image and certainly not an editor image, which is what models/darkmod/props/textures/thehammer_small_bronze_d_ed looks like. DR's choose model dialogue says the_hammer_small1.lwo uses only one material, tdm_hammer_medium_stone. So try making the last line:

tdm_hammer_medium_stone sk/the_hammer_small_highlight
Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

So try making the last line:

tdm_hammer_medium_stone sk/the_hammer_small_highlight

 

Oh, uh, I solved it while you were posting, and that was part of it. So you were right!

 

I poked around some more in the .pk4s and found the .mtr and .skin entries for this model. I was able to copy and paste them, then add the frob conditions. I was also unaware that it was using the bump and spec maps from the medium-sized model, so that might've been part of it.

 

Thank you again, everybody!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recent Status Updates

    • STiFU

      Anyone here played Inscryption? At first, I was like "no, I am not going to play a stupid card game", but this game is so much more than that. It is so meta, full of 4th wall breaks, and feels so damn spooky and weird because of it. Absolutely recommended, if you can stand the visuals. I recommend not reading up too much on it, as that could easily spoil half the incredible surprises. Just know that what you see in the beginning is by far not everything.
      · 4 replies
    • freyk

      Tried to make a tdm advertisement commentpost at one of civvie11 youtube videos about T2. Post got marked as spam. His problem (to not discover TDM for himself),..not my problem.
      But some help of some fellow TDM yt-videocomment posters would be nice. To ask him and others, to play TDM. To get more players/creators. 
      · 4 replies
    • datiswous

      Currently Profile Information has 3 fields, these are shown in forum posts under your avatar:
      1. Gender
      2. Location
      3. Interests
      I think that it could be useful to have an extra field called "Operating system" (under location). It can be useful for tech support and to see what people use.
      Alternatively it could be a more general term, like PC system, so that you can for example state that you use an AMD gpu.
      · 2 replies
    • OrbWeaver

      Greetings fellow kids.
      · 11 replies
    • Crafty_Creeper

      Keep on Creeping on...
       
      · 3 replies
×
×
  • Create New...