Sunday 3 April 2011

Kinect and SL/Opensim Animations: An Update


Following the previous article outlining my experiments with using the Kinect for creating animation files for Second Life and Opensim, I thought an update might be in order to summarise some of the lessons learnt, both by myself and other experimenters.

Since the last article on the 24th February, two of the key software applications used in the workflow, Brekel Kinect 3D Scanner, and Bvhacker have had further development. So what's new in the latest releases?

Brekel Kinect 3D Scanner
Two further releases have been issued since the last article:

v. 0.39
The most important changes in this release for SL and Opensim users is that now BVH positions are now OFF by default. Some experimenters were creating bvh files with Brekel, importing them in bvhacker, and in there they played OK, but when optimised by bvhacker, and then uploaded into Second Life, all kinds of problems were seen. As Deepgreenseas reported:
When I brought into SL, my avatar kind of floated oddly in the air, with arms straight out to the sides doing weird leg and abdomen contortions having nothing to do with what I saw in bvhacker. So, I'm at a total loss what I'm doing wrong. Any ideas?
 The problem was that in the BVH Capture section of the Brekel window, there is a check box for "Write
Positions." This check box was set ON by default, and so the resulting bvh file had both translation and rotation data recorded, while bvhacker and SL/Opensim require only rotation data. In v.039 this setting is now OFF by default, so only rotation data is present in the bvh files now.

Other improvements included easier installation, a more compact GUI,  a warning when running below 30fps (and thus dropping frames), more tooltips, and other improvements and the squashing of some bugs.

v.0.40
New features/improvements include:

  • knees/feet should be better now when turning around
  • Second Life format for bvh export option added *
  • hand rotations are now supported using some custom calculations 
  • added motor/LED support
    • you can tilt the Kinect up and down (see slider in the CPU/FPS dock)
    • the LED color will be set according to the skeleton calibration phase
    • please see the How To under the Help menu on how to update the driver 
This last improvement, the ability to control the Kinect movement, is a big benefit, and will save me from all those fiddly adjustments to my tripod settings.

* I have not yet tried the Second Life option when saving bvh files. I would be interested if it now solves Twisted Pharoah's problem below.

Bvhacker
The latest release is now v.1.8, and the new features and changes are as follows:

  • Added three new video tutorials to the help section
  • Now possible to merge joints with their parent - useful for converting skeletons with roll bones
  • Now possible to delete descendants - useful for removing multiple finger or toe joints
  • Now possible to zero out descendants - see new video tutorial for use
  • Added preferences dialog (Ctrl P)
  • Now possible to set the default file view for open and save dialogs
  • Now possbile to show or hide the head mesh display
  • Added Zoom In and Zoom Out buttons to the view shortcuts
  • Removed 'Show first frame' view option

There is also a note on the file properties pane saying that the joint count includes End Sites. This had confused me at first as earlier research had shown that SL/Opensim typically uses 24 joints, yet when I counted them in bvhacker I could only see 19. This is because the 5 End Sites (one for the head and two each for the hands and feet) should also be added. End Sites can also be manipulated, to make the feet point backwards, for example, but I will leave it to the more imaginative experimenters how they use these End Sites.

I will now provide some further info about joints/bones and some of the problems faced by differing naming conventions used in various applications.

Joints/Bones
Some sources refer to the constituent parts of a bvh file as being composed of bones. This also had me confused at first, but Dave (the author of bvhacker) explained it well:
Although the terms 'bone' and 'joint' can be used interchangeably, I
prefer 'joint', as the position, rotation and translation apply to the
point in space where the joint actually is. Mathematically, the 'bone'
is actually just the space in-between two joints, so I personally find
it easier to think in terms of joints instead of bones.
Unfortunately, SL/Opensim mainly uses the bones naming convention, so rForearm is the bone between the wrist and elbow in the right arrm.

The Nite tracking software for the Kinect and Brekel use joint names, so they do use RightWrist and RightElbow. The list of joints they use are:

  • Hips
  • Chest
  • Neck
  • Head
  • End Site

  • LeftCollar
  • LeftShoulder
  • LeftElbow
  • LeftWrist
  • End Site

  • RightCollar
  • RightShoulder
  • RightElbow
  • RightWrist
  • End Site

  • LeftHip
  • LeftKnee
  • LeftAnkle
  • End Site

  • RightHIp
  • RightKnee
  • RightAnkle
  • EndSite

The list of bones/joints used in SL/Opensim are:
  • hip
  • abdomen
  • chest
  • neck
  • head
  • End Site

  • lCollar
  • lShldr
  • lForeArm
  • lHand
  • End Site

  • rCollar
  • rShldr
  • rForeArm
  • rHand
  • End Site

  • lThigh
  • lShin
  • lFoot
  • End Site

  • rThigh
  • rShin
  • rFoot
  • EndSite
As you can see, the NITE tracking software for the Kinect does not use both joints in the torso (chest and abdomen), just the chest, and explains the difference in the number of joints/bones, i.e. 23 and 24.

Bvhacker is designed to do the conversions between standard bvh files in joint-naming format and  the SL format using bone-naming format. However, it has been noted that the bone names in NITE/Brekel was causing some problems in Bvhacker, which renamed two joints to the same bone name. This was found by Twisted Pharaoh in the SLuniverse forum:

BVHacker renames 2 joints lShldr and 2 others rShldr.

What you should do is rename LeftShoulder into lCollar manually, RightShoulder in rCollar then do the Attempt SL Joint naming.
To manually rename joints in Bvhacker just load the bvh file, then in the joints pane on the left, select the joint and right click, and select Rename Joint.

Other Tips
Sarah Kline:
I discovered assuming a T pose before recording starts helped the shoulder rotation problems I had when bringing in to bvhacker.
 If you have any other Tips or suggestions for improving the current workflow, (if you find a cure for slight jitter, for example), then please add your comments to the article and I will provide a further update later.

Rock