Skeletal Morphing allows for the skeleton of a character to be morphed into a new shape. It must be setup by artists in a 3D Modeller, and then HeroEngine will automatically re-map animations as needed, to adjust to the proper proportion for that skeleton.
Essentially, if the body morphs in a way that changes limb proportions, then the underlying skeleton that drives the character must have an equivalent morph target as well. For body morphs that are minor, this isn't strictly necessary, but the more extreme changes will need them. For example, if you have a body morph that is dwarf-sized with dwarf proportions, this would clearly be quite different than the mean (average) body shape. On the other hand, a morph that adjusts the flabbiness of the stomach doesn't need a new skeleton.
By morphing the skeleton, animations will be remapped to the new proportions by HeroEngine automatically.
Skeletal morphing simply changes the position (and thus length) of bones in a skeleton, not the topology. You cannot add or remove bones in this manner. Further, you will still want to maintain the basic shape and posture of the character to some degree, or your animations will not play back as you expect.
|Note: Before you get started, make sure you're using body morphing and that at least one of your body morphs changes the proportions of your character. If you don't meet both of these criteria, you don't need skeletal morphing.|
Skeletal morphing is relatively straightforward to set up. First, create a base body statistic for the character. For details on this, first see Base Statistic Initial Setup.
- In your 3D modeller, open the version of the full-body mesh thn-changing control). Make the skeleton fit this mesh without changing the number or parenting of the bones. Export the reshaped skeleton (as you do for dynamic characters).
- Add a SkeletalMorph line to the character's .dyc file. Pick a name to refer to this skeleton (from this point on, we'll refer to it as MorphName). Fill in your path to the skeleton, like so:
- If this is your first skeletal morph for this character, add a MorphName to the base skeleton (Skeleton property), too.
Skeleton[Human]=BaseSkeleton.gr2, where Human is the MorphName for the base version of the character.
skeleton:MorphNamesomewhere in the keyword for your new MorphName control in facegen.dat.
At this point, the engine knows all about the skeletons you've specified; however, every character you create will have the default blend weights of 100% for the base skeleton (the one specified with the Skeleton property) and 0% for every other skeleton (the ones specified by the SkeletalMorph property) until you (or a user) change them. See the next section for details on how to do that.
Normally, skeletal morph data is loaded from the server via the SkeletonBlendCollection field on the _CharacterAppearance class, and then automatically applied to client-side characters. You can change a character's current skeletal morph values through HSL and then propagate those changes up to the server when you're done. Here's how:
GetBodyRaces()to get the names of all of the skeletons that can be blended.
- (Optional) For each of the names returned in the last step, call
GetBodyRaceBlend()to get the current blend weight for the given skeleton.
SetBodyRaceBlends()if setting blend weights for multiple skeletons at once) to set new blend weights for the skeleton(s) of your choice. Only use
SetBodyRaceBlend()if you need to set one and only one skeleton blend; otherwise, use
SetBodyRaceBlends(), as it's much more optimal.
Tip: In general, you'll want all of your skeleton blend weights to sum to 1.0 for a pleasing looking character. SetBodyRaceBlend() will take care of this for you, but you'll need to do it manually when using SetBodyRaceBlends(). You may want to experiment and see what effects you get by having weights that sum to some other number.
SendModelUpdate()to apply the skeletal morph changes on the server, if applicable.