DigitalEro Offline

How to add new materials and skins to a model?

Mon, 24 Jun 2013 17:12:00

Bilge Rat 16

Basically I'd like to do a couple of things: 1) Recolor a model while still keeping the old textures available. As of now I'm switching between new and old textures by renaming them or editing the texture path, but it's inconvenient and sooner or later I might need to use both at the same time, which is impossible with this metod. 2) Add a "dry" skin effect to a model that has only a wet/sweaty skin effect. Would that be possible without using a modeling program?
Mon, 24 Jun 2013 17:21:47

Ganonmaster

"Bilge Rat 16" said ...
Would that be possible without using a modeling program?
Yes, but you'd have to add a new texture group and recompile the model.
Tue, 25 Jun 2013 18:18:37

Bilge Rat 16

Thanks, but how do I make a QC file? Do I need to decompile the model?
Tue, 25 Jun 2013 19:01:19

Ganonmaster

"Bilge Rat 16" said ...
Thanks, but how do I make a QC file? Do I need to decompile the model?
Yes, ofcourse.
Wed, 26 Jun 2013 18:43:26

Bilge Rat 16

Okay, this is more difficult than I thought. The decompiling and editing part is done. Now I can't figure out how to configure GUIstudiomdl for the life of me. It needs gameinfo.txt in two SDK folders, which aren't there. Any help please? I went through a ton of tutorials, but a lot of them had conflicting and/or outdated info.
Wed, 26 Jun 2013 19:46:35

Ganonmaster

If you're compiling for SFM, just drop your qc file on studiomdl.bat.
Wed, 26 Jun 2013 21:06:42

Bilge Rat 16

The .bat file didn't work; the exe did, however upon loading SFM a big red ERROR was in place of the model. Thought I made some syntax errors while editing the files. So I decompiled and recompiled another model without making any other changes. No error this time, but the model was completely invisible. Idk what went wrong, but I noticed the new .MDL was slightly over 2kb, while the original was 26kb. Seems like a lot of data was deleted in the process.
Thu, 27 Jun 2013 06:26:20

Vitezislav

The qc file of the decompiled model cannot be used as it is, because it shows no bodygroups. You have to add bodygroups. An example of a tentacle model I decompiled. This qc file is what you get when decompiling, but if you use it the model turns out invisible in SFM.
$cd "D:\Decompiled\Tentacles\Grab"
$modelname "tentacle\tentacle_grapple.mdl"
$model "tentacle_m" "Grab_tentacle.smd"
$cdmaterials "models\tentacles\"
$hboxset "default"
$hbox 0 "Bone001" 0.000  -2.863  -2.973  11.855  2.180  2.695
$hbox 0 "Bone002" -0.591  -1.346  -1.706  11.059  1.193  1.410
$hbox 0 "Bone003" -0.002  -1.371  -1.464  5.707  1.100  1.369
$hbox 0 "Bone004" -0.061  -1.373  -1.464  5.653  1.099  1.369
$hbox 0 "Bone005" 0.000  -1.399  -1.492  5.924  1.049  1.340
$hbox 0 "Bone006" -0.082  -1.409  -1.492  5.773  1.224  1.340
$hbox 0 "Bone007" -0.126  -1.118  -1.468  5.917  1.365  1.467
$hbox 0 "Bone008" -0.398  -1.026  -1.363  5.656  1.476  1.468
$hbox 0 "Bone009" -0.137  -1.114  -1.223  5.927  1.393  1.785
$hbox 0 "Bone010" -0.020  -1.221  -1.046  6.006  1.304  1.785
$hbox 0 "Bone011" 0.000  -1.445  -1.006  6.180  1.261  1.812
$hbox 0 "Bone012" -0.129  -1.464  -0.966  5.851  1.115  1.859
$hbox 0 "Bone013" 0.000  -1.478  -0.804  6.770  1.107  1.985
$hbox 0 "Bone014" 0.000  -1.754  -1.104  6.241  1.233  2.206
$hbox 0 "Bone015" -0.074  -2.115  -1.869  5.714  1.813  2.614
$hbox 0 "Grappler.r.01" -0.560  -0.427  -1.015  3.338  0.998  1.391
$hbox 0 "Grappler.r.02" -0.152  -0.653  -1.755  5.515  1.068  1.775
$hbox 0 "Grappler.r.03" 0.000  -1.094  -2.049  5.558  0.830  1.862
$hbox 0 "Grappler.l.01" 0.000  -0.860  -1.148  4.011  0.491  1.423
$hbox 0 "Grappler.l.02" 0.000  -0.609  -1.729  5.733  1.103  2.119
$hbox 0 "Grappler.l.03" -0.481  -0.595  -1.810  4.650  1.434  2.042
// Model uses material "tentacle_body.vmt"
$surfaceprop "flesh"
$eyeposition 0.000 0.000 70.000
$illumposition -0.000 0.598 34.375
$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
$collisionjoints "phymodel.smd" {

	$mass 10.0
	$inertia 10.00
	$damping 0.20
	$rotdamping 4.50
	$rootbone "bone001"

	$jointconstrain "bone002" x limit -40.00 40.00 0.00
	$jointconstrain "bone002" y limit -40.00 40.00 0.00
	$jointconstrain "bone002" z limit -40.00 40.00 0.00

	$jointconstrain "bone003" x limit -40.00 40.00 0.00
	$jointconstrain "bone003" y limit -40.00 40.00 0.00
	$jointconstrain "bone003" z limit -40.00 40.00 0.00

	$jointconstrain "bone004" x limit -40.00 40.00 0.00
	$jointconstrain "bone004" y limit -40.00 40.00 0.00
	$jointconstrain "bone004" z limit -40.00 40.00 0.00

	$jointconstrain "bone005" x limit -40.00 40.00 0.00
	$jointconstrain "bone005" y limit -40.00 40.00 0.00
	$jointconstrain "bone005" z limit -40.00 40.00 0.00

	$jointconstrain "bone006" x limit -40.00 40.00 0.00
	$jointconstrain "bone006" y limit -40.00 40.00 0.00
	$jointconstrain "bone006" z limit -40.00 40.00 0.00

	$jointconstrain "bone007" x limit -40.00 40.00 0.00
	$jointconstrain "bone007" y limit -40.00 40.00 0.00
	$jointconstrain "bone007" z limit -40.00 40.00 0.00

	$jointconstrain "bone008" x limit -40.00 40.00 0.00
	$jointconstrain "bone008" y limit -40.00 40.00 0.00
	$jointconstrain "bone008" z limit -40.00 40.00 0.00

	$jointconstrain "bone009" x limit -40.00 40.00 0.00
	$jointconstrain "bone009" y limit -40.00 40.00 0.00
	$jointconstrain "bone009" z limit -40.00 40.00 0.00

	$jointconstrain "bone010" x limit -40.00 40.00 0.00
	$jointconstrain "bone010" y limit -40.00 40.00 0.00
	$jointconstrain "bone010" z limit -40.00 40.00 0.00

	$jointconstrain "bone011" x limit -40.00 40.00 0.00
	$jointconstrain "bone011" y limit -40.00 40.00 0.00
	$jointconstrain "bone011" z limit -40.00 40.00 0.00

	$jointconstrain "bone012" x limit -40.00 40.00 0.00
	$jointconstrain "bone012" y limit -40.00 40.00 0.00
	$jointconstrain "bone012" z limit -40.00 40.00 0.00

	$jointconstrain "bone013" x limit -40.00 40.00 0.00
	$jointconstrain "bone013" y limit -40.00 40.00 0.00
	$jointconstrain "bone013" z limit -40.00 40.00 0.00

	$jointconstrain "bone014" x limit -40.00 40.00 0.00
	$jointconstrain "bone014" y limit -40.00 40.00 0.00
	$jointconstrain "bone014" z limit -40.00 40.00 0.00

	$jointconstrain "bone015" x limit -40.00 40.00 0.00
	$jointconstrain "bone015" y limit -40.00 40.00 0.00
	$jointconstrain "bone015" z limit -40.00 40.00 0.00
}
I had to add a bodygroup in order to make it work.
$cd "D:\Decompiled\Tentacles"
$modelname "tentacle\TentacleGrapple.mdl"
$model "tentacle_m" "Tentacle.smd"
$cdmaterials "models\tentacles\"
$hboxset "default"
$hbox 0 "Bone001" 0.000  -0.565  -0.969  6.278  1.112  0.969
$hbox 0 "Bone002" -0.497  -0.887  -1.076  11.566  1.001  1.077
$hbox 0 "Bone003" -0.487  -0.821  -1.077  5.558  1.082  1.076
$hbox 0 "Bone004" -0.295  -0.811  -1.077  5.834  1.128  1.076
$hbox 0 "Bone005" -0.374  -1.110  -1.077  5.513  1.023  1.076
$hbox 0 "Bone006" -0.142  -1.168  -1.077  5.917  0.745  1.076
$hbox 0 "Bone007" -0.269  -1.136  -1.077  5.703  0.755  1.076
$hbox 0 "Bone008" -0.118  -1.012  -1.077  5.987  0.919  1.077
$hbox 0 "Bone009" -0.271  -1.308  -1.260  5.719  0.894  1.260
$hbox 0 "Bone010" -0.252  -1.389  -1.550  2.833  1.297  1.550
$hbox 0 "Mouth" 0.000  -0.890  -1.705  2.820  2.065  1.705

$bodygroup Tentacle
{
	studio "Grab_tentacle.smd"
}

// Model uses material "tentacle_body.vmt"
$surfaceprop "flesh"
$eyeposition 0.000 0.000 70.000
$illumposition -0.000 0.598 34.375
$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
$collisionjoints "phymodel.smd" {

	$mass 10.0
	$inertia 10.00
	$damping 0.20
	$rotdamping 4.50
	$rootbone "bone001"

	$jointconstrain "bone002" x limit -40.00 40.00 0.00
	$jointconstrain "bone002" y limit -40.00 40.00 0.00
	$jointconstrain "bone002" z limit -40.00 40.00 0.00

	$jointconstrain "bone003" x limit -40.00 40.00 0.00
	$jointconstrain "bone003" y limit -40.00 40.00 0.00
	$jointconstrain "bone003" z limit -40.00 40.00 0.00

	$jointconstrain "bone004" x limit -40.00 40.00 0.00
	$jointconstrain "bone004" y limit -40.00 40.00 0.00
	$jointconstrain "bone004" z limit -40.00 40.00 0.00

	$jointconstrain "bone005" x limit -40.00 40.00 0.00
	$jointconstrain "bone005" y limit -40.00 40.00 0.00
	$jointconstrain "bone005" z limit -40.00 40.00 0.00

	$jointconstrain "bone006" x limit -40.00 40.00 0.00
	$jointconstrain "bone006" y limit -40.00 40.00 0.00
	$jointconstrain "bone006" z limit -40.00 40.00 0.00

	$jointconstrain "bone007" x limit -40.00 40.00 0.00
	$jointconstrain "bone007" y limit -40.00 40.00 0.00
	$jointconstrain "bone007" z limit -40.00 40.00 0.00

	$jointconstrain "bone008" x limit -40.00 40.00 0.00
	$jointconstrain "bone008" y limit -40.00 40.00 0.00
	$jointconstrain "bone008" z limit -40.00 40.00 0.00

	$jointconstrain "bone009" x limit -40.00 40.00 0.00
	$jointconstrain "bone009" y limit -40.00 40.00 0.00
	$jointconstrain "bone009" z limit -40.00 40.00 0.00

	$jointconstrain "bone010" x limit -40.00 40.00 0.00
	$jointconstrain "bone010" y limit -40.00 40.00 0.00
	$jointconstrain "bone010" z limit -40.00 40.00 0.00

	$jointconstrain "mouth" x limit 0.00 0.00 0.00
	$jointconstrain "mouth" y limit 0.00 0.00 0.00
	$jointconstrain "mouth" z limit 0.00 0.00 0.00
}
Thu, 27 Jun 2013 06:56:26

Selph80

"Bilge Rat 16" said ...
The .bat file didn't work; the exe did, however upon loading SFM a big red ERROR was in place of the model. Thought I made some syntax errors while editing the files. So I decompiled and recompiled another model without making any other changes. No error this time, but the model was completely invisible. Idk what went wrong, but I noticed the new .MDL was slightly over 2kb, while the original was 26kb. Seems like a lot of data was deleted in the process.
Decompiling isn't a foolproof process. It regularly breaks the ragdoll or face-posing and if your model has bodygroups, it'll load all those models at once instead of allowing you to select them (for that you'll have to set up the bodygroups again manually in the qc file). Your problem however sounds like one that concerns the ragdoll. This would mean that the data for the model is there, it's just that the pose it takes is impossible and therefore it doesn't show up in SFM. A quick check to see if this is the problem is to change this:
$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
to
$sequence ragdoll "[name of the smd file of the model]" ACT_DIERAGDOLL 1 fps 30.00
That way, instead of loading the pose from the ragdoll.smd file, it loads the one from the original model file.