Results 1 to 4 of 4

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

  1. #1
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts

    [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

    earthworm_jim_player_model_508845623.zip

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

    Click image for larger version. 

Name:	decomp.png 
Views:	187 
Size:	282.1 KB 
ID:	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:

    Click image for larger version. 

Name:	import.png 
Views:	182 
Size:	74.4 KB 
ID:	968

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

    Click image for larger version. 

Name:	import_qc.png 
Views:	172 
Size:	9.3 KB 
ID:	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:

    Click image for larger version. 

Name:	skel_del.png 
Views:	198 
Size:	164.0 KB 
ID:	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:

    Click image for larger version. 

Name:	append.png 
Views:	177 
Size:	46.8 KB 
ID:	970

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

    Click image for larger version. 

Name:	append2.png 
Views:	177 
Size:	9.6 KB 
ID:	971

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

    Click image for larger version. 

Name:	big.png 
Views:	199 
Size:	58.2 KB 
ID:	975

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

    Click image for larger version. 

Name:	scale.png 
Views:	186 
Size:	67.7 KB 
ID:	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:

    Click image for larger version. 

Name:	modifier.png 
Views:	189 
Size:	123.8 KB 
ID:	980

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

    Click image for larger version. 

Name:	arm_sel.png 
Views:	184 
Size:	56.9 KB 
ID:	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:

    Click image for larger version. 

Name:	arm_sel_comp.png 
Views:	183 
Size:	173.6 KB 
ID:	973

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

    Click image for larger version. 

Name:	pivot.png 
Views:	177 
Size:	31.1 KB 
ID:	981

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

    Click image for larger version. 

Name:	rotate.png 
Views:	188 
Size:	97.9 KB 
ID:	982

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

    Click image for larger version. 

Name:	rotate_done.png 
Views:	194 
Size:	107.1 KB 
ID:	983

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

    Click image for larger version. 

Name:	arms_done.png 
Views:	193 
Size:	126.7 KB 
ID:	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:

    Click image for larger version. 

Name:	ver1.png 
Views:	180 
Size:	34.1 KB 
ID:	989 -> Click image for larger version. 

Name:	ver2.png 
Views:	187 
Size:	26.1 KB 
ID:	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:

    Click image for larger version. 

Name:	groups_final.png 
Views:	179 
Size:	28.6 KB 
ID:	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:

    Click image for larger version. 

Name:	materials.png 
Views:	186 
Size:	24.8 KB 
ID:	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):

    Click image for larger version. 

Name:	tex_1.png 
Views:	185 
Size:	194.9 KB 
ID:	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):

    Click image for larger version. 

Name:	tex_export.png 
Views:	172 
Size:	392.3 KB 
ID:	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:

    Click image for larger version. 

Name:	txt.png 
Views:	186 
Size:	149.0 KB 
ID:	988

    Then model (As Multiplayer Body):

    Click image for larger version. 

Name:	mdl.png 
Views:	183 
Size:	110.5 KB 
ID:	979

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

    Click image for larger version. 

Name:	shot0001.jpg 
Views:	219 
Size:	843.4 KB 
ID:	991

    Ugh, i hope i was clear enough with that tutorial, the way is not easiest on a planet but at least its possible.
    Last edited by voron00; 17th October 2015 at 20:40.

  2. The Following 9 Users Say Thank You to voron00 For This Useful Post:

    filthy_freak_ (17th October 2015),hoek (18th October 2015),kung foo man (17th October 2015),Paho (30th January 2016),php (17th October 2015),serthy (18th October 2015),thOuMta (29th February 2016),Whiskas (10th January 2017),ysniper (28th March 2016)

  3. #2
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    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.

  4. #3
    ... connecting
    Join Date
    Jan 2017
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Tried to compile my model.

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

    No idea, think im missing 3d model knowledge.

  5. #4
    Private
    Join Date
    Nov 2018
    Posts
    24
    Thanks
    1
    Thanked 8 Times in 7 Posts
    very cool but there's no armature just for handmodel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •