jbo1994 | 2012-05-31 22:47
Source Engine (SMD) Hudgun Export Tutorial!
20
points ]
 (2 votes)

In this tutorial, I will attempt to clarify the process for setting up for and exporting hudguns with hands for Sauerbraten and Red Eclipse.
You will need Blender 2.62 and SMD tools, which can be obtained here and here, respectively.
I will not provide instruction for the actual modeling process, only for rigging, exporting, and configuring.
Now, I’m going to assume that you have fully skinned hand and gun models for exporting; if you do not, this tutorial is going to be useless. First, rig the model. Select the model that you are going to rig, then select the rig, and press ctrl-p [with empty groups] and assign the vertices of the model to their proper groups. Make sure to keep gun and hand armatures separated:
Image Hosted by ImageShack.us
By jbo_aka_jnosko at 2012-05-31

Now, add a bone to the hand armature, name it “tag_weapon”, and parent it to some bone in the hand holding the gun by selecting first the tag_weapon, then the bone to be parented to, and pressing ctrl-p. Mine is positioned here:
Image Hosted by ImageShack.us
By jbo_aka_jnosko at 2012-05-31
As you can see, the relationship line goes to the tip of the wrist bone in the right hand.
Next, align the gun and hand models as they would appear in the first frame of the “idle” animation. After you have done that, add a bone to the gun armature named “tag_weapon”, and align this bone with the tag_weapon of the hand armature; parent it to the root bone of the gun.
for example:
Image Hosted by ImageShack.us
By jbo_aka_jnosko at 2012-05-31
Place a bone at the end of the barrel or the tip of the blade, facing the direction of the projectile, name it “tag_muzzle”, and parent it to the root bone of the gun also.

-FOR RED ECLIPSE USERS ONLY:
If the weapon you are working on ejects brass (such as the SMG), you will need a bone named “tag_eject” at the point of ejection.

For the rest of you: Make sure that the origins of the gun armature and model are at the root of the tag_weapon of the gun armature. Put the hand armature in pose mode by pressing ctrl-tab. Select the gun armature and then select the tag_weapon of the hand armature; press ctrl-p [click “bone” in the menu]. This will make it easier to animate the hands and the gun working together.
Proceed with animating the hands and gun, making a separate action for idling, firing, (and reloading for RE) in the action editor, using separate actions for the hand and gun armatures.
Now we’re ready to export. go to the scene tab of the properties panel, and scroll down to the SMD export section. Set the output folder to “//smd//” f.e. “//smd/shotgun/”. now, select the gun armature, close the action that is assigned to the armature (to avoid duplicates), and then also select the gun model. Duplicate the selected items by pressing shift-d. Select the original gun armature and also the hand armature, and press alt-p [clear parent]. Take the original gun armature and model, snap the cursor to center with shift-s [cursor to center], and snap the selection to the cursor with shift-s [selection to cursor]. Align the tag_weapon to the global x-axis, then rotate with [r, x, 90, -] and then [r, z, 90]. (I also suggest that you set the origin for the hand model and armature at the center, but it's not mandatory.) Then proceed to scale the models WAAAY down, so that a long gun is about 2 blender units long. Otherwise, the point where the projs begin will be way too far forward.
Go back to the smd export panel and make sure the only the original hand and gun meshes are selected to export, and click “scene as configured”. Now, select only the original hand and gun armatures, making sure that the your “idle” animation is assigned to them. Go to the smd export panel and make sure the ONLY the original armatures are selected, and select “current/NLA” in the drop-down list for each. Press “scene as configured” again; repeat with all the other animations. (you may be able to use “action filter” from the list in the smd panel, but I’ve never tried it.)

Now to import them to the game. I recommend using the same set of hands for all of your guns, so that the game will only have to load one set of hands for all of the weapons.
For sauerbraten, create a folder in packages/models for your hudguns, and make the folders chaing, shotg, rl, gl, chainsaw, rifle, and pistol inside that. Place the exported hand model, animations, and skins inside the root hudguns folder; place the weapon models, animations, skins, and configurations inside their respective folders.
Unfortunately, these will not show up in team games, as I have absolutely no idea how to assign different skins for different teams. Also, if you decide to switch back, you will have to delete Sauerbraten’s configuration file. Otherwise, the default guns will be horribly disoriented, and I do not know why.
Sample configuration for Sauerbraten: (for more info on commands, see “models” in the documentation)
smddir ""
smdload "hands.smd"
smdpitch "" 1
smdtag tag_weapon tag_weapon
smdskin * "hands.png" "hands_mask.png" .4 .1
smdadjust Root -5 -7.5 0
smdanim "gun idle" "hands_chaing_idle.smd"
smdanim "gun shoot" "hands_chaing_fire.smd"

smddir "\chaing"
smdload "chaingun.smd"
smdtag tag_weapon tag_weapon
smdtag tag_muzzleflash tag_muzzle
smdskin * "chaing.png" "chaing_mask.png" .3 .2
smdanim "gun idle" "chaing_idle.smd"
smdanim "gun shoot" "chaing_fire.smd"

smdlink 0 1 tag_weapon

For Red Eclipse, things must be done differently. First go to the “models\actors\player” folder and make a backup of “hwep.cfg”. Then make a backup of the entire “weapons” folder. Delete the “md5.cfg” inside the “hwep” folder of the weapon you are currently replacing. Place only the weapon files in the hwep folder, along with configuration in the form of a “smd.cfg”. Now go back to the player folder and replace the original “hwep.cfg” with your own; place all of your hand files here.
sample configuration for the weapon:
smddir "weapons/,/hwep"
smdload ".smd"
smdskin * ".png" ".png" .09 .06
smdenvmap * "skyboxes/skylump2"
smdtag tag_muzzle tag_muzzle
smdtag tag_weapon tag_weapon
smdanim "" "_idle.smd"
smdanim " primary" "_fire.smd"
smdanim " secondary" "_fire.smd”
smdanim "" "_reload.smd"

mdlscale 1680

sample configuration for hwep.cfg:
smddir "actors/player"
smdload " hands.smd"
smdpitch "" 1
smdskin * " hands_skin.png" " hands_mask.png" .2 .4
smdbumpmap * "spartan_hands_normals.png"
smdenvmap * "skyboxes/skylump2"

smdtag tag_weapon tag_weapon

smdanim "switch|use|jam" "hands_switch.smd"

smdadjust Root -5 5 0
smdanim "smg" "hands_smg_idle.smd" 1
smdanim "smg primary" "hands_smg_fire.smd" 20
smdanim "smg secondary" "hands_smg_fire.smd" 20
smdanim "smg reload" "hands_smg_reload.smd" 51

smdadjust Root -7.5 5 0
smdanim "rifle" "hands_rifle_idle.smd" 0
smdanim "rifle primary" "hands_rifle_fire.smd" 120
smdanim "rifle secondary" "hands_rifle_fire.smd" 120
smdanim "rifle reload" "hands_rifle_reload.smd" 70

smdadjust Root -2.5 5 0
smdanim "flamer" "hands_flamer_idle.smd" 0
smdanim "flamer primary" "hands_flamer_fire.smd" 20
smdanim "flamer secondary" "hands_flamer_fire.smd" 20
smdanim "flamer reload" "hands_flamer_reload.smd" 10

smdadjust Root -7.5 2.5 0
smdanim "shotgun" "hands_shotgun_idle.smd" 0
smdanim "shotgun primary" "hands_shotgun_fire_alt.smd" 53.3
smdanim "shotgun secondary" "hands_shotgun_fire_alt.smd" 53.3
smdanim "shotgun reload" "hands_shotgun_reload_alt.smd" 45.75

smdadjust Root -7.5 2.5 0
smdanim "pistol" "hands_pistol_idle.smd" 0
smdanim "pistol primary" "hands_pistol_fire.smd" 260
smdanim "pistol secondary" "hands_pistol_fire.smd" 220
smdanim "pistol reload" "hands_pistol_reload.smd" 56.25

smdanim "grenade" "hands_grenade_idle.smd" 0
smdanim "grenade power" "hands_grenade_power.smd" 19
smdanim "grenade primary" "hands_grenade_fire.smd" 240
smdanim "grenade secondary" "hands_grenade_fire.smd" 240

smdadjust Root -7.5 7.5 0
smdanim "plasma" "hands_plasma_idle.smd" 0
smdanim "plasma primary" "hands_plasma_fire.smd" 240
smdanim "plasma secondary" "hands_plasma_fire.smd" 220
smdanim "plasma reload" "hands_plasma_reload.smd" 26.6

smdadjust Root -5 7.5 0
smdanim "sword" "hands_sword_idle.smd" 0
smdanim "sword primary" "hands_sword_attack1.smd" 66
smdanim "sword secondary" "hands_sword_attack2.smd" 106
smdanim "sword reload" "hands_sword_reload.smd" 40

smdadjust Root -5 2.5 0
smdanim "rocket" "hands_rocket_idle.smd" 0
smdanim "rocket primary" "hands_rocket_fire.smd" 240
smdanim "rocket secondary" "hands_rocket_fire.smd" 220
smdanim "rocket reload" "hands_rocket_reload.smd" 26.6

mdlscale 1680
Proceed to make a backup of your hwep.cfg and weapons folders. That way, all you have to do to switch back and forth is replace hwep.cfg and the weapons folder.
There. You’re all set to play Red Eclipse with your own guns.
Image Hosted by ImageShack.us
By jbo_aka_jnosko at 2012-05-31

20
points
 (2 votes)
User login
Users on Quadropolis
1 guest & no users online
20
points ]
 (2 votes)
Created 2016-07-28 12:06
3 years 35 weeks ago
afroninja
26
points ]
 (3 votes)
Created 2020-01-15 07:47
11 weeks 10 hours ago
7YearBitch
20
points ]
 (2 votes)
Created 2020-03-16 20:09
2 weeks 1 day ago
70
points ]
 (7 votes)
Created 2020-01-24 22:26
9 weeks 4 days ago
40
points ]
 (4 votes)
Created 2020-01-23 12:57
9 weeks 6 days ago
30
points ]
 (4 votes)
Created 2020-01-26 14:10
9 weeks 3 days ago
170
points ]
 (17 votes)
Created 2011-09-05 14:13
8 years 30 weeks ago
Sauce
71
points ]
 (8 votes)
Created 2018-08-22 19:15
1 year 31 weeks ago
Lord Kv
160
points ]
 (16 votes)
Created 2015-03-12 14:45
5 years 3 weeks ago
45
points ]
 (6 votes)
Created 2009-08-15 13:37
10 years 33 weeks ago
MisanthropX
74
points ]
 (8 votes)
Created 2019-12-05 20:57
16 weeks 5 days ago
Redon
105
points ]
 (11 votes)
Created 2019-10-24 21:41
22 weeks 5 days ago
10
points ]
 (1 vote)
Created 2019-10-26 11:09
22 weeks 4 days ago
25
points ]
 (3 votes)
Created 2019-10-11 23:29
24 weeks 4 days ago
10
points ]
 (1 vote)
Created 2019-10-16 01:26
24 weeks 16 hours ago
Gangler
37
points ]
 (4 votes)
Created 2019-10-10 16:26
24 weeks 6 days ago
34
points ]
 (4 votes)
Created 2019-10-08 02:25
25 weeks 1 day ago
5
points ]
 (1 vote)
Created 2019-10-08 13:32
25 weeks 1 day ago
Gangler
42
points ]
 (5 votes)
Created 2019-09-23 23:48
27 weeks 1 day ago
Fatality
39
points ]
 (4 votes)
Created 2019-09-28 02:57
26 weeks 4 days ago
Who's new
  • Antknee55
  • gmiz
  • impala97
  • Fixxxer
  • Gangler