LOVED THIS TUTORIAL! good job but can we export the model and place it into game without any textures?
I get an error where it says:
************ ERROR ************
bad command $cdmaterials
What is that? How do i fix it?
I got my .smd file (exported from lightwave) and I put it into the Phase 2 folder on my desktop. I then created a .qc file, brought it into GUIStudio, selected the .qc, and it created a .mdl file in the hl2/models/models/phase 2 folder. The problem is, when I went into Source SDK's Model Viewer, I selected the .mdl file and go the error:
"Error loading model: The model has no vertices"
Any idea on how to fix it?
[QUOTE=Boogaman;13295856]I got my .smd file (exported from lightwave) and I put it into the Phase 2 folder on my desktop. I then created a .qc file, brought it into GUIStudio, selected the .qc, and it created a .mdl file in the hl2/models/models/phase 2 folder. The problem is, when I went into Source SDK's Model Viewer, I selected the .mdl file and go the error:
"Error loading model: The model has no vertices"
Any idea on how to fix it?[/QUOTE]
Did you apply a texture on it?
I did not have any texture files no. When I was in the GUI editor, I checked its default texture box. Is that a problem? Do I need .vtf files (I believe thats is what they're called) for each model?
You just need to apply a texture to the model.
Alright, thanks jaanus!
Been trying how to figure out this for a while now and that worked.
Ah this is a lifesaver, my mod team keep asking me how to compile models, I can just link them to this :D
Love you Jaaaannnnuussss
What the f. is a mod team that doesn't know how to compile
The qc in the tut is missing a $body or $model command... Probably kind of important.
I dunno why, but it works without it.
Good tutorial man, very useful to a lot of people I'm sure!
Hi, is there a way to reverse the procedure ? I mean, get the SMD file from the MDL file ?
[QUOTE=Edenkov;14496088]Hi, is there a way to reverse the procedure ? I mean, get the SMD file from the MDL file ?[/QUOTE]
Google "Cannonfodder's MDL decompiler"
Thanks I know this tools, but to use it we need half life and steam installed on the PC. The thing is, I don't have those game.
Do you know a sort of stand alone tools who does the same thing ?
Would this work for Vampire Bloodlines models?
[QUOTE=Edenkov;14692262]Thanks I know this tools, but to use it we need half life and steam installed on the PC. The thing is, I don't have those game.
Do you know a sort of stand alone tools who does the same thing ?[/QUOTE]
You need Source SDK.
[QUOTE=cardjoe;15045524]Would this work for Vampire Bloodlines models?[/QUOTE]
Uh, not sure. They shouldn't.
Great tutorial!
But I get an error with the GUIStudioMDL
I locate garrysmod\garrysmod\gameinfo.txt
Complile the QC
writing C:\Program Files\Steam\steamapps\ii_jazzy_ii\garrysmod\garrysmod\models/Jazzy\jazzy.vvd:
vertices 1634688 bytes (34056 vertices)
tangents 544896 bytes (34056 vertices)
total 2179648 bytes
---------------------
Generating optimized mesh "C:\Program Files\Steam\steamapps\ii_jazzy_ii\garrysmod\garrysmod\models/Jazzy\jazzy.sw.vtx":
ERROR: short conversion out of range 34056
ERROR: Aborted Processing on 'Jazzy\jazzy.mdl'
Please help! :D
EDIT:
Here is my QC:
$modelname "Jazzy\jazzy.mdl"
$cdmaterials "Jazzy\"
$scale 1
$surfaceprop "wood"
$body studio "jazzy_ref.smd"
$sequence idle "jazzy_idle.smd" fps 1
$collisionmodel "jazzy_phys.smd" {
$mass 100.0
$inertia 1.00
$damping 0.00
$rotdamping 0.00
}
[QUOTE=JG_Jazzy;16284565]Great tutorial!
But I get an error with the GUIStudioMDL
I locate garrysmod\garrysmod\gameinfo.txt
Complile the QC
writing C:\Program Files\Steam\steamapps\ii_jazzy_ii\garrysmod\garrysmod\models/Jazzy\jazzy.vvd:
vertices 1634688 bytes (34056 vertices)
tangents 544896 bytes (34056 vertices)
total 2179648 bytes
---------------------
Generating optimized mesh "C:\Program Files\Steam\steamapps\ii_jazzy_ii\garrysmod\garrysmod\models/Jazzy\jazzy.sw.vtx":
ERROR: short conversion out of range 34056
ERROR: Aborted Processing on 'Jazzy\jazzy.mdl'
Please help! :D
EDIT:
Here is my QC:
$modelname "Jazzy\jazzy.mdl"
$cdmaterials "Jazzy\"
$scale 1
$surfaceprop "wood"
$body studio "jazzy_ref.smd"
$sequence idle "jazzy_idle.smd" fps 1
$collisionmodel "jazzy_phys.smd" {
$mass 100.0
$inertia 1.00
$damping 0.00
$rotdamping 0.00
}[/QUOTE]
You have too many vertices. Cut'em down or weld some polygons together and the error should go away. [URL]http://developer.valvesoftware.com/wiki/Short_conversion_out_of_range[/URL]
Thanks man, I'll give it a try :P
[editline]06:16PM[/editline]
That seems to have worked :D
What I'd done, is created my server's logo in 3D text, and exprted it.
I seperated each letter and exported them indervidually.
Thanks
I've run the qc file and I get an error stating it can't load the anim smd. I've used Milkshape 3D to port a model and i'm not sure if I ported the idle animation correctly, as mariokart64n's tutorial says (for 3Dmax) to export it as "Skeletal Animation", but the Milkshape smd exporter doesn't have this option.
Edit: Tried it in GUIStudioMDL and got this:
[code]Loaded QC file - "x:\*****\Valve\Garry's Mod\Development\Model Processing\MDLs and SMDs\Bender\BenderCompileV2.qc"
Created command line: x:\Steam\steamapps\*****\sourcesdk\bin\ep1\bin\studiomdl.exe -game "x:\steam\steamapps\*****\half-life 2\hl2" -notxbox "x:\*****\Valve\Garry's Mod\Development\Model Processing\MDLs and SMDs\Bender\BenderCompileV2.qc"
qdir: "x:\*****\valve\garry's mod\development\model processing\mdls and smds\bender\"
gamedir: "x:\steam\steamapps\*****\half-life 2\hl2\"
g_path: "BenderCompileV2"
Working on "BenderCompileV2.qc"
SMD MODEL BenderRagdoll.smd
SMD MODEL BenderPhys.smd
Collision model completed.
---------------------
writing x:\steam\steamapps\*****\half-life 2\hl2\models/bender\bender.mdl:
bones 420 bytes (0)
animations 104 bytes (1 anims) (1794 frames) [29:54]
sequences 216 bytes (1 seq)
ik/pose 0 bytes
textures 4 bytes
keyvalues 0 bytes
collision 0 bytes
total 788
[/code]
But what I got out of it was a single .mdl which can't be opened (due to being just an mdl file). Also checked it with a hex editor and it had no materials path.
Oh and studiomdl just crashes, so I can't get it to work with any of the compilers I have :(
Guess it's a common problem not being able to compile stuff. Wish there was a less vague cause than SDK being an ass. I got the same problem myself, although it gets compiled, the textures are missing. I get the always awesome purple/black checkers instead.
garrysmod\materials\boxish\smallbox.vmt
garrysmod\materials\boxish\smallbox.vtf
garrysmod\models\boxish\... smallbox.vtx, smallbox.mdl, smallbox.phy, smallbox.vvd - they're all there.
garrysmod\models\boxish\ is also the directory I put the QC and SMD files in, and launched the gui compiler. No errors reported after compile.
The QC is:
[code]
$modelname boxish\smallbox.mdl
$cdmaterials boxish\
$body "smallbox" "smallbox.smd"
$model "smallbox" "smallbox.smd"
$scale 1
$surfaceprop "metal"
$staticprop
$sequence "idle" "smallbox_idle.smd" fps 1
$collisionmodel "smallbox_phys.smd" {
$mass 40.0
$concave
$inertia 1.00
$damping 0.00
$rotdamping 0.00
}
[/code]
You don't have any "" around your materials directory, might this be an issue (I don't know cause I make sure that there there). Otherwise check you materials path in a hex editor and it will likely say the texture it is looking for is called "smallbox" as i've been having this issue with the ports i've been doing. If this is so re-name your material file "smallbox" and it should work. Also check your spelling in the materials file because one misplaced letter can spell doom for the textures (parden the undeliberate pun :P) as that was what was off with one of my models earlier (CURSE YOU TINY FONTS).
Edit: Try this.
[code]$modelname "boxish\smallbox.mdl"
$body smallbox "smallbox.smd"
$cdmaterials "boxish\"
$scale 1
$surfaceprop "metal"
$sequence idle "smallbox_idle.smd" fps 1
$collisionmodel "smallbox_phys.smd" {
$mass 40.0
$inertia 1.00
$damping 0.00
$rotdamping 0.00
}
[/code]
Also you don't actually need separate smd's for the collision model and idle anim models as they work fine as the same as the actual model for static props (but I left them in the code incase there was a reason for it).
Just looked at your post again is there 2 .vtx called smallbox.dx90 and smallbox.dx80 ? as there should be and theres sometimes another two called (modelname).sw and (modelname).xbox.
Hey, thanks for the quick response. Quicker than expected! ^^
However, I tried to compile with and without the quotations, the end result was identical.
By material file, I assume you mean the texture (.vtf)? I've tried a variety of names, to no avail.
Anyway, I find this issue really strange. The other day I looked at a tutorial on Youtube, where the object was a basic cube. I followed it from start of modeling to having it in game, which worked FINE. No texture error or anything.
I did the very same thing now, obviously changing filenames and subfolder paths. This leads me to believe I could have screwed up somewhere in the texturing process, but I've done the UVW unwrap, compiled the vtf and vmt.
Now that I think about it, I should check out the VMT and see if I actually overlooked it! *shrug*
I'll update in a bit! :v:
[B]Edit: [/B]
Nope, the VMT was not the cause. I still see the black and purple. (I removed and did a recompile of everything).
smallbox.vmt now is:
[code]
"VertexlitGeneric"
{
"$basetexture" "boxish/smallbox"
}
[/code]
Before it was:
[code]
"VertexlitGeneric"
{
"$basetexture" "models/boxish/smallbox"
}
[/code]
So, maybe the part where I open VTFEdit and import the UWV image is where I do something wrong?
VTFEdit import options:
[img]http://img219.imageshack.us/img219/2343/vtfedit1.jpg[/img]
These settings are based off of the tutorial I followed.
I've got a similar problem, if not the exact same problem.
My model compiles fine but the texture doesn't show up, I suspect I compiled the model wrong seeing as it is my frist one.
.qc file:
[code]
$modelname "thunderball\ball.mdl"
$cdmaterials "thunderball\"
$body studio "ball.smd"
$surfaceprop "metal"
$sequence idle "ball.smd" fps 1
$scale 1
$collisionmodel "ball.smd" {
$mass 100.00
$inertia 1.00
$damping 0.00
$rotdamping 0.00
}
[/code]
here's my folder layout:
[IMG]http://i183.photobucket.com/albums/x271/mrTsuyoshi/Demos/wtfmodel.png[/IMG]
(don't mind the ball_normal.vtf)
also since I can't rule out the .vmt being wrong:
[code]
"VertexLitGeneric"
{
"$baseTexture" "models\thunderball\ball"
"$surfaceprop" metal
"$phong" "1"
"$phongexponent" "4"
"$phongboost" ".9"
"$lightwarptexture" "models/player/pyro/pyro_lightwarp"
"$phongfresnelranges" "[2 1 6]"
"$basemapalphaphongmask" "1"
"$rimlight" "1"
"$rimlightexponent" "2"
"$rimlightboost" ".2"
}
[/code]
Again, have you checked the materials path in a hex editor, usually if I do that its easy enough to figure out where its looking and that its not where you think. Also is smallbox.vtf and smallbox.vmt in the materials/boxish/smallbox folder as if its not thats whats wrong. If wou can't figure out what i'm saying you can send me the models if you wish and I can check em for you :)
Edit:
[QUOTE=Tsuyoshi;16711812] [IMG]http://i183.photobucket.com/albums/x271/mrTsuyoshi/Demos/wtfmodel.png[/IMG] [/quote]
You can open the VMT files in VTFEdit aswell and i'm sure it has some sort of checker, as it sometimes wont let you save it if you've made a drastic mistake.
Your paths however look right.
Edit2: found your problem:
"$baseTexture" "models\thunderball\ball"
should be:
"$baseTexture" "thunderball\ball"
from where you've put it and defined it. Also why have you got a normal texture but not used it?
I compiled a model and it works fine in game, but it seems like it's mass center is in the front or something. I made a cannon, it's a barrel, muzzle and the "mount" or gun base so to say. I'm using wiremods E2 to make it rotate etc, using applyforce, and it is set up to rotate the prop at its center. However, it is not rotating by the base as it should, but by the barrel/muzzle area!
Question: How do I define in the QC file where the center of the mass should be?
Edit: I ditched the whole box thing yesterday and started from scratch, so I made a gun/cannon model instead! Apparently I did something wrong along the way, because today I got it right! Unless I was just lucky and SDK was nice today :v:
[QUOTE=Silver Spirit;16715097]
from where you've put it and defined it. Also why have you got a normal texture but not used it?[/QUOTE]
I took it out because I thought it might have been the problem.
It turns out the file it was looking for was ball_texture1.vmt (I renamed it). It works now, thanks.
[QUOTE=Tsuyoshi;16718653]I took it out because I thought it might have been the problem.
It turns out the file it was looking for was ball_texture1.vmt (I renamed it). It works now, thanks.[/QUOTE]
np, glad it works now :D