Sim2Blend

by David PAGNON in Addons


Sim2Blend

Sim2Blend is a Blender add-on for importing OpenSim data: model, motion, markers, and forces.

OpenSim is an open-source software for research in biomechanics, widely used in motion capture (MoCap). Blender is an open-source software used for 3D modeling, animation, and rendering.

Feel free to try Pose2Sim, an open-source pipeline for obtaining research-grade OpenSim results from consumer-grade cameras.

N.B.: Sim2Blend is inspired from BlendOsim. Unlike BlendOsim, Sim2Blend does not require using Matlab as an intermediary (and expensive) software between two open-source ones.

Contents

  1. Installation
  2. Demonstration
  3. How to cite and how to contribute

Installation

Installation is a little tricky, but the following steps should do it smoothly. If you encounter any issue, please submit an issue. It is still only available on Windows, but feel free to contribute and adapt it on other platforms!

Prerequisites

Find your Blender Python version

Open Blender, press Shift+F4, type the following lines:

import sys
sys.version

Install Sim2Blend libraries

Open Miniconda, and copy-paste these lines. Replace with the Python version you just found:

conda create -n Sim2Blend python=3.10.12 -y 
conda activate Sim2Blend
conda install -c opensim-org opensim -y
pip uninstall numpy
pip install numpy bpy vtk

Install Sim2Blend add-on

You will need admin rights for the next steps:

  • Rename python in C:\Program Files\Blender Foundation\Blender 3.6\3.6\python to python_old
  • Copy-paste there your Sim2Blend environment folder (to find its location, type conda env list in Anaconda prompt). Rename it to python
  • Open C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\Lib\opensim\__init__.py
    • comment out the line # from .moco import *
    • line 4, add the path to your OpenSim bin folder: os.add_dll_directory(r"C:/OpenSim 4.4/bin")

Install Sim2Blend add-on in Blender

  • Blender -> Edit -> Preferences -> Add-ons -> Install -> Choose Sim2Blend.py
  • Check Sim2Blend to enable it
  • Click on the tiny arrow on the upper-right corner of the 3D viewport to open it

Where to find Sim2Blend add-on


Demonstration

Find example files in the Examples folder, or use it with you own OpenSim data.

  • Add Model: Import a .osim model.
  • Add Motion: Import a .mot or a .csv motion file. Calculating all body segment positions may take a while if the model is complex or the motion long. Creates a .csv file for faster loading next time.
  • Add Markers: Import a .trc marker file. If you need to convert from .c3d to .trc, use this Pose2Sim utility.
  • Add Forces: Import a .mot GRF force file.

Warning: All imported files should be sampled at the same framerate.


How to cite and how to contribute

How to cite

If you use Sim2Blend, please cite [Pagnon and Camargo, 2023].

 @misc{Pagnon2023,
   author = {Pagnon, David and Camargo, Jonathan},
   title = {Sim2Blend - OpenSim results in Blender},
   year = {2023},
   doi= {10.5281/zenodo.8421820},
   publisher = {GitHub},
   journal = {GitHub repository},
   howpublished = {\url{https://github.com/davidpagnon/Sim2Blend}},
 }

How to contribute

I would happily welcome any proposal for new features, code improvement, and more!
If you want to contribute to Sports2D, please follow this guide on how to fork, modify and push code, and submit a pull request. I would appreciate it if you provided as much useful information as possible about how you modified the code, and a rationale for why you're making this pull request. Please also specify on which operating system, as well as which Python, Blender, OpenSim versions you have tested the code.

Here is a to-do list. Feel free to complete it:

  •  Import data from standard OpenSim data files (.osim, .mot, .trc, grf.mot)
  •  Convert .vtp files to .stl if .stl not found on disk
  •  Save segment angles to .csv files for faster loading of motion next time
  •  Import multiple persons in the same scene
  •  Create Example data
  •  Rig model
  •  Add other tool for importing or exporting cameras, and for importing videos or filming (see Maya-Mocap)
  •  Tutorial for Mac/Linux
Published 7 months ago
Blender Version 3.6
License Mit
Have questions before purchasing?

Contact the Creator with your questions right now.

Login to Message
Tags: mocap, opensim