Garry's Mod

Garry's Mod

144 ratings
How to port your own models to Garry's mod (2023)
By !! DarkShoro (Sachi)/(Light)
Discover today how to make playermodel into Garry's Mod !
6
2
   
Award
Favorite
Favorited
Unfavorite
Tools you will need
Some required (and optional) tools you will need to follow this guide

Garry's mod is always a requirement
Setting up Blender
This guide will assume that you are using Blender for the first time, if your plugins are already setup and you've followed this guide in the past you can skip this segment

The Blender version used in this guide is 3.2.2 but should work up back to 2.9
for older version, this guide might/will not work

The first thing you will see upon opening Blender is this :


For the script to work, you have to set your language to English

Once you've finished, head hover to the Edit category and go to Preferences then the addon section, this is where we are gonna import the Blender Source Tools addon, press the "Install" button and search for the Blender Source Tools zip archive (DO NOT UMCOMPRESS IT)

When you import it, make sure to tick the checkbox to enable the addon as well

You can do the same thing as BST for CATS


Now that Blender Source Tools is imported, you will see three section pops up into your "Scene" category on the right-bottom panel, this is good sign that the addon was read, installed and enabled
for CATS, press N, a list of category will appear on the right of the 3D view, the last one should have the addon's name, press N again to hide the panel
Basic things and importing the model
You might notice that you can't use your keyboard to move in the 3D view, for moving the camera rotating it, you will only need your mouse and 2 keyboard keys

  • Middle-Click : Rotate the camera
  • CTRL + Middle-Click : Pan the camera
  • SHIFT + Middle-Click : Move the camera
  • Scrolling : Zoom

With that in mind, let's continue, you first need to delete the default cube by clicking on it and hiting DELETE on your keyboard, your scene will be left with only a light source and the camera, they're not useful in this guide and wont be used.

You first need to know the format of your model, blender in the current state we setted up can only open FBX, OBJ, gltf, SMD and DMX (the last two are Source related), you also need to make sure your model contain an armature which allow individual parts to be moved on it's own.

As an exemple, I will use a model that I already made but will port once again while writing this guide
Credit to Nukude for making the model

Import your file using the File category, move to import and select your model format (FBX here)


Once you've imported the model, it will look tiny, it's because the camera is far away from the model, use the controls listed above to approach the model.

Make sure your model is plantigrade (The leg only have 2 bone, not counting the foot and toes) and is rigged as such, if not, stop right here, you can't follow this guide. To check, hide the body mesh and everything that might obstruct the armature from being seen

We can see that the leg is composed of two bones (minus the foot) which mean that our model is Plantigrade and can be used.

For VRChat users, if some part of your model used shader for clothing or facial expression, you will not be able to port them to Garry's Mod as gmod don't use unity shaders, you have been warned

Display once again the Body mesh, we will now proceed to rename every bone used in the armature to match a Garry's Mod playermodel with a list of pre-determined names that can be found here[wiki.facepunch.com]
Renaming the bones
This is one of the steps that might take some times, along with importing textures.

Basically, what you need to do is follow the upper-mentionned list and rename every bones

Things you need to know when renaming the bones
  • Make sure you are not in pose mode nor edit mode
  • The spine can't have more than 4 bones (Spine -> Spine4) [The majority of them only have two, which is fine]
  • I'm gonna mention it once again, but your model need to be plantigrade
  • Every bones should have the Pelvis (Hips) as their first parent (Meaning the Pelvis is the root bone and no bone should be beside the Pelvis, only under it)
  • Every bones that are not a part of the Valve Biped rig don't need renaming
  • You can't have more than 256 bones (128 on SMD)
  • If bones are missing and their not too important (Ex: the end of the fingers, toes or even a whole finger), they can be ignored
  • Bones order doesn't matter when they are at the same level in the hierarchy (Ex: arms and neck or finger)

How to rename

For this guide, I've written a simple python script for blender that should do the heavy work for you, so just download this file[drive.google.com].

Go to the script tab.


Then import the script.


The script text editor should now look like this:


You will now fill the script with each bone names on the left side of the list, do not edit the right side of the list.

If you models lacks some non-important bones like the toes and fingers, that's not a problem, just leave them empty, for exemple, the protogen don't have third fingers bones nor toes, so I left them empty.

You should have something that look like this:


Now, press the "RUN" button on the script editor, at the end, you should be left with something like this
If there was an error, check your list.
The model's size
As I stated before in this guide, your model is tiny, and garry's mod use bigger sized model, thus we need to modify our model's size

This is quite easy to do, first of all, hit F3 and type "Select All" then press enter, your entire model will now be selectionned, hit F3 again type "Apply scale" then hit enter

Your model size will now precisly be 1,1,1 (if it wasn't already)

Import this DMX file[drive.google.com] into your Blender, and match the size of the model with it, be sure that the eyes of the model are aligned with the top of the box

It should look like this

Delete the Model Size Exemple and the object named "Collection", we won't use it, you should only left the Armature (Camera and Light are useless)

Once again, hit F3 and type "Select All" but this time type "Apply all transforms", hit enter.
The model's face expressions and body flexes
For our conveniances, models creator have implemented things called "Blendshapes" into the model, if yours don't have any, you can skip this segment






To check if your model contains them, head over to the "Plane" category (represented by a little green triangle) and look at a thing called "Shape Keys"

Some of them contains underscore, some of them dont, but if you have runned my script, the underscores are already removed, if some of them are still present, remove them.
You can also remove the "vrc." prefix if your model come from or was made for VRC.



To preview them, check the little pin icon



Things you need to know with Blendshapes
  • You can't have more than 96 of them
  • MMD are pretty useless and can be removed with the little "minus" icon when selecting one
  • If you or the script missed an underscore, blender will warn you when exporting
Exporting the model
We are now finished with the model in Blender, we now need to export it for later

We can see on the export panel in the Scene category that my model have 70 blendshape.

  • Set the export path to the desired export location
  • Select "DMX" as export format
  • The engine path is not needed
  • The material path is not needed

Click export, then "Scene Export"

If the export throw this error :


set the Weight Link Cull Threshold to 0.20; if it still happen, increment it by 0.05 until it tell you this :


your model is now exported !
Applying Proportions
Your model is not quite finished yet!

For it to work properly, you need to apply a script that will create corrective animations for the model to not broke when in game

open the "proportion_trick_2.9.blend" file in the proportion_trick_script-main archive download earlier on Github

You will be presented with a 2d view (from which you can exit by pressing "5" on your numpad)

Import back your model with these precise settings :


If your model contains more than one DMX, (ex: body and hair) import the body first with these settings, select the body's armature and import the others DMXs with the settings "Validate against target" instead of "Make new Armature"

Once you have imported everything, rename your armature to "gg"


Hit the "play" button to start the script


If everything was done correctly, you shall see all the bone that you've named appear in green and the others vanish


You can see here that I missed a finger



If you've missed a bone name, it's not a big deal, hit CTRL+Z to exit the script and rename it once again to match



If everything you've renamed is here, we will now add those who weren't, to proceed, first select one of the grey bones, then shift click on the nearest bone (expect for the spine1&2, who should be linked to spine4 regardless of distance) then hit "F3" and search for "Copy constraints to selected bones" and hit enter

The grey bone will turn green and move to the bone you selected, proceed to do that for all grey bones.





Same for the spine1 & spine2, but copy constraints to spine4 (for both of them, zoom in if you can't see them clearly)



Once everything is green, hit F3 and type "Select All" then click it, do the same for "Apply pose as rest pose" and "Clear pose constraints"

On the top, click the book icon and select the second script, and play it


It should look like this after playing the second script (if it doesn't, read carefully, you might have missed something)


Export the scene again, do not forget to export in DMX, in a subdirectory of the last export directory (or somewhere different), you'll notice that we now have 3 files generated in a "anims" subfolder, they will be used for the compilation process

Compilation
Now is the time to make your dream a reality, you'll need to write down a file ending in ".QC" for compiling

Download this QC file[drive.google.com] and put it with the Body.dmx exported by the proportion script, then edit the qc file to match whatever you want

Also download this DMX[drive.google.com] file and put it with the rest, it will serve as a generic physics model for our model we won't make one today

Open the program Crowbar that we downloaded and set it up to point to your game



Drag & drop your edited .QC file into crowbar and it will take you to the "compile" section, be sure to select garry's mod and hit "compile"

if your crowbar start to spit out these errors, remove the corresponding shape keys in Blender
(Import your script-generated DMX in a new project and remove them, then export it again in the same folder)


When complete, Crowbar will notifiy you with this message, once it is done, press the "Use in View" button, then "View"


It will open the Half-Life Model Viewer (HLMV) and display your textureless model



If everything looks right, go to the "Sequence" section and replace the first "reference" by "idle_all_01", it shoud look like this :



If your model doesn't look weird and is in a visibly default position, that mean you made it !

You've successfully ported your model to Garry's Mod, you may now follow another guide to apply textures to it ^^
About BodyGroups
If your models happens to have multiples DMX files, it means the model is split up in multiple meshes.

There is two case
  • The mesh in intented to be toggle-able
  • It's a core part of the model

if the mesh is supposed to toggle-able, add thoses line into the downloaded QC up adove.

If you want them on by default
$bodygroup "<Name>" { studio "submodel.dmx" blank }

If you want them off by default
$bodygroup "<Name>" { blank studio "submodel.dmx" }

If the mesh is not supposed to be toggle-able, remove the blank statement and leave only the studio line.
$bodygroup "<Name>" { studio "importantmodel.dmx" }
End
That's it for now!
The guide will update soon to give more informations.

If I missed something, don't hesitate to let me know

Also, if you have any questions, feel free to leave a comment.
<TODO FOR LATER>
  • Add a section in the guide for model texturing
  • Add a section for c_arms
26 Comments
Pacagma 27 Oct @ 3:54am 
THANK YOU, my model ports always had this finger problems, with this guide it will improve my ports a lot!
YaoiFanatic87 11 Sep @ 11:00pm 
This is the best guide for this I have found. Thanks for the help.
Eboreg 5 Sep @ 7:14am 
I've been trying to import my .dmxs into the proportion trick .blend file but there's a hat that keeps coming in jammed through the head. Do you have any idea what's going on here?
christophevp09 23 Aug @ 6:25am 
After i compile my model, i for some reason cant press "use in viewer", nor "recompile" and "goto", can anyone tell me how to fix this?
⛨ Fixer 20 Jun @ 3:14am 
Nice. Got it all right but for some reason my face flexes are fine and work in blender but not in Gmod i wonder if i messed up anything haha, would be cool if you added a small qc editing part in the guide too.! thanks this is perfect
Soampbar 11 Jun @ 10:50pm 
Hello and thank you! I've credited you in a guide of my own for helping me figure out the .dmx format, where I previously used .smd. Very cool!
TheDogofSpace 21 Apr @ 7:19pm 
Scratch all that I said, I just probably missed a step.
V I P E R S N E K 29 Mar @ 8:49am 
hey, i did eventually find out what went wrong, turns out i missed a few verts, haha... and i was able to complete it with c_arms and everything
!! DarkShoro (Sachi)/(Light)  [author] 29 Mar @ 4:42am 
+V I P E R S N E K

Please refer to the last part of "Exporting the model", read carefully, don't skip lines and look at the images.
V I P E R S N E K 22 Mar @ 8:24pm 
hey, so i got to the compiling part, but now im stuck. i keep getting this error:

ERROR: Too many bone influences per vertex!
ERROR: Aborted Processing on 'username/modelname.mdl'
WARNING: Leaking 267 elements

please can someone for the love of god tell me how to fix this? google didnt help.