S&box Wiki
Home
/
Edit Importing Rust Weapons
View
Edit
History
No Category
Developer Overview
The Project System
Publishing To Asset Party
Getting Started With Hammer
Mapping Basics
Mapping Entities
Advanced Mapping Techniques
Getting Started with Modeldoc
Animgraph & Animation
Physics
Modeldoc Nodes
Advanced Modelling
UI Basics
Styles & Stylesheets
Razor Templates
Game Menus
Materials
Built In Shaders
Shaders
Shader Reference
Sounds & Audio
Particles
Getting Started
Making Games
Input
Networking
Physics
Rendering
Editor & Tools
VR
Misc
Playing Guides
Console Commands & Variables
Dedicated Server
Log in to edit
Importing Rust Weapons
<cat>Model.Intro</cat> <title>Importing Rust Weapons</title> 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_. <upload src="1/8d8d42ac983ca74.png" size="16917" name="image.png" /> Animations are going to start with the name of the model they're for. They're going to be all lowercase. <upload src="1/8d8d42afcc0f89a.png" size="38031" name="image.png" /> Same with sounds <upload src="1/8d8d42b1cef4270.png" size="35808" name="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. <upload src="1/8d8d42b7308fd93.png" size="8153" name="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. <upload src="1/8d8d42ca2fcbb00.png" size="125463" name="image.png" /> 6. Duplicate (or copy and paste) your .fbx in the list, for each LOD. 7. Rename them and select the meshes for each LOD. <upload src="1/8d8d42ceb32be0d.png" size="29052" name="image.png" /> 8. Add > LOD Group. 9. Duplicate the group, or do Add again, assign your meshes to the LODs properly. 10. 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] <note>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.</note> 6. Go back to ModelDoc, set the material in your DefaultMaterialGroup <upload src="1/8d8d42f8116b774.png" size="213487" name="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. <upload src="1/8d8d42fd979a496.png" size="168548" name="image.png" /> <note>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.</note> ## Attachments 1. Create an attachment for the muzzle flash to come out of. Call it muzzle. 2. Create an attachment for the bullet casings to come out of. Call it ejection_point. <upload src="1/8d8d4307cbff984.png" size="315259" name="image.png" /> <note>RED on the axis is FORWARD. The way to remember this is to remember FLU and RGB. Front, Left, Up - Red, Green, Blue.</note> 3. If you don't already have one, create a bone called "root" and set it as the bone in your mesh's properties. Then, create an attached 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] <note>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.</note> ## Debiggerfying <upload src="1/8d8d431e7d72ec7.png" size="564639" name="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. <upload src="1/8d8d432c2fd7d24.png" size="789952" name="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 <warning>If the hands are all stretched and fucked I don't know what the problem is, it might be a source art issue</warning> ## 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 <note>This sucks, we should really have some viewmodel meta and be able to preview it in modeldoc as it'll show in game.</note>
S&box Wiki
Development
Developer Overview
6
Editor Overview
General FAQ
System Requirements
The s&box wiki
Troubleshooting
Useful Links
The Project System
4
Adding Assets
Creating a Game Project
Project Settings Window - Games
Project Types
Publishing To Asset Party
2
Uploading assets
Uploading projects
Hammer
Getting Started With Hammer
3
Getting Started With Hammer
Making Your First Map
Mapping Resources
Mapping Basics
7
Cordons
Hotspot Materials
Selection Sets
Standard Mapping Dimensions
Tool Materials
Tools Visualisation Modes
Using Entities That Require a Mesh
Mapping Entities
2
Creating a Door
Light Entities
Advanced Mapping Techniques
8
Collaborating With Prefabs and Git
Instances
Prefabs
Quixel Bridge Plugin
Tilesets
Tilesets-Advanced
Tilesets-Proxies
VIS Optimizations
Models & Animation
Getting Started with Modeldoc
7
Automatic Model Setup
Breakpieces
Creating a Model
Guide to Models
Importing Rust Weapons
LODs
ModelDoc FAQ & best practices
Animgraph & Animation
4
Animations without Animgraph
AnimEvents, AnimGraph Tags, Attachments
Animgraph
Delta Animations
Physics
3
Cloth Physics
Collisions, Physics & Surface Types
Jiggle Bones
Modeldoc Nodes
1
Custom ModelDoc nodes
Advanced Modelling
6
Bodygroups
Citizen
First Person
IKChains and Stride Retargeting
Morphs
Vertex Normals
User Interface
UI Basics
6
Custom Fonts
Embedding Websites
Enabling Pointer Events
Events and Input
UI Basics
UI with Components
Styles & Stylesheets
1
Video Backgrounds
Razor Templates
4
A Razor Overview
Aliases and SetProperty Attributes
Generic Components
Templates
Game Menus
1
Making a Custom Pause Screen
Materials & Shaders
Materials
5
Guide to Materials
Material Attributes
Material Resources
Texture Settings
Using Dynamic Expressions
Built In Shaders
2
Foliage Shader
Glass Shader
Shaders
4
Compute Shaders
Constant Buffers
Material API
Shading Model
Shader Reference
5
Anatomy of Shader Files
Getting rid of Tex2D macros
Shader Reference
Shader States
Texture Format Cheat-Sheet
Other Assets
Sounds & Audio
4
Guide to Sounds
Sound Events
Sound Occlusion
Soundscapes
Particles
5
Creating animated sprites
Creating your first particle effect
Understanding Particle Editor
Using custom sprites
Using particle systems from C#
Coding
Getting Started
5
Cheat Sheet
Learning Resources
Setting up Rider
Setting up Visual Studio
Setting up Visual Studio Code
Making Games
2
Components
GameObjects
Input
4
Commands
ConVars
Input System
Speech Recognition
Networking
7
Auth Tokens
Http Requests
Lobby System
Networked Types
Networking Basics
RPCs
WebSockets
Physics
5
Collisions
Hitboxes
Joints
Traces
Triggers
Rendering
3
Render Tags
RenderHooks
Scenes
Editor & Tools
5
Guide to Widgets
Hammer API
Hammer Gizmos
Hotload Performance
Widget Docking
VR
3
Getting Started
VR Input
VR Overlays
Misc
10
Asset Types
Attributes and Component Properties
Backend API
Code Accesslist
CPU Performance Profiling
DisplayInfo
package/find
Setting Up A Navigation Mesh
Threaded Tasks
TypeLibrary
Playing
Playing Guides
3
Default Keybinds
Proton
s&box on macOS (Experimental)
Console Commands & Variables
1
Launch Arguments
Dedicated Server
1
Dedicated Servers