SRIV SDK Release A: Weapon Modding Tutorial

Saints Row IV SDK Release A: Weapon Mod Tools
V57iNF5.jpg

Supported
Replacing existing weapons in Saints Row IV with a custom model and new textures.

NOTE: The replacing of existing assets are temporary. Volition is working on a modding patch for Saints Row IV that will allow the loading of entirely new assets without replacement! No ETA as of yet, but get hyped.

Currently Unsupported
Adding entirely new weapons. (Only replacing existing.)
Adding new effects to weapons. (Particles, etc.)
Adding new animations to weapons.
Creating Wacky Waving Weapons! (Yep, you know the ones.)

Beyond these tools, you'll need the following external tools:
Python 2.6.6
Wx Python
FBX Python SDK 2014 for Python 2.6
Autodesk 3DSMax OR Autodesk Maya 2014
Minimaul's Saints Row IV Tools

SECTION 1: DOWNLOAD AND INSTALL TOOLS


SRIV SDK Release A: Weapon Tools
Download the latest SDK Release A and the latest version of the FBX converter from the release thread.

For the following items, I haven't tested it personally, but if you are on a 32 bit operating system, download the 32 bit versions of each program if applicable.

Python 2.6.6
Download the 64 bit version named Windows X86-64 MSI Installer

Wx Python
Grab the one named "wxPython3.0-win64-py26"

FBX 2014.1 SDK

Install all 3 programs
, with Python 2.6 being installed first.

Finally you need to copy some files from the FBX 2014.1 SDK directory to your Python 2.6 directory. This link from Autodesk explains it pretty well.

If you properly installed everything your python/lib/site-packages should look at the least like the following:

1) Notice the Wx folder and local files that should have been installed here.
wx-3.0-msw/
wx.pth
wxversion.py

2) The fbx files that you should have copied over to this folder.
fbx.pyd
fbxcommon.py
sip.pyd


upload_2014-9-5_20-49-3-png.7637

Minimaul's Saints Row IV Tools*

*This download is technically optional. This is for those of you that would like to replace weapons not included in the templates.

SECTION 2: TEMPLATES
Extract your ‘templates’ folder. These folders have examples of each weapon style in the game. These FBX files contain everything you need to make a weapon replacement for Saints Row IV.

QP9auNz.jpg

Template Contents
QocYcBu.jpg

The templates include several things. First the mesh for the main gun, clip (for some weapons) and then bones and locators. I've laid out the specifics of each below.


Meshes
gVQptnY.jpg

In the case of the Pistol template, 'Pistol_Police_A' is your weapon. Currently it is skinned to the bones, and has a shader applied to it. The name of the mesh is important to note, this is what you will need to name your new mesh. The name of the mesh is also used by the converter to name the files.

Some of the weapons have an additional mesh, which is either a clip or a projectile. In this case we have the "pistol_police_a_bone-clip" mesh. These have the same shader applied to them as the main weapon and are not skinned to a bone.

Bones
lkIF4wj.jpg

Bones are used to specify what areas of your weapon animate. The names are usually pretty self-explanatory. When you rig the skeleton to a new mesh, it will animate in the same way as the template weapon. For example, the slide bone on the Pistol template moves its skinned vertices back in the Z axis when fired.

Another example is the Mine Launcher's BlueCanister bone, any vertices skinned to it will rotate in the X axis. There is currently no way to change how these bones behave, and weapons can only use bones they originally had.

Clips / Projectiles and melee weapons are not skinned to a bone. These will be converted into an .smesh file in the converter. (Static Mesh)

Meshes that are skinned to a bone will be converted into a .ccmesh file in the converter. (Character Mesh)

hOKqQW1.jpg

Bones also have a couple extra attributes. These are necessary for the bones to be properly read by the game. You likely won't have to bother with these settings since they are already set correctly in the template files.

Attachment Tags

ptMLkZ8.jpg
Attachment tags are null objects that define where attachment points and various effects like particles are located. Tags are defined by name, with the prefix of 'tag_'.

The templates contain all the tags for that particular weapon, so all you will need to do is move their position to the appropriate place on your new mesh.

MAYA NOTE: The latest Maya FBX Plugin exports these nodes as empty groups that have no graphical indicator. Select them from the Hypergraph and then select the translation tool in order to see them. (The key shortcut is W.)

If you want to replace some of the other weapons not included in the templates, here are some mandatory tags that we can use. Listed below.

weapon_handle - Where it attaches to the hand of a character

secondary_handle - Where the offhand will IK attach to the weapon (IK = inverse kinematics)

muzzle_flash - Where the muzzle flash FX will play from

NOTE: Currently we don't know the other tags and bones that the other non-template weapons have. But it is in the plans to provide the rest of them in the future. Basically, you can replace all the weapons currently but until you know the correct bone setup and tags, you can't replicate all features. For example, you can replace the Tentacle Bat, but it won't have the physics because we don’t know the names of the bones and locators. The template files have been created from source files from the artists at Volition.

Materials
HKWCcZ7.jpg

Above: Pistol’s Shader opened in Maya’s Hypershade.

  • Textures are assigned using Maya / 3DSmax shader network.
  • Textures need to be saved as .TGA format.
  • Converter Supports Diffuse, Normal, Glow and Specular Maps.
  • Converter does not currently support multiple materials.
  • Texture names need to follow a set naming convention for the FBX converter to be able to find them. The naming convention is laid out below.
texturename_SM_D.tga

texturename_LG_X.tga

X = (D, N, or S. These stand for Diffuse, Normal or Specular.)

LG = Large Texture used for up close.

SM = Small texture used on LOD models.​

  • Your diffuse texture for texturename_SM_D.tga should be 512x512 pixels in dimensions.
  • Your LG normal and diffuse should be 1024x1024 and your LG specular map should be 512x512. Keep in mind that you don't necessarily need anything but a diffuse.
  • Textures need to be in the same folder as the FBX.

STOP: At this point we want to create our FBX.
MAYA TEXT TUTORIAL
MAYA VIDEO TUTORIALS

And once you are done, come back to this part to continue.
SECTION 3. CONVERTER

NVJVb2T.jpg

Now launch the FBX converter. I'll lay out what it does.

1. This one’s pretty obvious, navigate to your FBX and select it.​
2. This dropdown menu lets you select between each mesh in your FBX, in this case we can select the main weapon mesh and the clip mesh of the Police Pistol.
3. Select 'ir_at_bsimple1' as your shader. The rest of the shaders aren't supported / documented.
4. These toggles enable export / converting of various file types. You want to enable all of these for your main mesh.

If you import something like a melee weapon or select a clip from the dropdown you will notice that it disables Rigx. This is because these are crunched as static meshes instead of character meshes. (No bones remember!)

5. I will talk more about packaging in the next section. This is our last step when making a weapon, and this button will take our crunched files from step 4 and package them up for the game. Again, more details in the next section.

REMEMBER: If you are making a gun with a clip / projectile, it most likely had a dash in the name. Maya doesn't preserve dashes in the name, so right now is the moment to change the underline to a dash.

So, you've imported your FBX, and you've enabled the buttons detailed in 4. Now all you need to do is hit convert!
FEuxHJQ.jpg


SECTION 5. PACKAGING FILES
Directory Setup

cQHj1ll.jpg

Create a folder named packaging, inside a folder named Modding.

<..\Steam\SteamApps\common\Saints Row IV\modding\packaging>

Packaging is where you put the STR2 / ASM files of your chosen template. All you have to do is copy and paste the files from the 'Packfiles' folders included with each template as seen below.
RDRycvd.jpg


Back in the converter, hit the folder button and select your packaging folder.
Cat5iYJ.jpg


All you need to do now is hit Package!

FPWd4Za.jpg

If all went correctly, then you will have your modified files in your packaging folder! Take them and shove them in Saint Row IV's root folder (C:\Program Files(x86)\Steam\SteamApps\common\Saints Row IV) and launch the game!
ypb0RvI.jpg

If everything went right, your new weapon will replace the default model. Celebrate!
 
Last edited:
MAYA TEXT TUTORIAL
I won't be covering the actual details of modeling, because it is a gigantic subject to cover. If you are new to modeling I'd highly suggest seeking out the myriad of free and high quality tutorials available around the internet.

1. Create a copy of one of the template folders. I created a copy of the SMG_Large_A template. Import the FBX inside of Maya 2014. (File > Import )

2. Model your weapon. After modeling, align your weapon with the template. Keep in mind your proportions / chosen weapon style. (i.e., you probably want a pump shotgun replacement to have a pump.)

uDU8WXQ.jpg


A good place to line up would be the trigger area. Grips should be roughly the same size.

3. UV unwrap your weapon and texture it. (Again, plenty of tutorials out there to detail this process.)

4. Overwrite the default textures of the SMG_Large_A with your own. Make sure your images are the same size as the defaults. If you are utilizing all the features of the shaders you will make a diffuse, normal, and specular map.

Lm0mMFf.jpg


4. Open the Hypershade. To lay out the materials like above, hover over Phong1 and right click drag down to select graph network. At this point you've replaced the default textures with your new ones. To reflect this change hover over Phong1 and right click drag down to the left to "Refresh Swatch". This will refresh the files it has loaded to your new ones.

Assign Phong1 to your new mesh. To do this, select your mesh in the main viewport, and right click drag up while hovering over Phong1 to select "Assign X to Selection".

5. We need to adjust our pivot positions before step 6. For the main weapon mesh the pivot needs to be set at origin. (0, 0, 0) Press Insert while your mesh is selected, and you can move around the pivot. Hold X while middle mouse dragging on the grid. Set it to the middle of the grid.

The clip pivot should be set at the same position as the "gunmag_handle" tag. You likely have not adjusted where your attachment tags are yet. (Detailed in step 11.) But take a look at the pivot locations for the template's clip and you can get a good idea of where it should be.

6. During the modeling and UV unwrapping process you likely have scaled your mesh and moved it around a fair amount. We want to make sure these values are frozen so they don't mess with us when converted. On your main mesh freeze all your values. (Right click in the channel box editor with your mesh selected. Freeze > All.)​
BmkqOrr.jpg

Values for the SMG_LARGE_A mesh.

DO NOT FREEZE YOUR TRANSLATE VALUES for Clips / Projectile meshes.
The attachment tag for the clips and the pivot need to be the same, as well as their translate values. This means in world space, exact same. Below you see that my clip is 8.56 in X and 15.543 in Z. The converter uses the translate values of the mesh and the clip attachment tag to locate their position in space. So for these just freeze their scale and rotation values.
wpx6Xot.jpg


8. We now need to separate the default mesh from its bones, and while doing this we will also delete any construction history for your new mesh. Select Edit > Delete All By Type > History. At this point you want to delete the template mesh. Before you do though, make sure you have their names copied to your new mesh(s). (Maya will append a 1 to an object with an identical name to another object in the scene. Just remember to delete the 1 after you delete the original.) Delete the template mesh(s).

9. Time to skin the bones to our mesh. Select the bone_root bone and then your mesh. Make sure you've selected the Animation menu set. (Top left dropdown box.)Then select Skin > Bind Skin > Smooth Bind. (Smooth bind should have its default values selected.)

10. Skin Weight Time! The skin weights it assigned to your bones need to be changed. Select your bone, and then mesh. Then select the Paint Skin Weights Tool.
JXbggRk.jpg

Your weights will probably look something like this.
y4UTRzN.jpg


White = Full influence over vertices. Black = No Influence. Set your opacity and value to 1.0 and hit flood. This will make your mesh look like the picture below.
jD0qXNK.jpg


Now select your other bones and flood them with a value and opacity of 0. Do this for each bone that isn't 'bone_root'. This will turn the entire model black which is what we want.
h25175m.jpg

After you've done this, select all the vertices of the area you want affected by each bone. Then go back into the paint weights tool and flood these areas with a value and opacity of one. On the right you can see an example of the pump shotguns weights for the pump bone.


11. Now your weights are set correctly. All that’s left is to make sure your attachment tags are in the right spot. Select them via the Hypergraph > Hierarchy and move them to new spots if need be. Below you can see the muzzle flash locator I moved to a new spot on my new mesh.

zTL0lYj.jpg


12. Now it’s time to export! Make sure your Hypergraph looks like the template at the start.

Go to File > Export All. Select FBX from the dropdown menu below. Now make sure your settings look like this picture. (Linked because of size.) Make sure you are exporting to your copied template folder. The FBX needs to be in the same directory as the textures assigned to it.

STOP:
Now we will want to go back to the main tutorial in order to continue. Go back to the red text above. :)

 
Last edited:
MAYA VIDEO TUTORIALS
I've created some video tutorials for those of you that prefer to see things visually. I probably don't explain the concepts as succinctly as the text based tutorial, so if theres anything in the videos you dont understand then I suggest reading the text guide in the post above.


 
Last edited:
That FBX-SDK link leads to the Visual Studio version instead of the needed Python version.
I couldn't get it to work with neither of them anyway.
4737f0cd3f60559c461172baf020ee36.png

It's not able to find the module.
I completely copied the VS and Python stuff over to side-packages.
 
Last edited:
Which version of the python sdk did you download?
http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=22519239

Python Binding

fbx20141_fbxpythonsdk_win.exe

Also, did you follow the link instructions for copying the sdk files to your local Python folder?
  1. Copy the contents of <yourFBXSDKpath>\lib\<Python26>\ to Python26\Lib\site-packages\
Edit: Re-read your very small post and it seems you did the copy

Can you do the following if you are in Windows.

Start > run or cmd.exe
type "python" hit return
- This should run the python interpreter
type "import sys" hit return
type "for i in sys.path: print i" hit return Twice possibly

This should print out all of the python module paths that python can see.
Take a shot of that for me.
 
Last edited:
Which version of the python sdk did you download?
http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=22519239

Python Binding

fbx20141_fbxpythonsdk_win.exe

Also, did you follow the link instructions for copying the sdk files to your local Python folder?
  1. Copy the contents of <yourFBXSDKpath>\lib\<Python26>\ to Python26\Lib\site-packages\
Edit: Re-read your very small post and it seems you did the copy

Can you do the following if you are in Windows.

Start > run or cmd.exe
type "python" hit return
- This should run the python interpreter
type "import sys" hit return
type "for i in sys.path: print i" hit return Twice possibly

This should print out all of the python module paths that python can see.
Take a shot of that for me.
7b13ebaa8b262e7c8c411e32d536e65b.png
 
If you are running x64 bit Windows
Did you copy the folder "C:\Program Files\Autodesk\FBX\FBX Python SDK\2014.1\lib\Python26_x64" to "C:\Python26\lib\site-packages\"?
What does that folder in windows look like "C:\Python26\lib\site-packages\"?

Additionally, can you show me the python information after you hit return on "python"?

Thanks!
 
Last edited:
You have seemingly different files that I can tell. You should only end up with these 3 files in there. The compiled FbxCommon file will get generated on its own though. I'd remove all the "*fbx*" files you have in there then copy these over.

upload_2014-8-29_16-33-28.png
 
Back
Top