Texture help.

I need help linking my model to my texture. :frowning:

I made a model of a coin in Blender, then made a UV Map for it. Rendered it in blender and it looked great!

I took exported from the SMD Tools on Blender 2.5 and saved the UV map.

Then I wrote a qc file. Here it is.



$modelname	"models/korbin_coin.mdl"
$body mybody	"korbin_coin.smd"
$staticprop
$surfaceprop	metal
$cdmaterials	"models/"

$sequence idle	"korbin_coin.smd" loop fps 15

$collisionmodel	"korbin_coin.smd" {
	$automass
	$concave
}

$keyvalues
{
   "prop_data"
   {
       "base"  "Metal.Small"
   }
}


I then imported and saved a VMT and VMF from the UV Map tga in the destination directory that the QC file was going to write my model to.

my vmt says this:



"LightmappedGeneric"
{
	"$basetexture" "Program Files/Steam/steamapps/adorablepuppy/garrysmod/garrysmod/models/models/korbin_coin"
}


I ran the QC file through studiomdl.exe with -game pointed at the garrysmod gameinfo.txt’s directory and -nop4.

I then went into garrysmod and spawned the coin through the browse menu. The coin spawned great. All the settings that I used in the qc seemed to work, but my texture is missing. Instead I have the purple and black checkerbox thing going on.

I can post pictures if it would help.

Also, please go easy on me, this is my first model for any game ever. It’s highly probable that I did something wrong. I did follow multiple sources, but it seems somewhat cryptic and I’ve gained a new admiration for people who make complex and moving props.

First thing
Change lightmapped generic to vertexlitgeneric

Second the correct paths should be relatively to the mod folder they are in.
So instead of the whole path you made it should be in

$cdmaterials “models\corbin_coin”

Now inside
steamapps/adorablepuppy/garrysmod/garrysmod
go into materials\models there make a folder called corbin_coin and place the VMT for the texture in there.
The basetexture should read

models\corbin_coin exturename

try to ignore that my \ and / are all over the place and instead just use one.

Ok. I did what you said.

It still isn’t being applied.

I copied the files over to half life 2 to view them in model viewer. It says it tried to load one or more VMTs it can’t find.

I thought that it may have been a misnamed vmt, so I checked my SMD and copied the VMT and renamed it to Material.001.vmt, since that’s what it says in the SMD. No joy there.

VMT now says



"VertexLitGeneric"
{
	"$basetexture" "models/korbin_coin/korbin_coin"
}


I have it stored in materials/models/korbin_coin/, named 3 different things. (korbin_coin.vmt, mybody.vmt, Marterial.001.vmt)

The VTF is in there as well called korbin_coin.vtf.

The QC I revised now says:



$modelname	"korbin_coin.mdl"
$body mybody	"korbin_coin.smd"
$staticprop
$surfaceprop	metal
$cdmaterials	"models/korbin_coin/"

$sequence idle	"korbin_coin.smd" loop fps 15

$collisionmodel	"korbin_coin.smd" {
	$automass
	$concave
}

$keyvalues
{
   "prop_data"
   {
       "base"  "Metal.Small"
   }
}


When I build with the qc file, the generated files are placed directly into the models folder now.

So the layout I currently have is:
models/korbin_coin.dx80.vtx
models/korbin_coin.dx90.vtx
models/korbin_coin.mdl
models/korbin_coin.phy
models/korbin_coin.sw.vtx
models/korbin_coin.vvd

and

materials/models/korbin_coin/korbin_coin.vmt
materials/models/korbin_coin/Material.001.vmt
materials/models/korbin_coin/mybody.vmt
materials/models/korbin_coin/korbin_coin.vtf

What could I be doing wrong?

EDIT: If anyone wants to look at my files as they were stored on my system, here they are korbin_coin.zip. If you do download it, feel free to use the coin model as you see fit.

open up the smd’s and see if the triangles have materials set to the proper ***.tga

There is no tga anywhere in the smd text. The triangles all say “Material.001”

Yeah it strips out everything after the dot. The VMT should be called Material.vmt

if you open the mdl in a hex editor, near the bottom of the file you can see all the textures it uses.

Thanks! That’s done it! Here is the resulting coin.

The coin is around the size of a real 50 piece would be. That said, it’s really tiny in Garrys Mod.

I do have a question though. It seems my coins are maybe seems a bit heavy? Is there a way to change that?
Other than that, it seems great!

Edit: In case anyone wants an update on this. I finished my models. Values from left to right 1,2,5,10,20,50,100,1000.

http://s3.amazonaws.com/twitpic/photos/large/222818237.png?AWSAccessKeyId=0ZRYP5X5F6FSMBCCSE82&Expires=1294630952&Signature=ksh%2FWiNY%2Bjdq%2BVGMbE5wx5aqn5w%3D