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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jax_ik-0.1.4.tar.gz
  • Upload date:
  • Size: 26.9 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.4.tar.gz
Algorithm Hash digest
SHA256 f89cc71828997e02f11cedfccde38abe68ee628aac71f31701b50c2c4bbb8fab
MD5 858932219ce3cecd1440c452ccbb5503
BLAKE2b-256 5606d7264abe9d22f293ff1798799a4162d08a700ea72dd0a3b48f1726880578

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_ik-0.1.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: jax_ik-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 26.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 52e7ff7946ab4450c5925f3fcfe8e6d1746bfdba80d33eee379c934f4d0cf4c0
MD5 520d30d592aaf6c29d1c746fc1e82c08
BLAKE2b-256 04136a1ba5da25eb880e00b7e7216a2cd3686d72d5b3d6ed4921e5fe9f2cb63b

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_ik-0.1.4-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