Cleanup is going to take awhile, so the site is back up but editing has been disabled.
Skinning and Animating for source with MAYA
From HalfLife 2 Knowledge Base
Contents |
Skinning and Animating for source with MAYA by Prall
setup
first grab skinningtools and copy them in your /maya 6.0 (or whatever version)/scripts/ folder http://www.davidwalden.com/mel/skinningTools.mel
copy sdk/maya 4.5/scripts files to the same maya scripts folder
type skinningTools; in the maya command line and MMB drag and drop it into a shelf so u have that
command as a button
you should have the smd import and export scripts in the file menu
skinning
open up the model you wanna animate...this is just about simple animations, if you want advanced stuff like player models you should import existing models/animations and check how they are done but thats another story
ill use a helicopter for this tut...all modeling, UV mapping, texturing and normal checks are already done and all parts are combined to one big poly mesh
to animate it select the joint tool
place some bones inside your model as you think might fit...you can use up/down keys to "walk" through the bone hirarchy to make "branches"
if you have end joints controling something with theyr rotation (like my rotor) it must be oriented correctly.. select the "tool options" (1) and with the "select tool" (A) in "object mode" (b) select the joint (2) you want to rotat and change the "joint orient" (3) values
same goes for the other rotor
the joints in between are oriented to the next joint along the bone so no need to change that
now select the root joint and shift select the mesh
in "animation mode" (1) select "skin"->"bind skin"->"smooth bind" options
in the smooth bind options window select complete skeleton (you should allways use that) closest joint (sometimes closest distance helps on arms or something but not that much difference) max influences 1 (we want rigid style bind so just one bone influence...hl2 supports up to 4 for smooth deformations) dropof 0,1 (the smallest possible...its the dropof distance for the weight of a bone....most times you change that anyway by hand to get the best deformation)
then hit bind skin
now if you rotate the root bone the mesh should follow
to modify the weighting select your mesh and open up skinning tools with the button in your shell
select the mesh (1) and you should see the assigned bones in skinningtools
click on the first joint (2) and click the paint skin weights tab (3)
this will show you the assigned weight of the selected bone...white is 1 (100%) black is 0 (0%) you could use the paint tools in this tab now to paint around but in this case we will use just 100% or 0% weighting (no smooth) and you should do this even if you want to smooth everything later
first we select the root joint in skinning tools and in "component mode" (A) with "points" (B) selected and all others deselected we select all points (verts) from the mesh and klick the + sign (1) this will add 100% weight from the root bone to the complete mesh
since maya acts a bit weird when painting weights (it uses some normalisation so you sometimes get bad results if you paint values of 0) you should allways hold weights you dont want to change...so right click on the root joint in skinning tools and hold it (2)..we still can remove points by giving them weight from other bones but we wont automatically add points to this bone by removing weight on them from other bones kinda confusing but thats maya LOL
now with the next bone selected (its the one for main rotor) i start selecting /shift selecting points from the rotor when i think i got all i klick on the big + (1) to add 100% weight of joint2 to them (remember max influences is 1 and max influence is 1(100%) so they are now all controlled by this joint...use rotate joint sliders (3) to see if it deforms correct...if you missed some points just select them and add them with +....when this joint is done hold it like the first joint and go on to the next joint
same goes for the second rotor...joint3 in my case is just a dummy bone and gives no weight to the mesh
simple animation
for rotor rotation i use a little mel expression
to do this select the joint you want to animate (1) in "object mode" and open "channel mode" (2), click on the attribute you want to animate and when its hilighted right click on it and in the popup list select "expressions" to open the expressions editor
in the expressions window leave everything at default (correct attribute is already selected) and add this expression
joint2.rotateZ = time * 800;
the attribute name is copied (see pic), time is the animation time....times 800 to make it a bit faster...you can see the values changing in the channel window when you play the animation so you can fine tune it
i wanted the helicopter to hover around so on to some lame keyframe animation :)
select the joint you want to animate
in the channel window shift select the attributes you want to animate (1) and right klick on them...in the popup list select "key selected"
now you have one key at frame 0
select autokey (2) now maya will keyframe whenever you change a keyed attribute
go some frames forward with the playback controls (5) or with the timeslider (4)
select rotation or translation tool (3) (hotkey "R" and "E") move and rotate it a bit around with the manipulator (can be scaled with +/- for finer control)
if you want a looped animation make the last frame the same as the first....easiest way is Zkey script you can get from highend3d.com there are also alot other usefull scripts
you can change the animation curves tangents in the graph editor... open a 2 panel view (1) click on panels->panel->graph editor (2) there you can MMB drag the points around or give exact values and change tangent types...on loops the should be flat (3)
ofcourse maya has alot more animation tools but i cant explain all this now ;)
export
first save your project in a /scenes/ folder (export script needs that) give your model a phongE texture and use a tga file in a /materialsrc/ folder (export script needs that)
then file->export SMD options
for the reference smd check the checkbox (1) and click ok settings..make sure to set the time range to 1 (pic 9 pos 4) for the animation smd uncheck the checkbox (1) and click ok settings to export the set time range
if you imported a skeleton make sure you check the bone names in your smd files after exporting...maya might have changed dots to undescore or removed spaces or whaever it wanted to LOL ;)
copy the files from the /smd folder of your current project to the model_sources folder, make a qc file like
// Output .MDL $modelname uh60skin.mdl // Directory of .BMP $cdmaterials models/ $scale 1.0 // whole body $body studio "./uh60skin" // sequences: $sequence rot "uh60rot" loop fps 60 $sequence hov "uh60hov" loop fps 30
and compile it....thats it....now you could use a prop_dynamic_override or whatever and set its default animation to one of the animation sequences

