Files
crosstyan ab728c7e9a fix: use shortest-path rotation interpolation in playback
Switch viewer playback from Magnum Math::slerp() to Math::slerpShortestPath() when interpolating adjacent OpenSim frame orientations.

Why:

- Adjacent OpenSim quaternions can cross sign while representing nearly identical orientations.

- Non-shortest-path interpolation can create artificial long-arc spins between valid sampled poses.

- That makes playback exaggerate or invent visible bone flips that are not present in the sampled frame states.

What changed:

- Updated playback interpolation in src/ViewerApp.cpp to use shortest-path quaternion slerp.

- Added docs/motion-troubleshooting.md documenting the distinction between viewer interpolation artifacts and upstream IK discontinuities.

- Added a README pointer to the troubleshooting note.

Investigation log:

- Verified the viewer loads .mot through OpenSim state storage and renders PhysicalFrame transforms directly.

- Reproduced the target Sports2D/Pose2Sim/OpenSim clip and confirmed the .mot already contains large coordinate discontinuities and limit clamping, indicating upstream IK failure.

- Confirmed the viewer also had a separate interpolation issue due to non-shortest-path quaternion slerp.

Validation:

- Rebuilt with: cmake --build build -j

- Relaunched the viewer successfully against the problematic .osim/.mot pair after the fix.
2026-03-11 11:54:41 +08:00

939 B

osim-magnum-viewer

Read-only OpenSim viewer built with OpenSim, Magnum, SDL2, and ImGui.

Build

git submodule update --init --recursive
cmake -S . -B build -DOpenSim_DIR=/home/crosstyan/Code/opensim-core-build/install/lib/cmake/OpenSim
cmake --build build -j

Run

./build/bin/osim-magnum-viewer /path/to/model.osim /path/to/motion.mot

Optional flags:

./build/bin/osim-magnum-viewer model.osim motion.mot --geometry-dir /path/to/Geometry --speed 0.5 --start-paused

The repo vendors a Geometry/ directory and searches it automatically at runtime.

Sample run:

./build/bin/osim-magnum-viewer \
  /home/crosstyan/Code/opensim-core/OpenSim/Moco/Test/walk_gait1018_subject01.osim \
  /home/crosstyan/Code/opensim-core/OpenSim/Moco/Test/walk_gait1018_state_reference.mot

Notes