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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jax_ik-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 1b7ff2decc4ce6072d1e18d9db7bb174761bdb192a4777f0d9500056858ffc3d
MD5 629f99bb1fa60526efa15df93c758273
BLAKE2b-256 da0dc7d475259059a9264c654772d2c30c510971cabbe950069ae12de30e4390

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: jax_ik-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 01648cea58559ecc07b1824f04d330b45b360116b5200fd459ce187585598151
MD5 9ed2b87d3b541d49125f908c8f3ce0d9
BLAKE2b-256 b6c82b770c6bd452ebd036d1fe5685ae37734c8aa5f5cda7f0cba0f08a588e0d

See more details on using hashes here.

Provenance

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