PDA

View Full Version : [CoD2] How to export (pretty much) any playermodel from Source Engine to CoD



voron00
17th October 2015, 19:15
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 (https://www.blender.org/) This is where we going to to most of our work.
1.1) Blender CoD Addon (https://github.com/CoDEmanX/blender-cod) To export our models to CoD as .xmodel (Read readme inside repo on how to install )
1.2) Valve's Blender Source Tools (https://developer.valvesoftware.com/wiki/Blender_Source_Tools) To import source engine scene's and models into blender.

2) Gimp (http://www.gimp.org/) To edit and export/import textures for our models.
2.1) Gimp .dds Plugun (https://code.google.com/p/gimp-dds/) To export color maps as .dds
2.2) Gimp .vtf Plugin (https://code.google.com/p/gimp-vtf/) 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 (http://steamcommunity.com/groups/CrowbarTool) 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 (http://steamcommunity.com/sharedfiles/filedetails/?id=508845623) model from Garry's mod Steam Workshop

966

Now we need to use Crowbar tool to decompile this model: Just open Crowbar then navigate to the .mdl file and press Decompile:

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:

968

Now, navigate to your decompiled reference .qc file and import it:

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:

985

Okay, now let's import a skeleton from CoD2:

Download my CoD2 Skeleton blender project file (https://www.dropbox.com/s/v9xnyeyouuh0t9d/cod2_armature_mp_v2.blend?dl=0)

Go to Blender again and go to File -> Append:

970

Now navigate to my CoD2 armature project file and then select Object -> Armature:

971

Nice, but as you can see the mesh is slightly bigger than a CoD2 skeleton:

975

Have no fear, select model by pressing mouse 2 and then press 'S' and move your mouse down to scale it:

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:

980

Now go to the Vertex Groups tab and find vertex groups related to his left/right arm:

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:

973

Good, good, now after you selected the whole arm, press the Pivot Center button and choose 3D Cursor

981

Now place the cursor above Jim's arm and Press 'R' to go to rotate mode and rotate the arm:

982

Try carefully rotate it so it would match the skeleton, if arm is too big/small feel free to scale it:

983

Remeber, it doesnt have to be a 100% match, but try doing as close as possible, now do the same for another arm:

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:

989 -> 990

You can also look at this Perl script i made (http://pastebin.com/yQV0EHSY) 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:

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:

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):

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):

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:

988

Then model (As Multiplayer Body):

979

And that's all! This is how it will look in the game:

991 :)

Ugh, i hope i was clear enough with that tutorial, the way is not easiest on a planet but at least its possible.

filthy_freak_
17th October 2015, 21:31
Well now, since we got this & a source map converter, it opens the door for people to make a CSS/TF2 remake/mod.

Nice work.

L3uX
10th January 2017, 18:56
Tried to compile my model.

bone 'j_mainroot' for bone controller 'pelvis' not found.

No idea, think im missing 3d model knowledge.

Prawy
31st January 2024, 08:47
very cool but there's no armature just for handmodel