Avatar deformation

From Second Life Wiki
Jump to: navigation, search

Taken from a Forum Post by Erluen Twin...

There seemed to be a need for a tutorial here, since I searched for this info and it was hard to find and piece together. I hope it hasnt been done already! This is how to stretch or shrink your avatar using animation files. This is most useful for making non-human avatars like dragons which have their shins much longer than their thighs, and their necks of course are in a very inconvenient place for a human avatar! Please correct me if Im wrong, but heres what I know:

To start, go to this page: [1] and download the zipped .bvh files. Open them as a TEXT DOCUMENT and have a look. Note especially the difference between TinyDeformForearmr and UnDeformForearmr. ("forearmr" means "right forearm")

The things to change are at the TOP and BOTTOM of the text file. The middle stuff should not be changed. At the top it says

>>.....ROOT rForeArm

You need to change the ROOT to whichever body joint you want to affect. ROOT rForearm will move the right elbow joint. It actually stretches the length of the upper arm. ROOT rHand will move the wrist join and will lengthen the forearm. Try to keep this in mind not to get confused!! You can't stretch the hand itself because there is no joint at the tips of the fingers, obviously.

Another way to keep it straight is to think of ROOT forearm as you grabbing the forearm with both hands and pulling it away from the body. the forearm wont stretch because your holding it, but the upper arm will stretch like rubber.

STEP 1: At ROOT lWhatever, delete "lWhatever" and type in "rForearm"

..................(eg ROOT rForeArm, ROOT Head, ROOT Chest) be careful of 
..................capital letters.

STEP 2:'At the bottom, youll see this:

>>  }
>>  Frames:	2
>>  Frame Time:	           0.033333
>>  0.000000 43.528519 0.000000 0.000000 0.000000 0.000000 0.000000 
>>  -0.075000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
>>   0
>>   0
>>   0

Look at the 2nd row of numbers you.

-0.075000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
...first x....second y....third z ..\nevermind the rest of these zeros/

The first 3 numbers are the x, y, z coordinates, as far as I can tell. So, the position of joint in space relative to parent joint is:

x    -0.075000      (length/shorten - this is pretty short, almost 0 for tiny AV.)
y     0.000000      (to the side of AV)
z     0.000000      (forward of back of AV)

I THINK that if you decrease the x value, (make it a more negative number) the right limb will stretch, but you should test it. This is for the RIGHT arm and RIGHT leg only. For the LEFT arm and leg, IN-creasing the x value (more positive) will stretch the arm.

Always compare it to the UnDeform file. The unDeform files have the "normal" values for an avatar.

NORMAL values for Av:

Right side : neg value  (eg -10.2 for right forearm)
Left side :  pos value  (eg 10.2 for right forearm)

In layman's terms, the elbow is 10 units away from the shoulder. On the left side, its in the LEFT direction which is positive. On the RIGHT side it's 10 units in the right direction which is negative. One unit might be 1 inch, but it seems different for every body part so dont take it as a rule.

Side note: For some reason, the left forearm has 3 lines of numbers I assume the 3rd line is the one to change, since it has anx value of 10.12 - similar to right ForeArm

Now, for the right arm, making it more negative than the "Normal value" will stretch it. Since the Normal Value is -10.266 (10 units of length going right) , lets change that to -60.00. (60 units of length going right)

  • Save the file as Deform_Right_Forearm.bvh (not .txt).
  • Go into SL.
  • Upload animation Deform_Right_Forearm.bvh
  • Find it in inventory
  • Play animation.

Viola - your right upper arm should be longer. about 6 times longer I think.

Stop Animation. Your arm will still be long. There are 2 ways to Normalize it.

  1. Upload UnDeformrForearm.bvh and play it.
  2. Relog.

Now you can deform any body part! There are 17 joints in all, so to deform every single aspect of your AV, you will need 17 animations.

I have a touch start script (with llRequestPermissions of course) which plays each animation in turn automatically. I have my deform button to contort me into a demonic bat-like creature, and an undeform button to go back to normal. It works very nicely.

One last hint: To save a few Lndens on uploading 100s of test animations, when you login to SL, press CTRL SHFT G. (or is it CTRL ALT G??) to get a pulldown menu of Grids. Then choose the 2nd grid Aditi where you can beta test all your animations for free. When you find the one perfect animation, you can log into SL proper (Grid named Agni) and upload for 10 lindens.

Now go deform yourself!!