S&box Wiki

Importing Rust Weapons

Importing Rust Weapons

While this isn't directly useful to anyone outside of Facepunch, I'm creating this guide here because I think it might be indirectly useful.

Copying Source Files

I don't want to end up with a load of odd named files, so I'm going to spend some time to rename and organize the source files.

We're going to give everything a rust_* name. Viewmodels here start with v_.

image.png

Animations are going to start with the name of the model they're for. They're going to be all lowercase.

image.png

Same with sounds

image.png

With textures things are generally a lot easier here if you name them properly from the start. Source 2 likes the files to have _color, _normal, _rough, _ao, _trans etc on the end. It's a naming convention that we should try to stick to too.

image.png

World Model

The World Model is what we see in the player's hands in third person. It's also the model that appears in the world when the weapon is dropped.

  1. Open ModelDoc
  2. Add > Add Meshes
  3. Find your regular weapon mesh [PAIN POINT: Allow Drag + Drop meshes from explorer?]
  4. Click Compile
  5. Save your vmdl (we're saving as rust_shotgun.vmdl).

You should now have an un-materialed weapon model.

image.png
  1. Duplicate (or copy and paste) your .fbx in the list, for each LOD.
  2. Rename them and select the meshes for each LOD.
image.png
  1. Add > LOD Group.
  2. Duplicate the group, or do Add again, assign your meshes to the LODs properly.
  3. Play with the Switch Threshold (especially the camera button) to set the lod distances. You'll need to compile to actually see the results.

Material

  1. Add > Default Material Group
  2. Open Material Editor [PAIN POINT: Should Right click texture in asset browser > Create Material]
  3. File > New [PAIN POINT: Too Many Shaders]
  4. Save in your textures folder
  5. Fill in your textures, set your material up. [PAIN POINT: pressing down arrow from the texture browser search box should select the first texture in the list]
You might have to edit your rust _specular texture to make it a _rough texture. Open it in photoshop, copy the alpha channel to the rgb channels, invert it, delete the alpha channel.
  1. Go back to ModelDoc, set the material in your DefaultMaterialGroup
image.png

Physics

  1. Add > Physics Shape Capsule
  2. Select Root Bone (or none if none)
  3. Place a few shapes to cover a decent amount of the weapon.
image.png
You could use boxes or spheres too, but you have to think about how it's going to act when it gets dropped. If you encase it in cubes it might end up balancing on the end of the barrel. With capsules it's going to fall flat whatever happens.

One thing to keep in mind here is that if you only use one capsule, it's going to be rolling around like a cucumber.

Attachments

  1. Create an attachment for the muzzle flash to come out of. Call it muzzle.
image.png
RED on the axis is FORWARD. The way to remember this is to remember FLU and RGB. Front, Left, Up - Red, Green, Blue.
  1. Create a bone called "hold_R" (or, if using Citizen v1, "r_hold"). This is what will be bonemerged with the player model to place it in the player's hands. Make sure to tick "Do Not Discard" in the property editor for the bone. [PAIN POINT: Need to lock this shit down and formalize it properly] [PAIN POINT: Do Not Discard should be on by default]
Don't worry about getting this shit perfectly placed. Once you load the model in game you can fuck with it in ModelDoc and the changes will be hotloaded, so you'll be able to iterate super fast.

Debiggerfying

image.png

If your gun is huge, select your mesh in the RenderMeshList tree and change the Import Scale. In my experience, things coming from Rust either need to be 0.1 or 0.6, but set it to what feels right.

Our player model's is a fat handed twat so you're never going to get things to line up perfectly, so just get it as good as you can.

image.png

View Model

Repeat the steps for the viewmodel model, except you don't need to add physics stuff. It should probably use the same material too.

  1. Set the hands material (search for rust_hands)
  2. Set Muzzle attachment (make sure the parent bone is on the barrel of the gun)
  3. Add > Simple Animations
  4. Select all the v_ animations
  5. Drag the idle animation to the top

Animgraph

  1. Copy and and paste the v_*.vanmgrph from another weapon
  2. Name it v_[weaponname].vanmgrph
  3. Click the magnifying glass next to Graph: and select it
  4. Click Edit next to Graph:
  5. Click the Cog opposite Preview on the top right (you might need to make the column wider)
  6. Select your v_ model here
  7. Fix the animations on the nodes with the old weapon's name (v_oldweapon@idle etc)
  8. Save and close
If the hands are all stretched and fucked I don't know what the problem is, it might be a source art issue

Positioning

When positioned in game the view model should already be kind of positioned in the right place, but because of the foc differences you might want to tweak it.

  1. In ModelDoc, Add ModelModifier_Translate
  2. Change the model position offset while watching in game
This sucks, we should really have some viewmodel meta and be able to preview it in modeldoc as it'll show in game.

Special Pages


Wikis

?

Render Time: 13ms

DB GetPage 3
Generate Html 0
SaveChanges (1) 7
Render Body 0
Render Sidebar 0