Skip to main content

Real-Time Inverse Kinematics for Generating Multi-Constrained Movements of Virtual Human Characters

Project description

JAX-IK

Official implementation for the paper: "Real-Time Inverse Kinematics for Generating Multi-Constrained Movements of Virtual Human Characters"

More Information

Demo

You can try out the JAX-IK library in this demo app

Install

You can install the library simply using pip:

pip install jax-ik

Example code

This is a small example code to solve the arm position on the smplx skeleton.
Sadly, we don't have the rights to add the SMPL-X skeleton to this repository. Therefore, you will have to obtain a .glb file of the smplx skeleton yourself.
For this install the smplx blender addon in blender, press on the " add" button in the Blender SMPL-X drawer.
Finally, go to File -> Export -> glTF 2.0 and follow the export dialog to save your .glb file.

import numpy as np
from jax_ik.objectives import DistanceObjTraj
from jax_ik.ik import InverseKinematicsSolver

# === Setup ===
hand = "left"
controlled_bones = [f"{hand}_collar", f"{hand}_shoulder", f"{hand}_elbow", f"{hand}_wrist"]

# Define bounds in degrees
angle_bounds_deg = {
    "left_collar": ([-10, -10, -10], [10, 10, 10]),
    "left_shoulder": ([-120, -140, -65], [70, 50, 25]),
    "left_elbow": ([-100, -180, -10], [90, 10, 10]),
    "left_wrist": ([-120, -70, -70], [90, 60, 80]),
}

# Flatten and convert to radians
bounds = []
for bone in controlled_bones:
    lower, upper = angle_bounds_deg[bone]
    for l, u in zip(lower, upper):
        bounds.append((np.radians(l), np.radians(u)))

# === Initialize Solver ===
model_file = "smplx.glb"  # Path to your SMPL-X .glb file
ik_solver = InverseKinematicsSolver(
    model_file=model_file,
    controlled_bones=controlled_bones,
    bounds=bounds,
    threshold=0.005,
    num_steps=1000,
)

# === Target Setup ===
end_effector_bone = f"{hand}_wrist"
random_target = np.array([0.3, 0.2, 0.5])  # Some reachable 3D point

mandatory_objectives = [
    DistanceObjTraj(
        target_points=[random_target],
        bone_name=end_effector_bone,
        use_head=True,
        weight=1.0,
    )
]

# === Solve IK ===
initial_angles = np.zeros(len(controlled_bones) * 3, dtype=np.float32)
solved_angles, obj_value, steps = ik_solver.solve(
    initial_rotations=initial_angles,
    learning_rate=0.2,
    mandatory_objective_functions=mandatory_objectives,
    ik_points=5,
    patience=200,
)

print(f"Solved in {steps} steps. Final objective: {obj_value:.4f}")

# === Render Result ===
ik_solver.render(angle_vector=solved_angles[-1], target_pos=[random_target], interactive=True)

More examples, and some open source models will be added in the following weeks.

LICENSE

Real-Time Inverse Kinematics for Generating Multi-Constrained Movements of Virtual Human Characters © 2025 by Hendric Voss is licensed under CC BY-NC-SA 4.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jax_ik-0.1.6.tar.gz (37.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jax_ik-0.1.6-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file jax_ik-0.1.6.tar.gz.

File metadata

  • Download URL: jax_ik-0.1.6.tar.gz
  • Upload date:
  • Size: 37.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jax_ik-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e080143681ede34ecb8575444514e657bf9a390fbd966fe3b040450fce451274
MD5 a579df5099d3dc43d21379e99ee9f5d1
BLAKE2b-256 70d00211e0da2e2a4f2b8a977daa45f101cbc52126fd37d0928e4b19bad2e9c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_ik-0.1.6.tar.gz:

Publisher: python-publish.yml on hvoss-techfak/JAX-IK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jax_ik-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: jax_ik-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 33.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jax_ik-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 63d99c0cb98c6349d157a894726efe6f1c5982462546f371f6b7f0671397d5a1
MD5 b28ab8c747714190767439a39f09ccc4
BLAKE2b-256 5f1715cf4bc7cec7659baf32dd1888b758a5c9798ee9e0b3ff6422f62adeb302

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_ik-0.1.6-py3-none-any.whl:

Publisher: python-publish.yml on hvoss-techfak/JAX-IK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page