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.5.tar.gz (34.2 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.5-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jax_ik-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2d13b88a0a1e93e1e48bbdd0b39660681eaaa5079e5549066961da47bf10915e
MD5 997a02edce010bd6045c69da4442c292
BLAKE2b-256 644799e2e7f52070bf70a0ea7a3250316088d607214c552202048b6fe1ea75a7

See more details on using hashes here.

Provenance

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

Publisher: python-publish.yml on hvoss-techfak/TF-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.5-py3-none-any.whl.

File metadata

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

File hashes

Hashes for jax_ik-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 72085a7af6961408481502507d04ca31e204dc250458e3df751222f9f684c4b3
MD5 5f0cb28a92c66a5bfbc5a244b99c49d3
BLAKE2b-256 100e261c706b4ac5aa041926481059e93a02c51afbc9c0955e7b38b9c3b08111

See more details on using hashes here.

Provenance

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

Publisher: python-publish.yml on hvoss-techfak/TF-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