SoftTronics A B C D E ----- .

-----
Welcome
News
Downloads
Registration
F.A.Q. + Bugs
IRTC CDROMs and Keyring
Links
Support
Press Room

----- IRTC CDROMs available here ----- POV-Ray keyring available here ----- Moray Now!
 
You're welcome to place any of these logos on your website if you want to link to this site and help support further development of Moray For Windows.

  -----
Moray Logo    

The Official Moray Homepage

A Wireframe Modeller for
POV-Ray 3.x

Copyright © 1991-2003 by
SoftTronics, Lutz + Kretzschmar GbR, Munich, Germany


Tutorial


  A simple beginner

The is more than one way leading to a functional IK model. In our first example we'll create a very simple object to show the very basics of 'IK-aware' modelling. Only the steps that are absolutely necessary are used to make this model IK ready. First create a new scene.
IK501.gif Create a cylinder and scale it with {1,1,2}. Create a Group, name it 'Segment1', and 'Add' the cylinder. Select 'Segment1' and duplicate it three times, scaling the copies with the offset {-0.1, -0.1, 0}. Create a sphere, scale it {0.7, 0.7, 0.2}, then translate it to {0, 0, 2}, and 'Add' the sphere to 'Segment4'. Select 'Segment3' and 'Add' 'Segment4' to it. Then select 'Segment2' and 'Add' 'Segment3' to it. Finally select 'Segment1' and 'Add' 'Segment2' to it. Your camera view should show a setup similar to the image on the left.
IK502.gif Now we'll breathe "IK life" into the object. To simplify object selection you should open the object browser in one of the views, i.e. in the Top view as we will not need it otherwise. Select 'Segment1' and 'Freeze' it. Then select 'Segment2' and 'Freeze' it as well. Click on the same button again, it now reads 'Modify', and set the 'Max.' Z-Translation to 2.0. This allows the object to change its position within two units along the z-axis. At the same time the corresponding IK checkbox becomes active. Check it. Repeat the last three steps for 'Segment3' and 'Segment4'. That's it. Select the sphere in 'Segment4' and change to IK mode. The object behaves similar to a telescopic antenna.


  Foundation

We will now continue with a more in-depth example. Once again, create a new scene.
IK101.gif Create 2 Cylinders, scale one by <0.4, 0.4, 5>, rotate by <0,-90,0> and translate by <0,0,0.5>. Create a CSG object, name it 'Shoulder' and add both objects in place.
IK102.gif Move 'Shoulder' CSG away from origin. Create another 2 Cylinders, scale one by <0.2, 0.2, 4>, rotate <0,-90,0> and translate <0,0,0.5>. Create CSG 'Elbow'. Add both cylinders in place to 'Elbow'.
IK103.gif Move 'Elbow' away from origin. Clear 'Shoulder' translation. Move 'Elbow' so that it sits at the end of the thinner cylinder of 'Shoulder'. Select 'Shoulder' and add 'Elbow' in place. Create a cylinder, name it 'Hand', scale it 0.5,0.5,1. Move it to the end of the thinner cylinder that belongs to 'Elbow'. Add it in place to 'Elbow'.
You can now tell whether you've setup the hierarchy correctly by simply selecting 'Elbow' or 'Shoulder' and rotating about the Z-axis. Works as you want the IK to work.


  Setting up IK

IK201.gif Select 'Shoulder' and select 'Limits' on the Modify Tab, then 'Limit All Children'. Click on Yes. We have now frozen the object. No part of it can be moved, rotated or scaled. Now we allow certain objects to be rotated.
IK202.gif Select the 'Shoulder' click on the 'Modify' button on the Modify Tab. You'll see the Limits dialog. In the Rotation components part, click on the checked checkbox that is keeping Z limited. What we're saying is that we don't want Z-rotation to be limited. Click OK. As you can see the Z-component is now available and you can rotate the 'Shoulder' in Rotation mode. This axis of rotation is to be used in IK. Leave the 'Dampen' value at 360 and click OK.
IK203.gif Select the 'Hand', click on IK (or press 'I'). You can now see that the object is already following the mouse and setting the rotation of the 'Shoulder' object accordingly. Select 'Elbow' and click on 'Modify' to bring up the Limits box. Uncheck the Z-rotation checkbox and check the 'Z IK Usage' check box. Click on OK and you can now see that after selecting IK mode, you can move the 'Hand' and the 'Elbow' and 'Shoulder' are moved so that the 'Hand' follows the mouse. Select the 'Elbow' and click on Limits. Check the Z-rotation Limit checkbox. Don't worry the IK Usage checkbox will be turned off, we'll fix that in a moment. Now enter -90 and +90 in the 'Min' resp. 'Max' Z-Rotation values. As you can see the IK Usage checkbox comes back on. Click OK. Select the 'Hand'. As you can see, the 'Elbow' cannot fold back on itself. This is because we've limited its rotation.


  Extending the IK chain

Let's add another element to the chain. Remember that the new element must rotate around it's origin, so we'll construct it in the origin, too. You may have the 'Shoulder'/'Elbow' combination in a strange state. If so, use CTRL-SHIFT to select part of the 'Elbow'. Click on the 'Clear' button next to Rotate. Press ALT-P to select the parent ('Shoulder') and also clear the rotate value.
IK301.gif Select the 'Elbow' and click on the 'Hand' subobject. Click on 'Ungroup'. It'll move somewhere, ignore it. Now press CTRL-C (with 'Elbow' still selected) and CTRL-V. Rename the object to 'Wrist'. If you now try to move the object to the end of the hierarchy you'll see that it's still frozen. So, click on 'Modify' and select 'Remove Limits'. Ah, that's better. OK, now select the just copied 'Wrist' to the end of the 'Elbow' (where 'Hand' was). Select 'Elbow' and 'Add' 'Wrist' in place. Use CTRL-SHIFT to select the last (right-most) cylinder. This should select the 'Wrist' object. It is still unlimited. Click on 'Freeze', then on 'Modify' (same button). Again, allow Z-rotation, enable IK usage, then close. Select the 'Hand' cylinder, select 'Limits', then 'Remove Limits' and finally move it to the end of 'Wrist'. Use CTRL-SHIFT to select the last cylinder (selects 'Wrist'). Now add 'Hand' in place to 'Wrist'. Select the 'Hand' and 'Freeze' it. Press 'I' (or click on the IK toolbar button).


  Using Forward Kinematics with an IK model

If you've setup the object correctly and have frozen all channels (a channel being one of the 9 numbers that makes up the transformation block) that may not be changed, Moray supports you in that it guesses at what you want to do when you select an object.
IK401.gif Using our just constructed example, press and hold CTRL-SHIFT. Then select the 'Hand' in a 2D View. You can see that the cursor shows an open lock. The CTRL modifier makes Moray select the first object in the hierarchy that has at least one open transformation channel. If you're not in IK mode, it'll even switch modes if it can identify the open channel. Try this now. Switch to Translation mode ('T'). Then use CTRL-SHIFT to select the 'Hand'. Moray sees that the 'Hand' is frozen (it has no open channels) and thus goes up one level in the hierarchy to 'Elbow'. There it sees that a rotation channel is open and thus selects that object and switches to rotation mode. You can now rotate the 'Elbow' (within the limits, of course).


  Modelling a chain

This example is more complex and will show how advanced modelling techniques can be used for the creation of IK ready objects. First we will create a single chain link. Afterwards we'll use a bunch of link copies to form a chain. The chain setup will be done with respect to our final goal: an IK aware chain. Start the example with a new scene.
IK601.gif Create a Torus with 'Inner Radius' = 0.8 and 'Outer Radius' = 1. Create a Cube, scale it {0.6,1,0.1}, and move it to {0.6,0,0}. Now create a CSG Difference and 'Add' the two objects in the order of creation. Translate the CSG with {-0.5,0,0}. Copy it (CTRL-C, CTRL-V), rotate the copy 180 degrees around z, and change its x-translation to 0.5. Create a Cylinder, scale it {0.1,0.1,1}, and move it to {-0.5,0.9,0}. Copy the cylinder as well and change the y-translation to -0.9. Finally create a CSG Merge, name it 'ChainLink1', and add the four objects to it. Simplify the object display by evaluating the CSGs (menu Scene|Evaluate all CSGs) and compare your object with the one we made.
IK602.gif Every object rotates about its own (local) origin and our single chain link isn't an exception to the rule. However, in a chain this would allow it to pass through a neighbouring link, which is not desirable. This means we will have to translate the point of rotation. Create a Group, name it 'Link1', and add 'ChainLink1' to it. Now click 'Local Coordinates' and enter (using the keyboard!) the value 1.2 as the x-translation. This will move the link. Click 'Local Coordinates' again. Copy 'Link1'. Select its subobject 'ChainLink2'. Rotate this CSG by 90 degrees around x, then click 'Select Parent'.
IK603.gif Click 'Freeze' and then 'Modify'. Every link of the chain shall be able to move along x and rotate around z relative to its predecessor within in the IK chain. For this, we will set the 'Min' resp. 'Max' x-Translation to 0.2 resp. 1.2. The 'Min' resp. 'Max' z-Rotation is set to -45 resp. 45 degrees. Don't forget to check the available 'IK Usage' checkboxes!
IK604.gif Now, using Moray's Duplication Dialog, create eight copies of 'Link2' without transforming them. It is important that you do not create References as they will not work! Select 'ChainLink2' in 'Link2' and clear all rotations. Repeat this with 'ChainLink4', 'ChainLink6', 'ChainLink8', and 'ChainLink10'. Now we can build the complete object. Select 'Link9' and add 'Link10', then add 'Link9' to 'Link8' etc. Finally evaluate all CSG's and switch to IK mode. Moray will need some time to iterate through all elements while finding a possible constellation. So, when moving for example the last chain link use small steps and wait for the object to follow up. After a while you'll get a feeling for this.


  Summary

In the given examples you have seen how functional IK models can be created. All models share common and must obey some specific points, which we'll again emphasize here.
Subdivide your object into functional groups This means that you must make up your mind about which parts move or rotate relative to other parts. All these points are candidates for a subdivision.
Build an IK chain IK takes place along a nested hierarchy of objects. No other subobject will ever influence the behaviour of the IK mechanism.
Prefere basic conditions If there are no well understood reasons against it, create the subpart of the object in the origin and add it in place to the new group. Transform this group accordingly and then add it in place to the IK model.
Remember locality All IK magic happens between the origins of hierarchically adjacent objects participating in IK. Or, said in other words, each subpart (more exact: its origin) of an IK model is transformed with respect to the parent (again: its origin).

Thanks to Andreas Lagotzki for writing part of this and for doing the screenshots.

Send email to
the Webmaster