Re: Finding the best pose to re-enter animation graph from ragdoll

Alex Lindsay <[email protected]> Thu, 13 Dec 2012 11:55:18 -0800
Newsgroups gmane.games.devel.algorithms
Message-ID <CAKPf5VN9oOx2a6hsUxnOgUKhVXrZ4axvdkURb37LrjaNAPpK9w@mail.gmail.com>
--===============8801475827370138176==
Content-Type: multipart/alternative; boundary=e89a8f83a34564543604d0c14b36

--e89a8f83a34564543604d0c14b36
Content-Type: text/plain; charset=ISO-8859-1

I figure you've got 3 normalized vectors:

dollForward = stomach of ragdoll vector, pointing along Y, downwards (not
sure if positive or negative)
dollUp = along spine towards head of ragdoll
recoveryForward = stomach of recovery pose

dollForward DOT recoveryForward will be near 1 if the doll is on its
stomach. The same dot can be run against other categories of recovery pose
for lying on side or back. Camera look-at style cross products with dollUp
and dollForward will get you 3 axes and from them, a quat or matrix to
apply to the recovery pose root, or take vectors to or from 'doll space' to
'recovery space' to match other limbs against your
recovery-poses-on-stomach db.

Just writing aloud, hope it helps!



On Thu, Dec 13, 2012 at 11:39 AM, Jeff Russell <[email protected]> wrote:

> There are probably a number of ways to do it. My first guess would be to
> compute the difference in rotation for the root bone (that is, what
> rotation takes you from your starting frame to the current ragdoll
> orientation), and then examine the "up" vector of the resulting transform.
> If it's too far from vertical, you don't have a very good match. You can
> compute a score perhaps based on the dot product between the "up" basis of
> this transform and the global up direction.
>
>
> On Thu, Dec 13, 2012 at 1:22 PM, Richard Fine <[email protected]> wrote:
>
>> Hi all,
>>
>> I've got a ragdolled character that I want to begin animating again.
>> I've got a number of states in my animation graph marked as 'recovery
>> points', i.e. animations that a ragdoll can reasonably be blended back
>> to before having the animation graph take over fully. The problem is,
>> I'm not sure how to identify which animation's first frame (the
>> 'recovery pose') is closest to the ragdoll's current pose.
>>
>> As I see it there are two components to computing a score for each
>> potential recovery point:
>>
>> 1) For each non-root bone, sum the differences in parent-space rotation
>> between current and recovery poses. This is simple enough to do; in
>> addition I think I need to weight the values (e.g. by the physics mass
>> of the bone), as a pose that is off by 30 degrees in the upper arm
>> stands to look a lot less similar to the ragdoll's pose than one that is
>> only off by 30 degrees in the wrist. The result of this step is some
>> kind of score representing the object-space similarity of the poses.
>>
>> 2) Add to (1) some value representing how similar the root bones are.
>> The problem I've got here is that I need to ignore rotation around the
>> global Y axis, while still accounting for other rotations. (I can ignore
>> position as well, as I can move the character's reference frame to
>> account for it).
>>
>> Suppose I have a recovery pose animation that has been authored such
>> that the character is lying stretched out prone, on his stomach, facing
>> along +Z. If the ragdoll is also lying stretched out prone on his
>> stomach, facing -X, then the recovery pose is still fine to use - I just
>> need to rotate the character's reference frame around the Y axis to
>> match, so the animation plays back facing the right direction. But, if
>> the ragdoll is lying on his back, or sitting up, then it's not usable,
>> regardless of which direction the character's facing in. So, I've got
>> the world-space rotation of the ragdoll's root bone as a quaternion, and
>> a quaternion representing the rotation of the corresponding root bone in
>> the recovery pose in *some* space (I think object-space, but I'm not
>> sure?) as starting points. What can I compute from them that has this
>> ignoring-rotation-around-global-Y property?
>>
>> It's been suggested there there's some canonicalization step I can
>> perform that would just eliminate any Y-rotation, but I don't know how
>> to do that other than by decomposing to Euler angles, and I suspect that
>> would have gimbal lock problems.
>>
>> This is probably some pretty simple linear algebra at the end of the
>> day, but between vague memories of eigenvectors, and a general
>> uncertainty as to whether I'm just overcomplicating this entire thing, I
>> could use a pointer in the right direction. Any thoughts or references
>> you could give me would be much appreciated.
>>
>> Cheers!
>>
>> - Richard
>>
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________
>> GDAlgorithms-list mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> Archives:
>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>>
>
>
>
> --
> Jeff Russell
> Engineer, Marmoset
> www.marmoset.co
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> GDAlgorithms-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>

--e89a8f83a34564543604d0c14b36
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I figure you&#39;ve got 3 normalized vectors:<div><br></div><div>dollForwar=
d =3D stomach of ragdoll vector, pointing along Y, downwards (not sure if p=
ositive or negative)</div><div>dollUp =3D along spine towards head of ragdo=
ll</div>
<div>recoveryForward =3D stomach of recovery pose</div><div><br></div><div>=
dollForward DOT recoveryForward will be near 1 if the doll is on its stomac=
h. The same dot can be run against other categories of recovery pose for ly=
ing on side or back. Camera look-at style cross products with dollUp and do=
llForward will get you 3 axes and from them, a quat or matrix to apply to t=
he recovery pose root, or take vectors to or from &#39;doll space&#39; to &=
#39;recovery space&#39; to match other limbs against your recovery-poses-on=
-stomach db.</div>
<div><br></div><div>Just writing aloud, hope it helps!</div><div><br></div>=
<div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Thu, Dec 1=
3, 2012 at 11:39 AM, Jeff Russell <span dir=3D"ltr">&lt;<a href=3D"mailto:j=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</span> wrote:<b=
r>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">There are probably a number of ways to do it=
. My first guess would be to compute the difference in rotation for the roo=
t bone (that is, what rotation takes you from your starting frame to the cu=
rrent ragdoll orientation), and then examine the &quot;up&quot; vector of t=
he resulting transform. If it&#39;s too far from vertical, you don&#39;t ha=
ve a very good match. You can compute a score perhaps based on the dot prod=
uct between the &quot;up&quot; basis of this transform and the global up di=
rection.<div class=3D"HOEnZb">
<div class=3D"h5"><br>

<br><div class=3D"gmail_quote">On Thu, Dec 13, 2012 at 1:22 PM, Richard Fin=
e <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank"=
>[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" =
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi all,<br>
<br>
I&#39;ve got a ragdolled character that I want to begin animating again.<br=
>
I&#39;ve got a number of states in my animation graph marked as &#39;recove=
ry<br>
points&#39;, i.e. animations that a ragdoll can reasonably be blended back<=
br>
to before having the animation graph take over fully. The problem is,<br>
I&#39;m not sure how to identify which animation&#39;s first frame (the<br>
&#39;recovery pose&#39;) is closest to the ragdoll&#39;s current pose.<br>
<br>
As I see it there are two components to computing a score for each<br>
potential recovery point:<br>
<br>
1) For each non-root bone, sum the differences in parent-space rotation<br>
between current and recovery poses. This is simple enough to do; in<br>
addition I think I need to weight the values (e.g. by the physics mass<br>
of the bone), as a pose that is off by 30 degrees in the upper arm<br>
stands to look a lot less similar to the ragdoll&#39;s pose than one that i=
s<br>
only off by 30 degrees in the wrist. The result of this step is some<br>
kind of score representing the object-space similarity of the poses.<br>
<br>
2) Add to (1) some value representing how similar the root bones are.<br>
The problem I&#39;ve got here is that I need to ignore rotation around the<=
br>
global Y axis, while still accounting for other rotations. (I can ignore<br=
>
position as well, as I can move the character&#39;s reference frame to<br>
account for it).<br>
<br>
Suppose I have a recovery pose animation that has been authored such<br>
that the character is lying stretched out prone, on his stomach, facing<br>
along +Z. If the ragdoll is also lying stretched out prone on his<br>
stomach, facing -X, then the recovery pose is still fine to use - I just<br=
>
need to rotate the character&#39;s reference frame around the Y axis to<br>
match, so the animation plays back facing the right direction. But, if<br>
the ragdoll is lying on his back, or sitting up, then it&#39;s not usable,<=
br>
regardless of which direction the character&#39;s facing in. So, I&#39;ve g=
ot<br>
the world-space rotation of the ragdoll&#39;s root bone as a quaternion, an=
d<br>
a quaternion representing the rotation of the corresponding root bone in<br=
>
the recovery pose in *some* space (I think object-space, but I&#39;m not<br=
>
sure?) as starting points. What can I compute from them that has this<br>
ignoring-rotation-around-global-Y property?<br>
<br>
It&#39;s been suggested there there&#39;s some canonicalization step I can<=
br>
perform that would just eliminate any Y-rotation, but I don&#39;t know how<=
br>
to do that other than by decomposing to Euler angles, and I suspect that<br=
>
would have gimbal lock problems.<br>
<br>
This is probably some pretty simple linear algebra at the end of the<br>
day, but between vague memories of eigenvectors, and a general<br>
uncertainty as to whether I&#39;m just overcomplicating this entire thing, =
I<br>
could use a pointer in the right direction. Any thoughts or references<br>
you could give me would be much appreciated.<br>
<br>
Cheers!<br>
<br>
- Richard<br>
<br>
---------------------------------------------------------------------------=
---<br>
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial<br>
Remotely access PCs and mobile devices and provide instant support<br>
Improve your efficiency, and focus on delivering more value-add services<br=
>
Discover what IT Professionals Know. Rescue delivers<br>
<a href=3D"http://p.sf.net/sfu/logmein_12329d2d" target=3D"_blank">http://p=
.sf.net/sfu/logmein_12329d2d</a><br>
_______________________________________________<br>
GDAlgorithms-list mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list" =
target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/gdalgorithms=
-list</a><br>
Archives:<br>
<a href=3D"http://sourceforge.net/mailarchive/forum.php?forum_name=3Dgdalgo=
rithms-list" target=3D"_blank">http://sourceforge.net/mailarchive/forum.php=
?forum_name=3Dgdalgorithms-list</a><br>
</blockquote></div><br><br clear=3D"all"><div><br></div></div></div><span c=
lass=3D"HOEnZb"><font color=3D"#888888">-- <br>Jeff Russell<br>Engineer, Ma=
rmoset<br><a href=3D"http://www.marmoset.co" target=3D"_blank">www.marmoset=
.co</a><br>

</font></span><br>---------------------------------------------------------=
---------------------<br>
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial<br>
Remotely access PCs and mobile devices and provide instant support<br>
Improve your efficiency, and focus on delivering more value-add services<br=
>
Discover what IT Professionals Know. Rescue delivers<br>
<a href=3D"http://p.sf.net/sfu/logmein_12329d2d" target=3D"_blank">http://p=
.sf.net/sfu/logmein_12329d2d</a><br>_______________________________________=
________<br>
GDAlgorithms-list mailing list<br>
<a href=3D"mailto:[email protected]">GDAlgorithms-lis=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list" =
target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/gdalgorithms=
-list</a><br>
Archives:<br>
<a href=3D"http://sourceforge.net/mailarchive/forum.php?forum_name=3Dgdalgo=
rithms-list" target=3D"_blank">http://sourceforge.net/mailarchive/forum.php=
?forum_name=3Dgdalgorithms-list</a><br></blockquote></div><br></div>

--e89a8f83a34564543604d0c14b36--


--===============8801475827370138176==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
--===============8801475827370138176==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
--===============8801475827370138176==--