Jump to content

Constraints - What are they and why you should care


You are about to reply to a thread that has been inactive for 73 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

TLDR: SecondLife supports many of the advanced animation techniques of modern games - But we just don't take advantage of it.

The Basics

The majority of uploaded animations are in a format where each bone along a chain of bones has a fixed rotation value - This is commonly referred to as an FK animation.

FK Animations are OK for single poses - But they have flaws with couple poses. For example when you want to hold hands with someone else, more often than not your hands will not line up with your partners, because the rotation of each bone needed for the hands to meet each other changes depending on each avatar's shape, but the FK animation has fixed rotations:

fk_animations.png.15dd23cf86001edb5bee864fa13723ab.png

IK Animations work different, instead of controlling the rotation of the bones individually, they control the target - The bones rotate dynamically to get the limb into the target position. In our hand holding case, if both hands target the same fixed point in space, the avatars would always* hold hands, no matter which size they are.

*Unless the size difference is so big they cannot physically reach each other

Constraints - How they work

Most people are not aware, but SL's animation system does support IK animations in its own special way, it's just not well-documented, and we lack popular creators tools that can make them. Blender's Avastar lets you pose an avatar using IK controls but the exported animations are always FK.

Lets say you want to put your hand on your head. The 'Source' is R_HAND and the 'Target' is HEAD. If this was all our hand would go inside our head, but we also have an 'Offset' that can move the hand to a set offset so it is offset from the head. The target is then relative to the head. Now no matter how long or short your arms are, your hand will pretty much always end up on the side of your head, and never clip through it.

SecondLife's animation format supports many targets for constraints including PELVIS, BELLY, CHEST, NECK, HEAD, L_CLAVICLE, L_UPPER_ARM, L_HAND, R_CLAVICLE, R_UPPER_ARM, R_LOWER_ARM, R_HAND, R_UPPER_LEG, R_LOWER_LEG, R_FOOT, L_UPPER_LEG, L_LOWER_LEG, L_FOOT. You can target joints to move relative to all of those places. But there's one special one...

The GROUND Constraint and why we should be asking for it

You see, it turns out that those clumsy default animations we all rush to replace are some of the most advanced animations in all of SecondLife

Screenshot_1478.png.a17f19ad840dd131cb47275f04f40d9a.png

See how the feet respond to the incline of the ground? The original SecondLife developers added code into the viewer support for targeting GROUND - And they used it, in the first (albeit clumsy) animations ever. The viewer can detect where the ground is, and adjust animations that are relative to ground accordingly.

What's this got to do with hand holding? Well, when you are able to target limbs to an offset relative to a fixed position such as the ground, you can do things kinda like this:

relative_to_ground.png.d4d8a7b891b341e1ee67aae691329e2d.png

 

Both Avatar's hands will always connect because the constraint target position is set in such a way that both avatar's targets end up in the same place.

Why am I telling you all of this?

Well, I started working on a tool to make use of the constraints feature of SecondLife. But I've run into some issues.

  1. Firstly, even though the SecondLife viewer supports the GROUND constraint, and the viewer uses animations that use the GROUND constraint by default - The animation uploader does not recognize animations that use this constraint - And that's a real bummer! I think that with this constraint we could honestly make the posing experience in SecondLife so much better for couples as you would rarely need to adjust a pose ever again.
  2. I want to be able to make AO's and animations where arms and limbs don't tend to clip through the body depending on shape. Constraints would help achieve this. Animations that *ahem* self-touch would be much accurate too. The trouble here is a lack of third party support for constraints as far as I can see.

My hope by writing and illustrating all of this and sharing it is that it raises awareness, maybe in the future we could get tools that take advantage of this, and maybe someone at LL will update the uploader to allow GROUND to work!

 

  • Like 1
Link to post
Share on other sites
8 hours ago, Extrude Ragu said:

Why am I telling you all of this?

Well, I started working on a tool to make use of the constraints feature of SecondLife. But I've run into some issues.

I contacted you in world about this.  I know it seems like you have a new discovery but there are those of us who have known this for years.  If you want more information about the subject then don't ignore my messages.  If you're going forward with this then please, by all means, I'll point people to your product as I told you in-world.  I'd be happy to stop work on mine and let you handle this issue.

At the very least you aught to be interested in picking brains that have been here already.  I don't know why you choose to ignore me but, whatever.

Well, maybe you didn't ignore me, maybe IM's are getting goofed up too. *shrugs*

Good luck and have fun \o

Edited by BinBash
  • Confused 1
Link to post
Share on other sites

This was brought up recently with this and that bug report.

There are several limits with constraints in SL's animation protocol.

In the "hand holding" scenario, you're limited to targeting an offset of ground at either a local point or local plane.

And that constraint is active for the entire animation.

This may be fine for posing, but also most likely means you won't be doing much movement with the rest of the body like in couples dances.

It might work for pole dancing as long as said dance requires the user to keep a hand on the pole at all times.

The alternative is to time turning on/off hand/arm animations with constraints during a primary animation sequence.

This is a big problem when we don't have global start time referencing, only starting upon CDN download and/or entry to the interest list.

Another gripe is no targeting outside the user's own skeleton, such as targeting the bone of another user or animesh character and targeting a global position.

The latter is possible through the "head_rot", "editing" & "target" system animations only. It would be nice if we could somehow make use of these animations through a script function with global position/rotation inputs/limits/weighting/overrides.

 

 

Edited by Lucia Nightfire
Link to post
Share on other sites
9 hours ago, BinBash said:

I contacted you in world about this.  I know it seems like you have a new discovery but there are those of us who have known this for years.  If you want more information about the subject then don't ignore my messages.  If you're going forward with this then please, by all means, I'll point people to your product as I told you in-world.  I'd be happy to stop work on mine and let you handle this issue.

At the very least you aught to be interested in picking brains that have been here already.  I don't know why you choose to ignore me but, whatever.

Well, maybe you didn't ignore me, maybe IM's are getting goofed up too. *shrugs*

Good luck and have fun \o

Sorry I missed your IM, it's nothing personal.

Right now I'm just writing a very basic tool to hack .anim files which I will make available once I'm happy it's working OK. I think in the long term it would be better to get tools into Blender etc to use these. I've written Blender plugins before so I might have a go but not sure yet. In my ideal world it'd be in Avastar itself.

5 hours ago, Lucia Nightfire said:

In the "hand holding" scenario, you're limited to targeting an offset of ground at either a local point or local plane.

And that constraint is active for the entire animation.

I'm not sure if this is true, from my understanding of it after I wrote a parser for these files, each constraint has a specific defined time when they start and stop

image.thumb.png.2b218d1eb2ad9ec2788409ffed537855.png

At least as I understand it, many constraints can be defined, and each constraint is eased in from easeInStart and starts at  easeInStop, and eases out from easeOutStart to easeOutStop. So in the pole dance scenario, you would presumably simply ease out whenever you wanted to detach the hand from the pole.

Since we can have many constraints, I wonder if it is possible then to ease out from one constraint directly into another

Once I get my tool working I will try making some crude animations and post results :)

Edited by Extrude Ragu
typo
  • Like 1
  • Thanks 1
Link to post
Share on other sites
  • 3 weeks later...

I wrote AnimHacker to try to get a better understanding of the internal SecondLife animation format and play around with it.

So I'm messing with Blender, figuring out how a Blender plugin could be developed to extend Avastar to support SecondLife animation constraints

Blender has it's own constraints system, but it is far more advanced than the constraints SecondLife has, but I think it could still be used to generate SecondLife constraint animations...

image.thumb.png.1d150a8b15bd31dd1fee7cc04b98c5bc.png

So the IK constraint on the right here, it's taking the left wrist and targetting the left foot (I rotated the foot manually without constraints), to get this to work I had to select the Avatar armature for the target, which  revealed a hidden 'Bone' control, where I could then select the foot..

Looking at the Blender Constraints system, I think that the parameters map onto the SecondLife format like this:-

 

image.thumb.png.5b9996db24a22ee0f4d8ca08fe4a8137.png

One thing I'm not sure about is how constraint_type affects the animation and could be replicated in Blender

There's also target_offset and source_offset which the IK Constraint doesn't have in Blender. But perhaps this could be done by making a copy of the relevant bone in Blender and then taking the offset value?

What I'm thinking is if I were to develop a Blender plugin and have some sort of dumbed down UI for setting up constraints, that lets you set them up in a SecondLife specific way, and perhaps a .anim exporter or a utility that exports the constraint data and lets you append it to an .anim file exported from Avastar.. Could prove useful?

Edited by Extrude Ragu
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 73 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...