Jump to content
The Dark Mod Forums

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

    • freyk

      Some years earlier i created some launchers for TDM. uploaded today some new sourcecode and executables on my github repo.
       
      · 0 replies
    • Epifire

      Say, I know it's been a while since the site got overhauled from the crash. But did we ever figure out if/how to get the recent topics & replies list back? It's not a total deal breaker but it was nice for becoming a thread creeper again...


      · 2 replies
    • Epifire

      Some of you who've been on the TDM discord know I was out of work last Winter, just putting in hrs for the developer portfolio. Currently I've been working a seasonal job to pay the bills and now I'm finally in my last week before I get bumped off. Things will be tight but I'm planning a long off period to make as much content as I can. Big plans in Unreal Engine as well as my most ambitious TDM collab yet! Never been so excited to be a stuck at home to pursue my life's work. With a lotta time and maybe some luck, I'm hoping to get enough art work done that I may start applying around to studios.
      · 4 replies
    • STiFU

      I finally got around to play Prey and I truly loved it. It is an incredible homage to System Shock and Deus Ex. While the gameplay is not en par with those two titles, the game makes up for that with its well written lore and story. The whole "world" just feells so authentic and it features a ton of really god environmental story-telling. Recommended for every immersive sim fan, i.e., everyone on this forum.
      · 2 replies
    • jaxa

      Alder Lake has arrived:
      https://forums.thedarkmod.com/index.php?/topic/18055-2016-cpugpu-news/page/15/&tab=comments#comment-466190
       
      · 0 replies
×
×
  • Create New...