{"id":170,"date":"2013-01-16T07:30:57","date_gmt":"2013-01-16T12:30:57","guid":{"rendered":"http:\/\/sugarandcyanide.com\/blog\/?p=170"},"modified":"2013-01-16T07:32:39","modified_gmt":"2013-01-16T12:32:39","slug":"spline-ik-overshoots","status":"publish","type":"post","link":"http:\/\/sugarandcyanide.com\/blog\/2013\/01\/16\/spline-ik-overshoots\/","title":{"rendered":"spline IK overshoots"},"content":{"rendered":"<p>I&#8217;m constantly attempting new setups in rigging. Usually this is out of necessity, such as when current scripted setups don&#8217;t behave reliably or deliver the desired result with new models. Other attempts are me exploring things about my setups with which I&#8217;m not one hundred percent satisfied. I&#8217;ll keep doing research until I find a setup that works as I feel it should in the majority of situations, stably and predictably.<\/p>\n<p>Stretchy Spline IK is something I&#8217;ve never liked because of the way its chains overshoot the end of the curve when the spline&#8217;s curvature is too great. I&#8217;ve never worked in a studio that had its own custom Spline IK solver, where this problem is non-existent, so I research solutions whenever I hit the issues that stretchy splines always bring.<\/p>\n<p>Recently I had a thought about using live sub-curves of a spline (using the Maya subCurve node). I&#8217;ve always figured that the overshoots are due to floating point rounding and the fact that measuring a nurbs curve is an inexact science; curves are sub-samples a few thousand times, and the distances between points are summed.<\/p>\n<p>(Before you ask, I use splines because they&#8217;re easy and light when you need to be able to lock a chain to a minimum or maximum length, but still allow stretching. I have not found a fast way of doing the same using a nurbs ribbon.)<\/p>\n<p>I wrote a custom node to extract sub-curves by length along the original curve (using MFnNurbsCurve::findParamFromLength), then attached joints to each subCurve with Spline IK. I figured that sub-curves made by length would lock each joint in place, and that somehow this would work around the overshoot issue.<\/p>\n<p>Boy was I wrong.<\/p>\n<p>Turns out the assumption I&#8217;ve had for a while&#8211; the same assumption I&#8217;ve heard from other riggers&#8211; was itself incorrect. It&#8217;s not that the lengths aren&#8217;t being measured accurately enough, but that as the spline curves in on itself, the effective lengths of bones on it should shrink because the bones can&#8217;t bend to match. Obvious in hindsight, but it caught me by surprise. It&#8217;s like Manhattan Distance: in Euclidean space you may only be two kilometers from that pizzeria you love, but you end up walking three kilometers to get there because Euclidean distance doesn&#8217;t take into account the fact that we can&#8217;t pass through buildings. (Or: that sewers are winding and not always as easy to traverse as the city streets for your average turtle.)<\/p>\n<p>On the up side I can think of a few good uses for the sub-curve node I made, so the experiment wasn&#8217;t a total loss. I also have a few ideas of how to use the curvature of the driving spline to come up with a scale value, meaning I have new experiments to carry out.<\/p>\n<p>The test proved to me again that it never hurts to pull apart an established method in an attempt to do it better. &#8220;White belt mind,&#8221; a teacher of mine used to say&#8211; try to never lose that initial state we all have when we begin something new and are constantly trying to learn.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m constantly attempting new setups in rigging. Usually this is out of necessity, such as when current scripted setups don&#8217;t behave reliably or deliver the desired result with new models. Other attempts are me exploring things about my setups with which I&#8217;m not one hundred percent satisfied. I&#8217;ll keep doing research until I find a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,16],"tags":[54,65,69],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-maya","category-rigging","tag-experiments","tag-maya","tag-rigging"],"_links":{"self":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":0,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"wp:attachment":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}