Difference between revisions of "Avatar deformation"

From Second Life Wiki
Jump to navigation Jump to search
m (minor cleanup)
(Perform draft update to cover both methods of deformation (this will be improved later, but contains enough info to be useful))
Line 1: Line 1:
== Methods ==
In Second Life, there are 2 ways you can deform an avatar, each with advantages and disadvantages:
* By using an animation: This is generally the preferred way to do deformations, as should something go wrong, it's much easier for the user to debug and recover from.
* By using rigged mesh: Second Life allows you to upload rigged mesh with associated joint positions - This means that when an avatar equips a rigged mesh object that contains joint positions, their avatar will deform to meet the given positions.
=== Method 1: Animation ===
Taken from a Forum Post by Erluen Twin...
Taken from a Forum Post by Erluen Twin...


Line 89: Line 96:


One last hint:
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.
To save a few Lindens 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!!
Now go deform yourself!!
=== Method 2: Rigged Mesh ===
'''The below description uses nomenclature that may be specific to Blender, so your modelling program of choice may use different terminology, however the general process should be the same.'''
Start with the Bento reference skeleton. ! IMPORTANT: Make sure that the skeleton is orientated in such a way that the +X axis is forward, and the +Z axis is up. Make sure to apply any and all transforms you make before continuing. !
Create an object (e.g. a cube), and weight it to the bone to be deformed. (Repeat process if more than one bone will be deformed).
Move the bone.
Apply the transform as the rest pose.
Export DAE, making sure that all the appropriate settings are correct for export to SL.
Go to the mesh model uploader in SL - select your model, and make sure to check "Include Joint Positions" under the Rigging tab.
Verify that the joints in question have received deforms, by checking if a numerical value has been provided under "Joint Position overrides for [bone]".

Revision as of 04:07, 31 May 2022

Methods

In Second Life, there are 2 ways you can deform an avatar, each with advantages and disadvantages:

  • By using an animation: This is generally the preferred way to do deformations, as should something go wrong, it's much easier for the user to debug and recover from.
  • By using rigged mesh: Second Life allows you to upload rigged mesh with associated joint positions - This means that when an avatar equips a rigged mesh object that contains joint positions, their avatar will deform to meet the given positions.

Method 1: Animation

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

>>.....HIERARCHY
>>.....ROOT rForeArm
>>.....{
>>............etc 

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:

>>  }
>>  MOTION
>>  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 Lindens 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!!

Method 2: Rigged Mesh

The below description uses nomenclature that may be specific to Blender, so your modelling program of choice may use different terminology, however the general process should be the same.

Start with the Bento reference skeleton. ! IMPORTANT: Make sure that the skeleton is orientated in such a way that the +X axis is forward, and the +Z axis is up. Make sure to apply any and all transforms you make before continuing. !

Create an object (e.g. a cube), and weight it to the bone to be deformed. (Repeat process if more than one bone will be deformed).

Move the bone.

Apply the transform as the rest pose.

Export DAE, making sure that all the appropriate settings are correct for export to SL.

Go to the mesh model uploader in SL - select your model, and make sure to check "Include Joint Positions" under the Rigging tab.

Verify that the joints in question have received deforms, by checking if a numerical value has been provided under "Joint Position overrides for [bone]".