PAYDAY 2

PAYDAY 2

102 ratings
Gunsmith's guide on custom weapon models porting for dummies 101
By Gunsmith Noob
A simple and exhaustive guide on how to import custom weapon models into Payday 2
   
Award
Favorite
Favorited
Unfavorite
Introduction
Howdy there!
I will cut short to business,no fancy presentations or funny comments.
This guide is meant to show how to import different weapon models into Payday 2 using all the available tools.

It is not a difficult task,but it might get a bit tedious/boring/annoying,so,arm yourself with patience.

What you need for starters :

My personal choices for the 3d and 2d editing applications are Blender and Gimp. I will use those 2 in the following guide


Also,i suggest this guide by Babyforce ,which is going to be updated in the future on how to make an add-on weapon instead of a replacement:

http://steamcommunity.com/sharedfiles/filedetails/?id=819918899
First steps
First of all : unpack the game files through the bundle modder.

Follow this guide to make the bundle modder work with the latest game patch:

http://steamcommunity.com/app/218620/discussions/15/1474221865204158003/

Make sure the correct asset folder path is selected


Then,select where you want the bundle modder to drop the unpacked files. Make sure "Extract all" is ticked



It will take some time. Once it has finished,you are almost ready.

When you want to port a weapon,keep in mind these simple things:

  • Hold and reload animations cannot be edited,but can only be swapped with other weapon animations set through .lua. BUT,this way only the player arms animations can be changed,the weapon magazine and the eventual bolts will keep the original weapon animations
  • Every weapon is chopped down in various components,and a few components are shared between multiple weapons
  • Sometimes,it's not the model that is being shared but just the texture. You'll also have to take it in account eventually to avoid broken textures
  • Preferably replace weapons with similar shapes and sizes

Now you're asking yourself : where do i exactly find the weapon models?

Luckily for you,they are stored in conveniently named folders. Weapons that are not DLCs can be find in the following path:

units/payday2/weapons

In said folder,every weapon is stored in subfolders with names that might seem weird,but all follow this pattern

wpn_fps_WEAPON CATEGORY_ACTUAL WEAPON NAME_pts

Keep in mind,you will need only the "_pts" folder to make a weapon mod

DLC weapons and certain community weapons are stored in a different path

units/DLC CODENAME/weapons

For this guide,i will replace the Bernetti 9 with a Smith&Wesson 659 (which model and textures are made by the amazingly talented TIGG)

So,the Bernetti 9 is stored in the following path

units/payday2/weapons/wpn_fps_pis_b92fs_pts

[/b]

OH WOW THAT'S A LOT OF FILES! Do not worry,out of those you will need only all the files with the following extensions

  • .Model,which is the 3d model itself
  • .Texture,which are the textures of the model
  • .Material_config,which handle the way the model is rendered. You might need this file for further tweaks and to eventually find out which exact texture is used by a model

We're almost there now. Do not forget that the Bernetti 9 has an engraved grips which comes from the Butcher's modpack community update. Meaning,said grip model and textures are stored elsewhere,in the path

units/pd2_dlc_butcher_mods/weapons/wpn_fps_pis_beretta_g_engraved



There you go,now you have every single component of the Bernetti 9

Setting up the custom model
Set up your workflow however you please,keep a copy of the original files,and now,it's time to rev-up the Model tool! You will need to convert those .model files into something that any 3d modelling tool can open and edit ( which is a .obj format)

Start the model tool. It's a fairly straight forward application,which needs no rocket science to work. Now,simply click onto the "browse" button,right next to "Input file",and select a .model from the Bernetti 9 files



In a blink of an eye,it will automatically create a .obj file in the very same folder,without further human input. Now,rinse and repeat for every .model file

Here's a list of the Bernetti 9 3d model files and what exactly is inside them

  • wpn_fps_pis_beretta_b_std : This is a dummy model of the barrel. It's currently empty,you will not need this at all. The actual barrel is inside the frame file
  • wpn_fps_pis_beretta_body_beretta : This contains frame,barrel and hammer. Barrel and frame are a single mesh,while the hammer is separated
  • wpn_fps_pis_beretta_body_rail : This is the gadget rail. It's an universal frame rail,and is also shared with a couple of other pistols in game
  • wpn_fps_pis_beretta_co_co1 : This is the Professional compensator
  • wpn_fps_pis_beretta_co_co2 : This is the Competitor compensator
  • wpn_fps_pis_beretta_g_ergo : This is the ergonomic grip
  • wpn_fps_pis_beretta_g_std : This is the standard black grip
  • wpn_fps_pis_beretta_m_extended : This is the extended magazine
  • wpn_fps_pis_beretta_m_std: This is the standard magazine
  • wpn_fps_pis_beretta_o_std : This is the standard iron sight
  • wpn_fps_pis_beretta_sl_brigadier : This is the Elite slide
  • wpn_fps_pis_beretta_sl_std : This is the standard slide

From the Butcher's mod folder
  • wpn_fps_pis_beretta_g_engraved : This is the engraved grip

Now that you have converted all those files into .obj,open up blender and set up a clean scene

First of all,import in blender "wpn_fps_pis_beretta_body_beretta.obj"

You will get something akin of this



As you can notice,there are 2 different objects in the scene,"g_body" (frame and barrel) and "g_hammer" (the hammer)

And now import "wpn_fps_pis_beretta_sl_std.obj" in the very same scene. Now,have a little of fun building up the weapon like using some legos


This step will help you correctly sizing your custom weapon model

I will now proceed to load in the very same scene Tigg's S&W659


As you can see,the S&W mesh is pretty downsized. To correct it,select the mesh,press onto "set origin" (on the left of the screen),then "origin to center of mass". Press ALT + G,so the mesh will be perfectly centered,and now resize it until it has a correct size. Use the barrel as reference : the two weapons have the same caliber,so it will have the same diameter. Also,you will need the barrel in the right place if you don't want the compensators and suppressors to be out of place


Now the gun is correctly sized,but,as you can see,the slide and the barrel are slightly shorter than the Bernetti ones. I will proceed to slightly edit the mesh,this way compensators and suppressors won't awkwardly float

Once done,the Bernetti parts can be deleted. Now,it's time to deconstruct the S&W in the same way the Bernetti is deconstructed. Meaning,i need different objects for the frame,slide,grip,iron sight and magazine.

If you do not know how to do so,please check some blender tutorial. There is an easy shortcut to do it,but it does not always give good results,so it would be better if you do it by your own hands

Once done,you should have something like this



The light grey mesh will be replacing the ergonomic grip,while the elite slide and the engraved grip will use the same mesh with a different texture

Once this step is finished,you'll have every piece correctly sized and ready to be ported



Phase 1 : Porting the Model
Now that you have every part correctly sized,is time to start porting them into the game.

Start by importing one of the Bernetti components. I will start again from the frame

Once imported DO NOT touch it's placement and size.

Now import the custom mesh that you want to import on this piece and correctly align it.

I suggest always starting from the frame. In this case,i will align the model using the barrel as reference


The hammer is a separated and animated object,and is placed approximately in the center of the scene in the "♥♥♥♥♥♥" position,keep it in mind.

The next step consists in renaming the objects in the scene


Delete the g_body and g_hammer original objects,and rename your model objects accordingly. Make sure that there are no typos

Before exporting take some time to mark all the hard and sharp edges of the mesh. Afterwards,use the edge split tools to split those vertexes. This way most of the lightning issues will be avoided

Once done,export the whole thing into an .obj file with only the following settings ticked :

- Include Edges
- Write normals
- Include UVs
- Triangulate faces
- Objects as OBJ objects

Now that you have your custom model,open again the model parser tool,browse again to the .model file you are replacing,then "Import .obj" and select the file you just exported from blender.

In the output file section,write the name you want to give to the file,and remember to also write the extension ".model" before pressing "EXPORT"

Repeat all these steps until you replace every single piece of the weapon.

Once done,you can set up your mod folder.
In this case:

"Mod_Name/units/payday2/weapons/wpn_fps_pis_b92_pts"
Phase 2 : Porting the Textures
Every piece of the gun has its own pair of textures (a diffuse and a normal map)

The Diffuse texture (marked as "_df") contains both the actual texture that will be "painted" on the model,and a reflection map embedded in its Alpha channel,which handles the reflections (duh)

DIFFUSE TEXTURES

Open up your 2d graphic editing application (i will use Gimp) and import the diffuse texture of the custom model,then import as layer the reflection map


Open up the "Layers" and "Channels" panels. Hide the reflection map in the "Layers" panel,then drag and drop it in the blank section of the "Channels" panel

You can now delete the reflection map from the layers panel. Right click on the diffuse map in that very same panel and select "Add layer mask"


Then select "Channel" and press "Add"


Export now the new image as a .dds with the following setting

- Compression "BC2/DXT3"

I suggest to not tick "Generate mipmaps",since without them the mod will not look grainy on lower resolutions,but you might have a bit of performance loss in case you are playing on a low res setting

Once exported the .dds,rename it accordingly and change its extension to " .texture",then drop it in the same folder of your mod (same path of the .model files)

Repeat the same for all the diffuse textures

NORMAL MAPS

Open up your 2d graphic editing application (i will use Gimp) and import the normal map of the custom model

From the channel panel,drag the "Red" channel into the blank section below
Click now on "Image","Image mode" and select "Greyscale"

In the layers panel,"Add layer mask" and select "channel"

Export now the new image as a .dds with the following setting

- Compression "BC2/DXT3"

DO NOT tick generate mipmaps,the weapon will look way better

Once exported the .dds,rename it accordingly and change its extension to " .texture",then drop it in the same folder of your mod (same path of the .model files)

Repeat the same for all the diffuse textures
Final steps


Well,the model is misplaced,so i will have to fix the placement in the .obj files and then re-import them in the game. It's a trial and error process,so have patience.


There you go,now you know everything you should know about porting weapons into Payday 2

Good luck,and Mod responsibly!.....nah,who am i kidding,make all the mods you want!



Additional Tip : Edge Splitting
You've learned the basics, now it's time to really perfect your custom model. These are small tweaks that will make large differences in your port quality, no matter the model.

Smoothing Errors
Depending on the model you're working with, you may run into smoothing errors. Smoothing errors can absolutely wreck your model quality with problems like shading issues and triangulation. Take a look at this Scorpion Evo model from Battlefield 4 for example:
Yikes. That looks pretty terrible. On the bright side, there's an easy fix for this. Blender has a Modifiers feature that can add all kinds of filters to your model. We'll just take a look at one of them for now, which is Edge Split.


Look for a wrench icon under your object names. You should come across this. On Blender's default interface, it's on the right side of the screen. Click on the drop down list, and search for Edge Split. Remember to do this for every single object in your scene.


After clicking on the modifier, you should see an immediate difference in model quality.


What do you know? Your model looks much sharper! You can actually see the little details. You'll want to get into the habit of doing this, and to be safe, even do it for every model.


The Split Avg. percentage will control how strong the modifier is. Move it to the right to make it smoother, make it to the left to make it shaper. Try and find a happy balance between the two. You do not want an overly sharp, polygonal model, but you don't want it to be too smooth either.


Unlike the main part of the guide, you will want "Add Modifiers" checked this time around when you export.
Additional Video : How I Do Model Ports

A video that details everything in this guide just in case you're more of a visual learner.
56 Comments
salter Sep 5, 2021 @ 2:47pm 
On the extracting bit, I think all of the files might not have been extracted on my end. I'm not sure on whether i messed something up, because when i go to the directory for the beretta as you have, it's not there. Did i mess something up?
Epaphroditus May 27, 2021 @ 6:13pm 
cool cool but its to hard
BIGBOOMSTICK69 Sep 8, 2019 @ 3:15am 
Can u help me please? I can't find Lumber Lite L2 model
Dr. Gordon Freeman, Ph.D Mar 31, 2019 @ 10:05am 
Hey, I have a question. I'm trying to port some vehicle models from the game into the Source Engine, and I'm wondering how to find and convert the textures.
CturiX Jul 8, 2018 @ 5:46pm 
I feel like this guide needs an update as the bundle modder is now version 1.16.5.1 and now has a different interface.
Gunsmith Noob  [author] May 27, 2018 @ 11:51pm 
Yes It does follow the same procedure,except using models from the various ''masks" folders
Matthew James May 27, 2018 @ 10:16pm 
does this work for mask aswell?
Gunsmith Noob  [author] Apr 9, 2018 @ 10:20am 
Yeah don't have much hope for It sadly (as far as i know)
DR01D_Qs Apr 9, 2018 @ 8:45am 
Oooh man that's really sad. Spy, the developer of that, left pd2 modding right, so there's no hope for any updates or fixes?
Gunsmith Noob  [author] Apr 9, 2018 @ 6:00am 
@xxx-dro1d ad far as i remember it's an issue with the model tool that doesn't correctly read meshes that have two or more UvMaps on them. Sadly i don't think There is a way to fix it currently