Browser-Local ONNX Character Rigging & CCDIK Kinematics Pipeline
Upload a static .gltf mesh. Instantly get a fully rigged, IK-ready SkinnedMesh.
No server-side processing. No manual bone placement. No weight painting.
The Problem Β· Architecture & Workflow Β· Tech Stack Β· API Usage
In interactive 3D web platforms (metaverses, configurators, UGC gaming), empowering users to upload custom avatars usually requires a massive compromise:
- Force manual rigging: Users spend days in Blender placing bones and painting weights.
- Server-side pipelines: Send meshes to a cloud service running Mixamo or Maya scripts (slow, expensive, high latency).
auto-rig-web shifts the entire pipeline to the client. Using a lightweight, browser-local ONNX vision model, it analyzes mesh topology, predicts joint locations, constructs a skeletal hierarchy, and computes biharmonic skin weights procedurally using Three.jsβall within milliseconds.
Try the interactive demo directly in your browser:
Live Browser Sandbox: Launch the live interactive WebGPU / ONNX rigging runtime directly in your browser:
π Run Live Sandbox on CodeSandbox or run locally vianpm run dev.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β [LIVE THREE.JS / WEBGPU VIEWER] β
β β
β (o) Head Node β
β | β
β [===+===] Shoulder / Clavicle Arc β
β / | \ β
β O | O Elbow Joints (CCDIK Constraints Enabled) β
β | β
β ( ) Pelvic Root Coordinate [x: 0.00, y: 1.02, z: 0.00] β
β / \ β
β O O Knee / Biharmonic Heat Skinning Weight Transfer β
β β
β Status: 60 FPS Steady Β· 0 Heap Allocations Β· 18ms Inference β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β auto-rig-web β
β β
β 1. Ingestion 2. AI Inference 3. Topology β
β ββββββββββββββ βββββββββββββββ ββββββββββββββ β
β β Static β β ONNX Runtimeβ β Procedural β β
β β THREE.Mesh ββββββ>β (WebGPU) βββββββ>β Skinning β β
β ββββββββββββββ β Joint Predictβ β (Weights) β β
β βββββββββββββββ ββββββββ¬ββββββ β
β β β
β 4. Output 5. Animation β β
β ββββββββββββββ βββββββββββββββ β β
β β SkinnedMeshβ<ββββββ CCDIK Solverβ<ββββββββββββββ β
β β (Ready) β β (Real-Time) β β
β ββββββββββββββ βββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Voxelization & Tensor Prep: The input geometry's vertices are mapped to a 3D occupancy grid tensor.
- ONNX Inference: A quantized spatial CNN runs via
onnxruntime-web(WebGPU accelerated) to predict 3D coordinates for a standard 19-joint bipedal hierarchy. - Procedural Skinning: Bones are instantiated. Skin indices and skin weights are computed per-vertex using inverse distance weighting with exponential falloff (approximating heat-diffusion/geodesic distance).
- IK Constraints: A built-in Cyclic Coordinate Descent (CCDIK) solver allows instant dynamic posing by pulling end-effectors (e.g., wrists, ankles).
[Head]
|
[Neck]
|
--[Chest]--
/ | \
[L.Sh] [Spine] [R.Sh]
| | |
[L.Arm] [Hips] [R.Arm]
| / \ |
[L.FA] / \ [R.FA]
| [L.UpLeg] [R.UpLeg] |
[L.Hnd] | | [R.Hnd]
[L.Leg] [R.Leg]
| |
[L.Foot] [R.Foot]
This library is engineered for performance at the edge:
- AI Inference:
onnxruntime-webleveraging the WebGPU execution provider. This allows complex spatial CNNs to run directly on the client's GPU without WebGL overhead or CPU blocking. - 3D Pipeline: Three.js is used for matrix math, hierarchy construction, and upgrading standard
BufferGeometryto skinning-ready buffers (skinIndex,skinWeight). - Procedural Algorithms:
- Weight Calculation: Custom multi-threaded fallback algorithms for distance-based bone influence mapping.
- Kinematics: Integrated CCDIK solver to handle complex joint rotations avoiding gimbal lock via Quaternion slerp chains.
The primary export of auto-rig-web is the AutoRigger class.
import { AutoRigger } from 'auto-rig-web';
const rigger = new AutoRigger({ skinningFalloff: 2.5 });
await rigger.init();Analyzes the input static mesh, predicts joint locations, constructs a skeleton, and calculates procedural skin weights. Returns an IK-ready SkinnedMesh.
Assigns a 3D target for a specific joint to pull towards.
rigger.setIKTarget({ joint: JointType.LeftHand, position: new THREE.Vector3(1, 2, 0), influence: 1.0 });Solves the Inverse Kinematics chains for the current frame. Call this inside your requestAnimationFrame loop.
import { useFrame } from '@react-three/fiber';
import { AutoRigger } from 'auto-rig-web';
const rigger = new AutoRigger();
// ... inside component ...
const riggedMesh = await rigger.rig(staticMesh);
useFrame(() => rigger.animate());<script setup>
import { useRenderLoop } from '@tresjs/core';
import { AutoRigger } from 'auto-rig-web';
const rigger = new AutoRigger();
const riggedMesh = await rigger.rig(staticMesh);
useRenderLoop().onLoop(() => rigger.animate());
</script>import { AutoRigger } from 'auto-rig-web';
const rigger = new AutoRigger();
await rigger.init();
const riggedMesh = await rigger.rig(mesh);
function animate() {
requestAnimationFrame(animate);
rigger.animate();
renderer.render(scene, camera);
}
animate();Apache 2.0 Β© n1khy
A component of the Lunar Paradox applied systems & graphics laboratory. Engineered by n1khy.