Garry's Mod

Garry's Mod

41 avaliações
Beginner's Guide to Porting Props (Including Skingroups)
Por Dodylectable
This step-by-step guide will show you how to port an existing prop from a game/source with skingroups you like into Garry's Mod using Blender.

NOTE: There could be mistakes or incorrect ways of doing x thing or y thing, you can always freely point out the mistakes and their solutions in the comment section below, and if you have any questions, be sure to let me know in the comments
2
   
Premiar
Adic. a Favoritos
Nos Favoritos
Desfavoritar
Requirements and Prerequisites
To get working on porting props, you are going to need these requirements listed:
(While I might use different software, such as VTFEdit, pretty sure there is alternatives for it out there, you can get the job done [Whether it's VTFs/VMTs or Compiling the model] with different stuff as long as the don't stray off the main path with incorrect steps)

1. Blender (You can get it from Steam or the official site, I recommend Steam personally)
-https://steamproxy.net/steamstore/app/365670/Blender/
-https://www.blender.org/


2. Blender Source Tools (These tools/scripts are required for working with everything Source Engine related in Blender)
https://steamreview.org/BlenderSourceTools/


3. Crowbar (This tool is required and it's generally a great tool for when you want to work with Source Engine stuff)
https://steamproxy.net/groups/CrowbarTool (Get it from the GitHub release page linked in the group)


4. VTFEdit (This tool is required to for working with VTFs [Valve Texture Format] and VMTs [Valve Material Type] files, I linked the Developer Valve Software Site instead because it has many links to choose from)


5. Garry's Mod Prop Porting/Making Prerequisites (It's a RAR archive from my own Google Drive, which has all required files you need to compile your prop to be in-game)
https://drive.google.com/file/d/1mMWKZLn8mrNgo8cjsSSHuh4nkgsCJyCF/view?usp=sharing


6 and optional. Notepad++ (You don't need to install it really, but I recommend it, it's a great software to work with, and comes in handy when you are working with tons of VMTs, you can also make VMTs with it instead of VTFEdit)
https://notepad-plus-plus.org


One more thing to note before we head into the steps: Bare in mind there is a limit to vertices/polygons within the Source Engine, as I don't know what is the limit as I usually work with low poly old models, you might want to be careful, if your model fails to work you will need to reduce the polygons/vertices of it in Blender
First Step: Install Blender Software Tools into Blender
After you install the necessary software, you need to install Blender Source Tools, after you download the ZIP archive from the site, leave it as it is, don't extract it, What you're going to do next is:

1. Open Blender

2. Click Edit then Preferences


3. After the Preferences window pops up, Click on Add-ons section and then click Install above the Search bar


4. Afterwards a window will pop up, Go to your downloads folder (or wherever you downloaded the ZIP archive) and select the archive then click on Install Add-on


5. You will be sent back to the Preferences window, with the Blender Source Tools highlighted and indicated that they're installed, then just close the window and go back to Blender


(You can do this later but I'm listing it here because I like to prepare everything first):

6. Head to Scene Properties, Then set up your Export Path and Export File Format, Set the path to whatever you like but put the File Format to SMD (By default it's set to DMX, As for the Export Path, it will be red indicating there is no correct path set up, won't be red when you set up a correct path though)

Second Step: Get Your Prop Ready
You are going to need your model's mesh and texture files ready to go, textures can vary in different formats, such as PNG/TGA/DDS being the popular and compatible ones, if yours are in different formats, you need to convert them to one of the three I listed for safest and most compatible results.
As for the model, Usually it's going to be in OBJ/FBX or something else (Maybe RIP format if you use NinjaRipper with a script for Blender to import that format), it shouldn't matter as long as the model is imported in Blender and is functioning.

Once you get your files sorted, you are going to import them in Blender, As for this tutorial, I will port the beautiful Kramer Vanguard guitar from Guitar Hero 2


This is the guitar in all of it's PS2-era glory
Now we're going to port it into Garry's Mod
Now how you might ask? Your question will be answered below as I will show you in the next step:
Third Step: Working with The Mesh and It's Materials
1. Make sure to name the collection with the prop's name (it's up to you but I recommend it so you don't get confused between files), In my case, I named it kramer_vanguard, which is going to be the uncompiled model's name


1.5. Make sure to resize and fit everything with your model to look perfect, I already did it before so I don't have to worry about going precise with this part, but you can use the Move, Rotate, and Scale tools to help you get meshes in position (there is more tools you can use)

(Don't forget to use the Male Reference Model in the Garry's Mod Prop Porting/Making Prerequisites archive to use in Blender for appropriate sizing so the mesh looks good in-game

As you can see in the screenshot above, there is two separate meshes: guitar.mesh and guitar_strings.mesh
Now you can actually make bodygroups from here, but that is in the QC file you're going to do later, but if you are planning to make bodygroups, keep meshes separate as they are and refer to this page on how to get it to work: https://developer.valvesoftware.com/wiki/$bodygroup, if not, just join them together, select them together and press Ctrl+J (shortcut for Join) and they will be one mesh

2. Deal with the materials (If your textures don't show up, use Viewport Shading, as shown in the screenshot)


As you can see, my materials are shown with their proper names from the original game (originally they were van_black and guitar_strings), to be safe, I'm going to change the names of the materials so I don't run into problems in the future with other props using same names for materials






As for making skingroups, replace the main texture with the skingroup you want, make sure it fits well, then you can revert back to the original, no need to put it in Blender now, we can utilize it without having it in the Material Properties menu
(If your Material Properties don't show up like mine [Usually in a case of making a model from scratch], you are going to have to Use Nodes, then set up the UVs of the materials one by one in the UV Editing section, this can take a LONG time if you have a lot of details in your materials to make the prop look right)











3. After you dealt with the materials, you can now go ahead and export to SMD using these steps:
-Click on File, Then hover with your mouse on Export, then hover your mouse again over to Source Engine (.smd, .vta, .dmx) and then click on the name of your mesh you worked on (You can use Scene Export but I never tried it myself)

Fourth Step: Dealing with QCs and VMTs
In order to compile our mesh that we worked on, we need to create a QC script file, to indicate what type of mesh it is (prop or ragdoll), where is it to be located, where it's textures, etc.
(It's just a text file in the format of QC, you can work on it with Notepad or Notepad++ or whatever software you may like)

Now here you are going to need to extract the Garry's Mod Prop Porting/Making Prerequisites.rar archive that you downloaded from the beginning to somewhere you're fine with (Folder inside the archive has an older [possibly incorrect] name because I had this archive for a while and only got around to using it now)

After you extract the archive, open up Example Model QC Script.qc using any text editor you may like, I will use Notepad++


As you see the entire script in the screenshot, you are going to replace some text:

1. In $modelname - "PATH/TO/MODEL.mdl" you are going to replace it with the directory you want your prop in, in my case I will use the following "dodylicious/gh2/kramer_vanguard.mdl"

2. In $body mybody - "reference.smd" you are going to replace it with the name of the SMD file you exported from Blender, in my case, I renamed it from guitar_mesh to kramer_vanguard, so I will replace it with "kramer_vanguard.smd"

3. In $cdmaterials - "PATH/TO/MATERIALS/" you are going to specify where is the folder that has the materials (VTFs/VMTs) for the model to load (Make sure they have the same name as the ones in the Material Properties tab, so memorize the names when you convert the materials, I usually convert the materials for last but you can do them whenever you like)
In my case, I will name it to "dodylicious/gh2"

Mess with $scale if you need to, but if you did everything right in Blender, you don't need to change the value, so keep it as it is (1)

4. In $collisionmodel "collision.smd" you are going to replace it with the name of the SMD file for the collision of your mesh, personally I just make a copy of my mesh and put it there, it will show as "kramer_vanguard - Copy.smd"

5. Take a space after the } in the end of the collision section, and type this:

$texturegroup "skinfamilies"
{
{ "default skin name here" }
{ "skin 2 name here" }
}

(If you need to make one skingroup for multiple textures then you need to put it like this: { "<default material 1>" "<default material 2>" } and repeat the step for each skingroup you have

In my case, I only have two skingroups with one skin for each, so in the spots I fill with vanguard_black (and yellow) as show in the picture below:


Now you're done with the QC script, so save it and rename it whatever you like, personally I like it close to the meshes so I don't get confused with the many meshes I have on my PC xD
Fifth Step: Compiling The QC, Importing Materials and Dealing with VMTS (again)
1. Open Crowbar Tool, If this is the first time you're launching it, then you are going to have to set up directories to the required tools in the dialog boxes in the Set Up Games section in order for it to work properly, like show in the picture below:


After you're done setting up the directories, head over to Compile section and set up the QC input to where the QC is placed, and then set up the Output to the folder you want to put the addon in, like shown in the picture:


Make sure all the mesh's SMDs and the idle.smd file from the archive are in the same folder alongside the QC file that you made

2. Once you're set up, Click Compile, and wait for it to compile, if done incorrectly, the output box should tell you what is wrong for you to fix it

3. After you have compiled and the folders were done, now create a folder named materials, then create folders with the same name as you specified in the $cdmaterials section of your QC file

4. After you are done with that, Open VTFEdit, Click on File, and Click Import, Alternatively you can just press Ctrl+I on your keyboard to quickly get to the Import section


5. Once the Import window opens, select the materials of the mesh and save them as VTF with the same name as the Blender Material Properties menu materials were, ignore the VTF Options are they are fine this way, if anything done wrong then fine tune them to fit your mesh

6. After you are done with converting meshes, go ahead and make VMTs for them, you are provided an Example VMT which you can duplicate and use for how many materials required to be used by the mesh, in $basetexture - PATH/TO/TEXTURES you are going to replace that with the path you provided in the QC, in my case, it was "dodylicious/gh2" so I'm going to type that there BUT you also put the path to your texture, like this "dodylicious/gh2/vanguard_yellow" and then save the file, make sure the VMT is named as the VTF to avoid errors, you can also experiment with other scripts but I like to keep it simple, refer to this page: https://developer.valvesoftware.com/wiki/Material


The picture above is an example to how the path to the material should be laid out, make sure to use VertexLitGeneric, LightmappedGeneric is used for maps, while VertexLitGeneric is used for models, if you were lazy and you auto created your VMTs alongside the material conversion to VTF, then you are going to need to open all VMT files in Notepad++, find and replace "LightmappedGeneric" with "VertexLitGeneric" in all VMTs, then save and close them all, you can do them with another software (I think) but Notepad++ is the easiest (In my opinion)

7. Copy all the VTFs and VMTs to the materials folder you created and put in the QC, and now you are done
Sixth Step: Making The Addon.JSON File
If you are not publishing your item to the workshop, then skip this step entirely and go over to the next, if you are publishing your item though, you need to make a JSON script specifying the addon and it's tags, this is done automatically by your selected tags and type in Crowbar's Publish section, but if you are packing the addon into a VPK file and not publishing it (yet) then you're going to need to make that script

Accidentally I forgot to make it and include it in the Garry's Mod Prop Porting/Making Prerequisites archive that I provided (Sorry lol) so you're going to have to make your own using the template I'm providing down below:

{
"title": "",
"type": "model",
"tags": [
"realism"
]
}

Between the quotations in title you are going to put the name of your addon, in my case I'm not separately releasing this addon but for this tutorial I will just show you how it's done:

"title": "Kramer Vanguard Guitar Prop",

Like that, if you have different tags to put, then you can rename or add, then save the text file as a JSON format with the name "addon" and put it in the folder of the addon, folder should look like this:

-materials
-models
-addon.json



If the Addon.JSON file looks like this picture, then you done it correctly:

Seventh and FINAL Step: Installing and Testing The Addon
Finally we are almost done! Now to install your addon into the game, you are going to need to head to the following directory:

(Name of your drive here):\Steam Library\steamapps\common\GarrysMod\garrysmod\addons

Then when you are here, drop the addon folder here, then launch the game then wait for it to scan addons, when you load in-game, it's going to be located in the "Addons - Legacy" of Browse section of the Spawn Menu, if done correctly, the folder of the addon will appear and will render the icon(s) of the model(s) you have done.


After you spawn it in, To change it's skingroups, open the Context menu, Right Click the prop, and you will see a small menu pop up with options including skin, which when you hover over will show how many skingroups you have, if it does not show, then you might have done something wrong in the QC and you have to redo it again

The End
That is it! I hope that you learned how to port props from games or other sources to Gmod, and if you have any questions, let me know in the comments below, Have fun with your newly made addon!



Addons used for the last screenshot:

Kate Denson (Additional Outfits) - Dead By Daylight - [NPC/PM] by cassius and The Beatles Rockband Playermodels+NPCs+Ragdolls+Props! [DISCONTINUED] by FWhyKay
47 comentários
Dodylectable  [autor] 30 de jul. às 6:36 
Glad you fixed it
book simon 30 de jul. às 3:50 
I did a few things and stuff and I fixed the material. I also realized I had completely forgotten a texture so I added it.
Dodylectable  [autor] 30 de jul. às 0:29 
Does basetexture match up in file path and vtf file?
book simon 27 de jul. às 13:37 
Yes, It all corosponds exactly
Dodylectable  [autor] 27 de jul. às 2:05 
Are you sure the VMT is correct? Does it's filename correspond to your material node in Blender?
book simon 26 de jul. às 20:33 
I've done everything correctly but for some reason, my materials in gmod are missing textures, even in the material browser. I don't know how to fix this
tonyzur 1 de jul. às 5:31 
yeah that was it, the smd was referring to the wrong vmt
Dodylectable  [autor] 1 de jul. às 1:37 
Make sure in your Blender the mesh's material has the main/primary VMT's name
tonyzur 1 de jul. às 1:07 
i checked and corrected the issue, you were right. now i've got a different problem on my hands, the second texture is the only one that shows up. i've already checked the vmt for the first one and it's all in proper order.
Dodylectable  [autor] 1 de jul. às 0:41 
Did you make sure that the VMTs refer to the right basetextures?
And make sure the skinfamilies' entries correspond to the name of the VMTs