| Submitted by , posted on 25 June 2001 |

Image Description, by This IOTD shows an inverse kinematics engine, that we did for our final project of a virtual reality course. The IK calculations are based on techniques found on Hugo Elias' great page: http://freespace.virgin.net/hugo.elias/
All geometry and bone hierarchy information was generated using 3D Studio Max 4.0 and exported using a script into a proprietary text file format. A simple method in the skeleton class of the code lets you directly affect a specific bone by some force vector after which all IK calculations are carried out iteratively by the system. The IK system supports bending bones and rotational bones, but you have to specify them yourself, since we could not find direct equivalents to these types in 3D Studio Max. For this particular model, all bones are bending bones except the 3 bones that connect the 3 necks to the root bome in the front part of the dragon. This enables the dragon to turn its head to the sides. As we didn't have specific documentation of how 3D Studio Max stores bones and bone hierarchies, we tried out a couple of different techniques. What we ended up with here is a representation in which Max defines each bone as a startpoint and the name of it's parent bone. At the ends (of the necks for instance) there will be short terminating bones. Still, we don't guarantee that this is the way it actually works in Max (and for any model), but for this model it worked out very well.
Things start to get funny when the program is compiled and executed on the IRIX computer at the Virtual Reality Centre of VR-C at our university (www.vr-c.dk). They have 3 n-vision datavisor hires head mounted displays there. Part of our project was to add support for these HUDs such that they can actually control the positions of the heads of the 3 dragons -- that is why the dragon has 3 heads after all ;-) To enable this option, you have to set USE_HMDS to 1 in the main.cpp file. Due to lack of time we didn't implement rendering of individual views for each of the dragons heads (such that a person wearing the HUD can see what it looks like from the dragon head associated with the HUD). This shouldn't be hard to do though, and we have been told, that there even exists a special OpenGL library for rendering multiple views of the same scenery.
Finally, just for fun, we added a particle system for the head in the middle to add some more action to the scene. ;-) You may find the complete source code, executable binaries as well as the max exporter script on my homepage at http://www.kampsax.dtu.dk/~jm/dragon
In the demo there are a few key, that you can press:

> - 'A' toggles animation on/off
> - 'S' toggles display of the animated and initial skeleton on/off
> - 'W' toggles wireframe mode on/off
> - '+'/'-' can be used to scroll through the different bones of the models.

Coloured points will show which vertices will be affected by the bone (and how much)
You use the mouse to navigate through the scene. It works much like a trackball:

> - Use the left mouse button to rotate the scene.
> - Use the right mouse button to zoom in and out.
> - Additionally the middle mouse button may be used to move the scene horizontally and vertically.

Jan Marguc

[prev] | Image of the Day Gallery www.flipcode.com | [next]

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.