Spline type of setup for extra long tongue

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  12 December 2012
Spline type of setup for extra long tongue


I'm working on a lizard type of character that has very long tongue. Problem is that if i use regular spline ik tool I have very limited control for the twisting even with advanced twist control. The thing is that i need to control the twist separately on different spots on the joint chain. Some uses this twist ramp value type but i havent figured how to utilize that well enough. Im not even sure if that could do the trick for me. Also the advanced twist controls 180 degree limit is deal breaker for me.

I know how to build basic ribbon setup but i like the behavior of the spline ik that the joints follow the curve. It makes very natural tongue motion easily when combined with squash and stretch.

So is there a way to get this work so i could have the spline ik behavior and full control for the twist?
  12 December 2012
Well, i figured it pretty quickly myself. Not sure if it's the best way to do it tho, atleast it works and it shouldnt be too difficult to animate.

I made a test scene where i have a simple spline ik setup. I parented an extra joint on top of each joint in the spline chain. Then i made a twist attribute for each controller and connected them to the x rotations of the extra joints. Then i had some multiplyDivide/addDoubleLinear stuff going on for the joints between the controllers. I got the squash and stretch to work with the extra joints aswell. The extra joints were used for the skinning.

This would take a while to build if there's lots of joints in the chain. Maybe some script could speed things up.

Would be great to know if there's some other practical ways of doing this.

Dont hesitate to ask if you want to know more how i did it so this wont be totally useless thread.
  12 December 2012
Sounds like an interesting rig. I'd be curious to see some screenshots or a cut-down example file if you were able to post them.

  12 December 2012
Sure, i'll take couple of screenshots from the viewport and node editor and explain how its done when i get some free time. I'll cleanup the test scene and put into dropbox aswell.

It's pretty simple setup actually.

Last edited by GoodAsNew : 12 December 2012 at 09:31 PM.
  12 December 2012
Cool thanks, simple setups are often the best ones!

  12 December 2012

I expect people to know atleast something about rigging before trying this out. Atleast knowing what spline ik is and how it works.

I'll explain how to make the twist controls to work and how to add automatic squash and stretch on top of it. If it's too hard to follow there's some screenshots below this nonsense. Wouldn't hurt to check some tutorial about squashNstretch if it's totally new thing.

Here's the scene file if someone wants to reverse engineer it. I won't keep it there forever tho.
This is done with student version so you'll probably get the annoying warning text when you open it.

1. Make a basic spline setup with something like 3 controllers and 5 or 6 joints. (keep its simple for testing)
2. Make an extra joint for each joint you have in your spline chain.
3. Parent each of them to the spline joints. This is to make the twist rotation values totally independent from the spline rotation values. No gimbal locks and what not.
4. Bind the geometry to the twist joints. (not the spline joints).
5. Add twist 1, 2 and 3 attributes to one of the controller objects.
6. Now make some connections in node editor or hypershade. Connect twist 1, 2 and 3 straigth to twist joint 1, 3 and 5 rotateX.
7. Maya automatically creates an unit conversion node between the connections. only thing it does is multiplies the twist value for radian conversion. The value should be something like 0.017. take the one decimal off to make its 0.17 so its easier to manipulate in channel box.
8. Now you need to distribute the twist attribute values for each joints in between these 1,3 and 5 joints. In this case it's simple because you only have 1 joint between them. for twist joint 2 you make 2 unitConversion nodes. connect the twist 1 and twist 2 to these unitConversion nodes. Change the multipliers for both to 0.5.
9. Then make an addDoubleLinear node and connect the 2 unitConversion output values to the input 1 and 2 of the addDoubleLinear.
10. Connect the output value of the addDoubleLinear to the twist joint 2 rotateX.
11. This time you just need to distribute the twist 2 and 3 for twist joint 4. Repeat steps 8-10 to do it.
12. notice that maya creates unitConversion nodes everytime you make connection to the joints rotate attributes. change the multipliers to the same 0.17.
13. the twist is done.

If you have more joints between the "master twist joints" in this case the 1,3 and 5. then you need to use more effort distributing the twist values. like if you have 2 joints inbetween. then you need 0.667 from the twist 1 and 0.333 from twist 2 for the second joint. then for the third vise versa 0.333 from twist 1 and 0.667 from twist 2.

This part would be tedious if you have like 60 joints and using a twist attribute at every 10 joints. You would have to be typing a lot of numbers. Some script that does this part automatically would rock.

Now for the squashNstretch.

12. Select the spline curve and execute script arclen -ch 1;. this creates curveInfo1 node that shows the arclength of the curve.
13. Go back to node editor or hypershade and make a multiplyDivide node. This will be the node that calculates the stretching for the joints.
14. Connect the arclength from the curveInfo1 node to the multiplyDivide nodes input 1 x attribute.
15. Copy the archlength value to the input2 x and change the node behavior to divide.
16. Make another multiplyDivide node. this will be the squash calculator.
17. Connect the output x from the stretch md node to the squash md nodes input1 x.
18. Change the node behavior to power and put -0.5 to the input2x attribute. (x^(-0.5)=1/sqrt(x) if someone is interested of that kind of stuff) So, this will calculate "realistic" squash effect.
19. Now for the joint connections. connect the stretch mds outputX value to both twist and spline joints scaleX. segment scale compensation keeps the parented twist joints scale the same. So, basically scaling the parent only moves the child so this is why you needed to connect the stretch for both.
20. Then connect squash mds outputX to twist joints scaleY and Z.

Here's the node network for both twist and squashNstretch.

Here's from viewport. Outliner looks clean and simple.

The lizard with very long tongue:
  12 December 2012
Figured something new. You can make the whole squashNstretch connections only for the spline joints without touching the twist joints scales. To do this you need to disable the segment scale compensation from the twist joints. easiest way is to delete the inverse scale connections from the node editor.

here's a screenshot how the nodeNetwork looks like after that.

Much more simple and probably calculates faster.
  12 December 2012
Great, thanks for the detailed info. Very useful!


Last edited by Horganovski : 12 December 2012 at 03:51 PM.
  12 December 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:01 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.