Home Technical Talk

TF2 Materials Help

Alright, so I'm trying to create a few items for TF2, but I'm currently encountering a problem with the material of one. The one I'm having trouble with consists of a diffuse map with an alpha channel (.vtf, 512x512) and a specular map (grayscale, .vtf), as well as the accompanying .vmt. The object was exported from 3ds map in .smd.

I managed to compile my model and all, but when I go to test it, I get this...

badmaterial.png

... Yeah, it's not supposed to have that weird pink and black texture.

This is my .vmt
"VertexLitGeneric"
{
"$basetexture" "Users/Brandon/Desktop/TF2 Models/Models/Metal Pipe/pipe_final/pipe_final.vmt"
"$model" 1
"$surfaceprop" "metal"
"$envmap" "env_cubemap"
"$envmapmask" "Users/Brandon/Desktop/TF2 Models/Models/Metal Pipe/pipe_final/pipe_final_spec.vmt"
"$envmaptint" "[0.5 0.5 0.5]"
"$envmapcontrast" .5
}

}

And my .qc
$modelname "custom\metal_pipe\pipe_final4.mdl"
$cdmaterials "C:\Users\Brandon\Desktop\TF2 Models\Models\Metal Pipe\pipe_final"
$body pipe_final "pipe_final.smd"
$scale 1
$sequence idle "pipe_final.smd"
$collisionmodel "pipe_final.smd"
{
	$mass 1.0 // Mass in kilograms
	$concave
}

I don't think it has to do with the unwrapping, since there is no pink in any of the maps, and the weapon looks perfect when rendered in 3ds max, which leads me to suspect the .vtf's and .vmt.

(On a second look, I should also move the model relative to the bone a bit. That's not hard to do, I don't need help with that part)

Replies

  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    ya got your QC pointing to a material in the wrong spot and your vmt pointing to a texture in the wrong spot.

    both the vmt and vtf should be stored in "STEAMDIR\USERDIR\team fortress 2\tf\materials\models\weapons"

    and once there both there fix your qc to point to the vmt and recompile, and fix the vmt to point to the new vtf location.

    you should be using relative paths too, the game automatically assumes materials will be stored in the tf/materials directory, so when you call a texture or call a material you can start from there in the path, since even if you do make it work somehow with the absolute paths, it will break again when you send it to someone else.

    you also got the wrong extension on your textures too.
  • Cyberogue
    Options
    Offline / Send Message
    Alright, so I moved the vtf's and vmt to materials\models\weapons\metal_pipe
    "VertexLitGeneric"
    {
    "$basetexture" "models\weapons\metal_pipe\pipe_final"
    "$model" 1
    "$surfaceprop" "metal"
    "$envmap" "env_cubemap"
    "$envmapmask" "models\weapons\metal_pipe/pipe_final_spec"
    "$envmaptint" "[0.5 0.5 0.5]"
    "$envmapcontrast" .5
    }
    
    $modelname "custom\metal_pipe\pipe_final10.mdl"
    $cdmaterials "models\weapons\metal_pipe"
    $body pipe_final "pipe_final.smd"
    $scale 1
    $sequence idle "pipe_final.smd"
    $collisionmodel "pipe_final.smd"
    {
    	$mass 1.0 // Mass in kilograms
    	$concave
    }
    

    It still shows pink though, anything wrong? I tried looking through the valve wiki
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    ya qc is still calling "weapons\metal_pipe" not "models\weapons\metal_pipe"

    and did you set the material name in your 3d package.
  • Cyberogue
    Options
    Offline / Send Message
    Wait, where is it missing the models\?

    Also I assume you mean the material name in 3ds max. What am I supposed to set it to? (I'm a bit new to this)
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    ah nvm i just read that wrong.

    well since you got the path right now, what you have to do is apply a material to it in max, and add a texture to that with the same name as your VMT material.
  • Cyberogue
    Options
    Offline / Send Message
    Well, the object already has a material applied named pipe_final (same as pipe_final.vmt)

    pipemat.png

    VMT
    "VertexLitGeneric"
    {
    "$basetexture" "models\weapons\pipe_final\pipe_final"
    "$translucent" 1
    "$surfaceprop" "metal"
    "$envmap" "env_cubemap"
    "$envmapmask" "models\weapons\pipe_final\pipe_final_spec"
    "$envmapcontrast" .5
    "$model" 1
    }
    

    QC
    $modelname "custom\pipe_final\pipe_final.mdl"
    $cdmaterials "models\weapons\pipe_final"
    $body pipe_final "pipe_final.smd"
    $scale 1
    $sequence idle "pipe_final.smd"
    $collisionmodel "pipe_final.smd"
    {
    	$mass 1.0
    	$concave
    }
    

    Is that what you mean?
  • Cyberogue
    Options
    Offline / Send Message
    -ignore this post, nvm-
  • Mark Dygert
    Options
    Offline / Send Message
    The material name in max doesn't matter. The actual name of the map in the diffuse slot needs to be the same as the VMT.
  • Cyberogue
    Options
    Offline / Send Message
    It -was- the VTF linked to in the VMT (VTF plugin for 3ds max)...

    Anyways, I got the texture working somehow, but is there any way to fix this problem? I'm referring to the visible ring near the top

    translucent.png

    I tried using $alphatest, but the whole thing becomes opaque. Also, is there any way to make the ice translucent (not pure transparent) where it's seen over the pipe? It seems to be translucent at the edges, but transparent on the pipe (The alpha map grey isn't that dark, it's maybe about 75% white)
  • Zipfinator
    Options
    Offline / Send Message
    Zipfinator polycounter lvl 9
    All of those problems are because you're using $translucent. They're alpha sorting problems. You said you tried $alphatest so the next thing I would try is using a second vmt for just the ice part. Apply a separate material to it in Max and name your second VMT that and have that vmt have the $translucent in it while the rest of the pipe uses the original .vmt without the $translucent.
  • Cyberogue
    Options
    Offline / Send Message
    Aha, I tried that and it worked, thank you!
Sign In or Register to comment.