[x3d-public] BVH to X3D import working

Don Brutzman brutzman at nps.edu
Mon Jan 9 06:34:32 PST 2017


Am happy to report that, after much effort, new Java source code for BVH motion capture (MOCAP) to X3D import appears to be working satisfactorily.

Key issues to sort out:
- figuring out what a BVH file is really indicating,
-getting the H-Anim skeleton visualization in the X3D scene organized correctly,
- converting degrees to radians in the motion data, prior to converting Euler angles to SFRotation, and
- many repeatable details that make perfect sense when correctly applied.

Significant assets that helped included:
- Embedding lots of information diagnostics in X3D scene comments
    ("when the going gets tough, the tough get verbose")
- HAnim BVH conversion results from Suwon University
- BVH import, HAnim X3D export capabilities by Seamless3D http://www.seamless3d.com
- Continuing improvements to X3D Tooltips for HAnim nodes
   http://www.web3d.org/x3d/tooltips/X3dTooltips.html
- Continuing improvements to X3D Validator
   https://savage.nps.edu/X3dValidator
- Have started a section listing assets for MOCAP and BVH in the X3D Scene Authoring Hints
   http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#MOCAP

Special thanks to Joe Williams, Myeong Won Lee and Roy Walmsley for diagnostic assistance.

=======================================================================================

Example conversions are online at

	X3D Example Archives: X3D for Advanced Modeling, Humanoid Animation
	http://x3dgraphics.com/examples/X3dForAdvancedModeling/HumanoidAnimation

Two versions are produced by the exporter, the primary of which has sphere and line visualization:

	http://x3dgraphics.com/examples/X3dForAdvancedModeling/HumanoidAnimation/BvhConversion1Index.html
	http://x3dgraphics.com/examples/X3dForAdvancedModeling/HumanoidAnimation/BvhConversion1.png
	http://x3dgraphics.com/examples/X3dForAdvancedModeling/HumanoidAnimation/BvhConversion1.mp4
	http://x3dgraphics.com/examples/X3dForAdvancedModeling/HumanoidAnimation/BvhConversion1.x3d

using MOCAP test case
	http://x3dgraphics.com/examples/X3dForAdvancedModeling/HumanoidAnimation/1.bvh

Upcoming work:
- 2017 initial release of X3D-Edit including this capability is forthcoming, TBA.
   https://savage.nps.edu/X3D-Edit
- Adding further H-Anim Skin examples from Joe to regular HAnim archives,
   http://www.web3d.org/x3d/content/examples/Basic/HumanoidAnimation
- HAnim sessions at Web3D Korea Chapter meeting in Seoul next week,
   http://www.web3d.org/event/web3d-korea-chapter-meeting-2017
   https://twitter.com/Web3DConsortium/status/818450446893215745
- Adapting these importer classes to open-source X3D Java SAI Library,
   http://www.web3d.org/specifications/java/X3dJavaSceneAuthoringInterface.html
- Further testing of BVH model import/export on other mocap files.

Java source is available under an open-source license in version control at
   https://svn.code.sf.net/p/x3d/code/www.web3d.org/x3d/tools/X3dEdit3.3/X3D/src/org/web3d/x3d/hanim/bvh/
   https://svn.code.sf.net/p/x3d/code/www.web3d.org/x3d/tools/X3dEdit3.3/X3D/src/org/web3d/x3d/actions/conversions/BvhToX3dConversionAction.java

=======================================================================================

Recent feature: created an alias table that matched common names (such as those found in 1.bvh example) to Level of Articulation (LOA-1) humanoid Joint and Segment names found in the H-Anim Specification.
	http://www.web3d.org/documents/specifications/19774-1/V2.0/HAnim/concepts.html#Hierarchy

The mappings found by the converter are documented in a MetadataSet node.  This appears to be a good convention for the working group to explore further, perhaps documenting other information about the BVH model as well.  If such consistency becomes good practice, then a common ability to read such information will help tools and authors alike.  Excerpt:

http://x3dgraphics.com/examples/X3dForAdvancedModeling/HumanoidAnimation/BvhConversion1.html#Bvh1_ConversionInformation

<Group DEF='Bvh1_ConversionInformation'>
   <!-- 20 BVH JOINT definitions found, following a single HIERARCHY ROOT -->
   <!-- BVH HIERARCHY model size computations: minX=0.0, maxX=0.0, width=0.0; minY=-17.78, maxY=10.16, height=27.94; minZ=0.0, maxZ=15.24, depth=15.24 -->
   <!-- Estimated rescaling to meters based on height: scaleFactor=0.0254 for modified height of 0.710m -->
   <!-- Vertical offset to move bottom of BVH figure to ground plane (adjusted in HAnimJoint containerField='skeleton'): heightOffset=0.451612m -->
   <MetadataSet name='BvhToHAnimConversionNameTable'>
	<!-- <MetadataString name='bvhName' reference='bvhType' value='"name" "segmentName"'/> -->
	<MetadataString containerField='value' name='Hips' reference='ROOT' value='"HumanoidRoot" "sacrum"'/>
	<MetadataString containerField='value' name='LeftHip' reference='JOINT' value='"l_hip" "l_thigh"'/>
	<MetadataString containerField='value' name='LeftKnee' reference='JOINT' value='"l_knee" "l_calf"'/>
	<MetadataString containerField='value' name='LeftAnkle' reference='JOINT' value='"l_ankle" "l_hindfoot"'/>
	<MetadataString containerField='value' name='LeftAnkleEnd' reference='JOINT' value='"l_midtarsal" "l_middistal"'/>
	<MetadataString containerField='value' name='LeftAnkleEndSite' reference='Site' value='"l_midtarsal_tip"'/>
	<MetadataString containerField='value' name='RightHip' reference='JOINT' value='"r_hip" "r_thigh"'/>
	<MetadataString containerField='value' name='RightKnee' reference='JOINT' value='"r_knee" "r_calf"'/>
	<MetadataString containerField='value' name='RightAnkle' reference='JOINT' value='"r_ankle" "r_hindfoot"'/>
	<MetadataString containerField='value' name='RightAnkleEnd' reference='JOINT' value='"r_midtarsal" "r_middistal"'/>
	<MetadataString containerField='value' name='RightAnkleEndSite' reference='Site' value='"r_midtarsal_tip"'/>
	<MetadataString containerField='value' name='Chest' reference='JOINT' value='"vl5" "l5"'/>
	<MetadataString containerField='value' name='Chest2' reference='JOINT' value='"Chest2" "vl5_to_Chest2"'/>
	<MetadataString containerField='value' name='LeftCollar' reference='JOINT' value='"LeftCollar" "Chest2_to_LeftCollar"'/>
	<MetadataString containerField='value' name='LeftShoulder' reference='JOINT' value='"l_shoulder" "l_upperarm"'/>
	<MetadataString containerField='value' name='LeftElbow' reference='JOINT' value='"l_elbow" "l_forearm"'/>
	<MetadataString containerField='value' name='LeftWrist' reference='JOINT' value='"l_wrist" "l_hand"'/>
	<MetadataString containerField='value' name='LeftWristSite' reference='Site' value='"l_wrist_tip"'/>
	<MetadataString containerField='value' name='RightCollar' reference='JOINT' value='"RightCollar" "Chest2_to_RightCollar"'/>
	<MetadataString containerField='value' name='RightShoulder' reference='JOINT' value='"r_shoulder" "r_upperarm"'/>
	<MetadataString containerField='value' name='RightElbow' reference='JOINT' value='"r_elbow" "r_forearm"'/>
	<MetadataString containerField='value' name='RightWrist' reference='JOINT' value='"r_wrist" "r_hand"'/>
	<MetadataString containerField='value' name='RightWristSite' reference='Site' value='"r_wrist_tip"'/>
	<MetadataString containerField='value' name='Neck' reference='JOINT' value='"Neck" "Chest2_to_Neck"'/>
	<MetadataString containerField='value' name='Head' reference='JOINT' value='"skullbase" "skull"'/>
	<MetadataString containerField='value' name='HeadSite' reference='Site' value='"skullbase_tip"'/>
   </MetadataSet>
</Group>

This will be an excellent topic for discussion in the next H-Anim teleconference.

=======================================================================================

Continued work on next edition of H-Anim Specifications (for example adding Motion node) seems really important.  It is clear that the BVH format is widely used for MOCAP and poorly/inconsistently documented.  Getting BVH well defined will no doubt help supporting other motion files in X3D as well.

The Humanoid Animation (H-Anim) Working Group has a lot of important tasks to pursue this year.  It will be great to engage further with the Medical Working Group in order to ensure that all of this work is sufficiently well developed to support correct physiological nomenclature and (one hopes, eventually) formal medical records.  Additional synergies for 3D printing and useful metadata are emerging with the CAD Working Group as well.

	http://www.web3d.org/working-groups/humanoid-animation-h-anim
	http://www.web3d.org/working-groups/medical
	http://www.web3d.org/working-groups/computer-aided-design-cad

Consortium membership and working-group participation are welcome.  This is how we together make major progress.

=======================================================================================

Have fun with HAnim, BVH and X3D!  8)

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list