Bharat Consultancy ServicesSoftware, AI & Product Consultancy
All case studies
3D Web & Biomechanics

OpenSim musculoskeletal models running interactively in WebGL

Built for ForgeLabs.in, this engineering pipeline converts complex desktop biomechanical models (.osim, .mot, .trc) into optimized binary .glb animations rendered natively at 60 FPS in any browser via Three.js.

OpenSim 3D Biomechanics Web Viewer For ForgeLabs.in case study preview
3D Web & Biomechanics
Digital Health & Motion Science

Project snapshot

High-performance Python-to-WebGL conversion pipeline translating complex OpenSim musculoskeletal models into lightweight interactive 3D browser simulations.

⏱️ 7 weeks🛠️ 3D WebGL & Python Pipeline📦 6 Deliverables🌐 Live Production
60 FPSBrowser WebGL
-93%Payload reduction
0 PluginsNative web delivery
The brief

What the project needed to solve

Every build begins with practical business constraints, user demands, and technical goals.

Project context

OpenSim is the worldwide gold standard in biomechanics and musculoskeletal simulation, used by researchers, orthopedic clinicians, and sports scientists to analyze joint torques and muscle kinematics. However, sharing these simulations historically required installing heavy desktop software or rendering static non-interactive video clips.

Bharat Consultancy Services developed a production-ready conversion pipeline and interactive web viewer for ForgeLabs.in. The solution parses raw OpenSim model geometry and inverse kinematics trajectories, mathematically converts coordinate axes to WebGL conventions, and bakes lightweight binary glTF files for smooth 60 FPS browser rendering without external plugins.

Key engineering challenges

  • Translate OpenSim coordinate spaces (Y-up, X-forward, Z-right) to WebGL conventions (+90° Y-axis rotation and degree-to-radian transformations).
  • Compress complex anatomical meshes and multi-joint kinematics from 150MB+ desktop files to sub-10MB binary GLB files.
  • Achieve stable 60 FPS skeletal animation playback on both mobile and desktop browsers using pure Three.js.
  • Support spline interpolation, coupled joint degrees of freedom, and inverse kinematics retargeting.

Delivery milestones

  • OpenSim file format analysis (.osim XML schemas, .mot time series, .trc marker trajectories)
  • Mathematical transformation matrix formulation & Python GLB baking algorithm
  • Three.js WebGL viewer implementation, joint hierarchy controls & animation scrubbers
  • Mesh optimization, performance benchmarking & mobile WebGL validation
  • Open-source technical guide, case study writeup & deployment release
Technical approach

Architecture & solution tracks

How we structured the systems, engineering workflows, and product layers from design to deployment.

Conversion Pipeline

Python Kinematic Translation & GLB Baking Engine

Engineered custom Python conversion utilities (gem4_motion.py, osim_mot_to_gltf.py) using PyGLTFLib and NumPy. The engine parses .osim joint hierarchies and .mot time-series coordinates, baking bone transform matrices directly into glTF animation tracks.

3D Web Renderer

Three.js WebGL Interactive Biomechanics Viewport

Developed a responsive Three.js viewer with orbit controls, dynamic lighting, bone hierarchy toggles, playback scrubbers, and variable playback speeds (0.25x to 2.0x) for in-depth gait analysis.

Kinematics & Pose

MediaPipe Pose to OpenSim Kinematics Bridge

Integrated markerless video pose tracking (MediaPipe Pose) that extracts 3D joint landmarks and formats them into OpenSim marker trajectory (.trc) files for automated inverse kinematics solving.

Optimization

Mesh Decimation & Zero-Plugin Delivery

Automated VTK mesh decimation and vertex color baking, cutting asset transfer payloads by over 93% to enable instant model loading even over cellular mobile connections.

What shipped

The assets, systems, and capabilities behind the build

A strong project outcome depends on what actually gets delivered, not just high-level screens or concepts.

Core Deliverables

  • Automated OpenSim-to-glTF/GLB Python conversion engine (gem4_motion.py, osim_mot_to_gltf.py)
  • Interactive Three.js WebGL biomechanics viewer component with camera presets and playback controls
  • Mathematical coordinate translation utilities for degree-to-radian and quaternion rotations
  • MediaPipe Pose integration pipeline converting 2D video to OpenSim marker trajectory (.trc) files
  • Automated mesh optimization scripts cutting model payload sizes by over 90%
  • Comprehensive developer documentation, technical article, and API documentation

Tech Stack & Tools

  • Three.js & WebGL 3D Engine
  • Python 3 (NumPy, PyGLTFLib, VTK Toolkit)
  • OpenSim Musculoskeletal Simulation API
  • MediaPipe Pose Computer Vision
  • GLTFLoader & Custom Kinematic Shaders
  • HTML5 Canvas & Responsive Controls

Measurable Impact

  • True zero-plugin interactive 3D musculoskeletal viewing running natively in modern web browsers
  • 93% reduction in payload size through binary glTF compression for smooth mobile loading
  • Over 60 FPS fluid rendering performance during multi-joint walking and athletic motions
  • Complete open engineering documentation published for the scientific community
Outcome

OpenSim 3D Biomechanics Web Viewer For ForgeLabs.in in one line

The OpenSim 3D Biomechanics Web Viewer bridges high-end biomechanics simulation and modern web graphics, enabling researchers, athletes, and clinicians to explore musculoskeletal movement interactively in any browser.

More work

Related project case studies

Explore the other builds featured on the Bharat Consultancy Services homepage.