Overriding TF2 content with custom one

nayðef

L1: Registered
Sep 13, 2017
16
1
Hello everyone
I have a problem overriding TF2 content with custom one. What I'm trying to to is to replace the default computer models in TF2 with custom one by packing them in the map using VIDE. The custom content is meant to be used as mod for TF2 client and it mimics TF2 folder structure. Ingame when I join the map everything works fine, but when join a map without overriden content, messages start to appear in the console about bad model integrity and vice versa. What to do? Probably rename the custom content folders and vmt files?
 

henke37

aa
Sep 23, 2011
2,075
515
What files exactly?
 

nayðef

L1: Registered
Sep 13, 2017
16
1
Models, materials. Basically, they already exist in the game, but want to override then
 

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
Why do you want to override them? Can't you just make custom models with an unused name and add those to your map? Why do you need to specifically override existing models?
 

nayðef

L1: Registered
Sep 13, 2017
16
1
Yea, can do that but not sure which files to modify and how in order to prevent black-purple texture.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,696
2,580
Are you using pre-made models that were designed to be client-side mods? Is that why they share filenames and paths with stock models?
 

nayðef

L1: Registered
Sep 13, 2017
16
1
Are you using pre-made models that were designed to be client-side mods? Is that why they share filenames and paths with stock models?
Yes. Actually I gave a link in the OP, but got unnoticed. The mod is client-side
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,696
2,580
It looks like these models ship with a buttload of modified materials and textures, so this is not going to be an easy task should you choose to undertake it. Step one is deciding where you want the custom materials to actually go and what they should be called. You're going to need to remember this.

Then you need to decompile all the props; Crowbar is your friend here. Crowbar will create two important files for each model: a QC file and an SMD file. Both are plaintext formats you can easily pull up in Notepad and mess with. The SMD is the raw model data—the coordinates of each vertex and what material to render on each face. So if you're renaming your materials, you can do a find-replace in this file. The QC contains all kinds of metadata like whether the prop is transparent, what type of stuff it's made of (metal/wood/glass/etc), and most importantly where the material files are located (the line labeled $cdmaterials). So if you're moving your materials to a new folder, you'll want to edit that line. Also, if these props have multiple skins, you'll find that under $TextureGroup—which lists the name of the default skin (as specified in the SMD) followed by the alternate skins. It's pretty straightforward once you know what to look for.

Finally, you'll have to recompile your models, also using Crowbar. Bear in mind that decompiling and recompiling has traditionally caused the prop to rotate counterclockwise 90 degrees. I don't remember if Crowbar is designed to compensate for this or not.
 

nayðef

L1: Registered
Sep 13, 2017
16
1
It looks like these models ship with a buttload of modified materials and textures, so this is not going to be an easy task should you choose to undertake it. Step one is deciding where you want the custom materials to actually go and what they should be called. You're going to need to remember this.

Then you need to decompile all the props; Crowbar is your friend here. Crowbar will create two important files for each model: a QC file and an SMD file. Both are plaintext formats you can easily pull up in Notepad and mess with. The SMD is the raw model data—the coordinates of each vertex and what material to render on each face. So if you're renaming your materials, you can do a find-replace in this file. The QC contains all kinds of metadata like whether the prop is transparent, what type of stuff it's made of (metal/wood/glass/etc), and most importantly where the material files are located (the line labeled $cdmaterials). So if you're moving your materials to a new folder, you'll want to edit that line. Also, if these props have multiple skins, you'll find that under $TextureGroup—which lists the name of the default skin (as specified in the SMD) followed by the alternate skins. It's pretty straightforward once you know what to look for.

Finally, you'll have to recompile your models, also using Crowbar. Bear in mind that decompiling and recompiling has traditionally caused the prop to rotate counterclockwise 90 degrees. I don't remember if Crowbar is designed to compensate for this or not.
Oh, didn't know it was so complex task. Anyway, thanks for help. I'm going to do all this conversion sometime in the future