25 Attachment(s)
[CoD2] How to export (almost) any playermodel from Source Engine to CoD
Hi, title says it, im going to show you how to export playermodels from source engine to cod(2) (Multiplayer only!!). Its not really a direct export since it requers some work, but its not too diffucult and im going to show you what you need to do.
Fits of all we will need some tools and addons to them:
1) Blender This is where we going to to most of our work.
1.1) Blender CoD Addon To export our models to CoD as .xmodel (Read readme inside repo on how to install )
1.2) Valve's Blender Source Tools To import source engine scene's and models into blender.
2) Gimp To edit and export/import textures for our models.
2.1) Gimp .dds Plugun To export color maps as .dds
2.2) Gimp .vtf Plugin To import textures from Valve's .vtf texture format
Or you can use something else to manage the textures, but i'm going to use Gimp in this tutorial.
3) Crowbar .mdl Decompiler To decompile Valve's .mdl model files back to it's referense
Now, when we all set up, let's get to work:
Let's get a playermodel, i'm going to use this Earthworm Jim model from Garry's mod Steam Workshop
Attachment 966
Now we need to use Crowbar tool to decompile this model: Just open Crowbar then navigate to the .mdl file and press Decompile:
Attachment 976
Reference files will be placed in "Decompiled ($version_number)" folder
Now, we can proceed to a 'modelling'.
Open Blender, delete the annoying cube (also camera and lamp).
Now go to File-> Import-> Source Engine:
Attachment 968
Now, navigate to your decompiled reference .qc file and import it:
Attachment 969
Alright, you can see model now, but we still need to remove Source engine skeleton, select skeleton, go to Object mode and press Delete:
Attachment 985
Okay, now let's import a skeleton from CoD2:
Download my CoD2 Skeleton blender project file
Go to Blender again and go to File -> Append:
Attachment 970
Now navigate to my CoD2 armature project file and then select Object -> Armature:
Attachment 971
Nice, but as you can see the mesh is slightly bigger than a CoD2 skeleton:
Attachment 975
Have no fear, select model by pressing mouse 2 and then press 'S' and move your mouse down to scale it:
Attachment 984
There we go, much better, now as you can see his arms does not match the CoD2 skeleton, let's fix it
Go to the Edit Mode and then to the Modifier tab and assign Armature as a modifier:
Attachment 980
Now go to the Vertex Groups tab and find vertex groups related to his left/right arm:
Attachment 972
Now select all vertex groups related to his arm (Clavicle, Forearm, UpperArm, Hand and all fingers), if you messed up with selecting you can always diselect or diselect all by pressing 'A' twice:
Attachment 973
Good, good, now after you selected the whole arm, press the Pivot Center button and choose 3D Cursor
Attachment 981
Now place the cursor above Jim's arm and Press 'R' to go to rotate mode and rotate the arm:
Attachment 982
Try carefully rotate it so it would match the skeleton, if arm is too big/small feel free to scale it:
Attachment 983
Remeber, it doesnt have to be a 100% match, but try doing as close as possible, now do the same for another arm:
Attachment 974
Nice, but now comes the most annoying part, we have to rename every vertex group to its CoD2 reference, eeh.
Look at Armature bones and then to vertex groups, i hope this screenshots will help you understand which bone is which:
Attachment 989 -> Attachment 990
You can also look at this Perl script i made to rename bones automatically (to not redo this shit over and over again)
If you know how to run perl scripts, use it on a .smd file BEFORE importing it to Blender.
Now remove vertex groups that seems unnecesarry (in this case we got only 1 (ValveBiped.forward)) and now we need to create 3 more vertex groups: tag_origin, tag_weapon_left, tag_weapon_right
Tag origin must be the first, use arrows to move it and tag_weapons must come after j_whirst's:
Attachment 977
That's it we done with the model, go to File->Export and export it as CoD .xmodel_export to your model_export folder but do not close Blender just yet.
Now let's do the textures, go to Materials tab:
Attachment 978
Here you can see all materials this model are using.
Good, for Jim there only 2 materials, go to folder where your Source engine model was and go to Materials
Open .vtf file in Gimp (you may also assign this file extension to gimp):
Attachment 986
No need to change anything just go to File -> Export As, and choose .dds and press Export
Select compression (if you don't know what that is then just use DXT5):
Attachment 987
Now do the same for all the Materials you see in Blender.
And that's all, now all we have to do is convert everything using Asset Manager:
First - textures:
Attachment 988
Then model (As Multiplayer Body):
Attachment 979
And that's all! This is how it will look in the game:
Attachment 991 :)
Ugh, i hope i was clear enough with that tutorial, the way is not easiest on a planet but at least its possible.