Skip to content

Creating Rigged Hands

Peter Ehrlich edited this page Sep 19, 2015 · 12 revisions

Modeling

Create a mesh in Maya. It should be Y-up and in units of mm.

The bone structure currently should be four bones per finger, with the end bone being on the tip of each finger. This could change in the future to allow five-bone fingers, to match the latest skeletal bones API. These metacarpal bones are stationary for now, but may be dynamic in future version of the Leap Motion Software.

The bones should match exactly the aspect ratio and proportions of Leap data. Internally, the LeapJS Rigged Hand uses relative rotations between joins to set the joint positions. If joints are offset, there will be visual discrepancies, such as a pinch appearing with thumb and forefinger in the wrong positions.

Joint initial rotation does not matter, but when the joints and palm are zeroed, they should all point in the negative 'Z' direction with the pads of the hands facing down in the negative 'Y' direction.

The hand should be positioned with the palmPosition point directly over the origin of the scene in Maya. This is half way between and slightly below the index and middle finger mcp (metacarpal-proximal) joints.

The fingers must be in-order from thumb to index finger, and should be named semantically (e.g., "thumb1", not "mesh234"). This may help you later in debugging.

When available, we will provide the finished fbx model and a blank/template with bone positions and orientations for custom-hand creation.

Exporting

The hand mesh must be brought from Maya to THREE.js complete with rigging-- skinIndices and skinWeights. This is non-trivial, as there are several possible import paths, several model file formats (fbx, obj, dae), and several THREE.js file formats (scene, object, etc).

Maya -> Blender -> THREE.js

Chosen because Blender is able to export with Rigging, whereas other components (such as the python script found in the THREE.js repo) export scenes without rigging.

1: Export Maya as DAE_FBX, using pretty much the default settings. Make sure that the skin is weighted, and that there is only one continuous mesh. Do not use fbx with Blender, as it will not import bones as of v2.70.

2: Import in to blender using Import -> DAE. Make sure that the import units box is checked, as it is not by default. The hand mesh should appear large enough to be immediately visible. Delete the cube that Blender creates by default.

3: Export from blender using THREE.js exporter. Make sure you have the following boxes checked: Skinning, Bones, and Face Materials. Also scroll to the bottom of the dialog and press "Save Settings" so that you don't have to remember every time. Save this as untitled.js in your home directory, as filenames and extensions are ignored and default directories are forgotten. Anything else will drive you insane.

screenshot 2015-09-18 16 58 28

4 (optional): Confirm that the export worked and you're using the correct file format. There should be JSON blob describing the material with vertices, faces, etc. Importantly, skinIndices and skinWeights should be present and nonzero, or the mesh will not appear.

5: Use the model. Copy to src/models/your_model.js. Wrap the JSON file contents with a variable definition, .e.g.: var rigs = {}; rigs.left = {<your json>};. Be sure to include the semicolon at the end. Go to the /Gruntfile, search for the word model, and replace the path with your own.

Clone this wiki locally