{
 "id": "fabrik-ik",
 "title": "FABRIK inverse kinematics",
 "aliases": [
  "Forward And Backward Reaching Inverse Kinematics"
 ],
 "domain": "simulation",
 "subdomain": "inverse kinematics",
 "stage": "simulation",
 "realtime": "realtime",
 "platforms": [
  "cpu",
  "webgl2",
  "webgpu",
  "unity",
  "unreal",
  "godot"
 ],
 "year_introduced": 2011,
 "inputs": [
  "skeleton"
 ],
 "outputs": [
  "skeleton",
  "animation"
 ],
 "style": "both",
 "dynamic": "dynamic",
 "summary": "Heuristic IK solver that moves joints along lines (backward from the target, forward from the root) instead of rotating angles, converging fast with natural motion.",
 "how_it_works": "Treat the chain as points. The backward pass places the end effector on the target and, moving toward the root, positions each joint on the line from the next joint at its original bone-length distance. The forward pass then fixes the root back at its base and repeats outward. Iterating the two passes converges in a few iterations. If the target is unreachable the chain simply stretches in a line towards it. Joint limits are applied by clamping or re-projecting directions after each placement. Branched chains (fingers, spines with arms) are handled by solving sub-chains and averaging at the junction.",
 "when_to_use": "Choose it for foot placement, hands reaching, tentacles, tails and procedural spiders where robustness and simplicity beat exact joint control. Prefer analytic two-bone IK for arms and legs when you need exact elbow/knee control, Jacobian-based IK for tight constraints, and `motion-matching` or authored animation when the pose quality matters more than reaching accuracy.",
 "cost": {
  "class": "cheap",
  "notes": "Cheap: a few passes over a handful of joints."
 },
 "failure_modes": [
  "Joint-limit handling is approximate and can oscillate",
  "No natural twist control: needs a pole/up vector added separately",
  "Ambiguous solutions flip between frames without a bias towards the previous pose",
  "Multi-chain solutions with end effectors in conflict converge unpredictably"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1016/j.gmod.2011.05.003",
   "type": "paper",
   "title": "FABRIK: A fast, iterative solver for the Inverse Kinematics problem",
   "authors": [
    "Andreas Aristidou",
    "Joan Lasenby"
   ],
   "year": 2011,
   "venue": "Graphical Models",
   "url": "https://doi.org/10.1016/j.gmod.2011.05.003",
   "ids": {
    "doi": "10.1016/j.gmod.2011.05.003"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/j.gmod.2011.05.003",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/j.gmod.2011.05.003",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/j.gmod.2011.05.003",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/j.gmod.2011.05.003",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/j.gmod.2011.05.003",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "aristidou2011fabrik"
  },
  {
   "role": "tutorial",
   "key": "url:http://www.andreasaristidou.com/FABRIK.html",
   "type": "tutorial",
   "title": "FABRIK - Forward And Backward Reaching Inverse Kinematics",
   "authors": [
    "Andreas Aristidou"
   ],
   "year": null,
   "venue": "andreasaristidou.com",
   "url": "https://www.andreasaristidou.com/FABRIK.html",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20251126220606/http://www.andreasaristidou.com/FABRIK.html",
     "timestamp": "20251126220606"
    },
    "page_title": "FABRIK - Forward And Backward Reaching Inverse Kinematics",
    "host": "andreasaristidou.com",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET http://www.andreasaristidou.com/FABRIK.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET http://www.andreasaristidou.com/FABRIK.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET http://www.andreasaristidou.com/FABRIK.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "aristidoufabrik"
  }
 ],
 "presets": [
  {
   "id": "fabrik-ik-specimen",
   "title": "FABRIK on a 5-joint chain: pose after 1 vs 6 backward/forward sweeps",
   "runtime": "glsl-fragment",
   "params": {
    "J": 5,
    "ITER": 6,
    "SEG": 0.2
   },
   "code": "// FABRIK on a 5-joint chain: orange = pose after 1 iteration, white = after 6; target moves with time.\nconst int J = 5;\nconst int ITER = 6;\nconst float SEG = 0.2;\nfloat segd(vec2 p, vec2 a, vec2 b) {\n    vec2 pa = p - a, ba = b - a;\n    return length(pa - ba * clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0));\n}\nvoid solve(inout vec2 p[J], vec2 base, vec2 tgt, int iters) {\n    for (int it = 0; it < ITER; it++) {\n        if (it >= iters) break;\n        p[J - 1] = tgt;\n        for (int i = J - 2; i >= 0; i--) p[i] = p[i + 1] + normalize(p[i] - p[i + 1]) * SEG;\n        p[0] = base;\n        for (int i = 1; i < J; i++) p[i] = p[i - 1] + normalize(p[i] - p[i - 1]) * SEG;\n    }\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = fragCoord / iResolution.xy;\n    vec2 base = vec2(0.5, 0.12);\n    vec2 tgt = vec2(0.5 + 0.34 * cos(iTime * 1.3), 0.45 + 0.25 * sin(iTime * 1.3 + 0.5));\n    vec2 a[J], b[J];\n    for (int i = 0; i < J; i++) { a[i] = base + vec2(0.04 * float(i), SEG * float(i)); b[i] = a[i]; }\n    solve(a, base, tgt, 1);\n    solve(b, base, tgt, ITER);\n    vec3 col = mix(vec3(0.05, 0.06, 0.09), vec3(0.1, 0.12, 0.17), uv.y);\n    float reach = SEG * float(J - 1);\n    col = mix(col, vec3(0.2, 0.25, 0.35), smoothstep(0.004, 0.0, abs(length(uv - base) - reach)) * 0.6);\n    float da = 1e9, db = 1e9, jd = 1e9;\n    for (int i = 0; i < J - 1; i++) { da = min(da, segd(uv, a[i], a[i + 1])); db = min(db, segd(uv, b[i], b[i + 1])); }\n    for (int i = 0; i < J; i++) jd = min(jd, length(uv - b[i]));\n    col = mix(col, vec3(1.0, 0.55, 0.2), smoothstep(0.008, 0.005, da) * 0.8);\n    col = mix(col, vec3(0.95), smoothstep(0.012, 0.009, db));\n    col = mix(col, vec3(0.2, 0.5, 1.0), smoothstep(0.02, 0.016, jd));\n    float tg = length(uv - tgt);\n    col = mix(col, vec3(0.3, 1.0, 0.4), smoothstep(0.004, 0.0, abs(tg - 0.025)) + smoothstep(0.01, 0.007, tg));\n    col = mix(col, vec3(1.0, 0.9, 0.3), smoothstep(0.022, 0.018, length(uv - base)));\n    fragColor = vec4(pow(col, vec3(0.8)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "fabrik-ik",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.1596,
      "std": 0.1042,
      "unique_colors": 91
     },
     "image": "/specimens/fabrik-ik-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "linear-blend-skinning",
  "motion-matching",
  "dual-quaternion-skinning"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/simulation/fabrik-ik.json"
 },
 "solves": [
  "feet or hands need to reach a target naturally",
  "tentacles and tails should follow a moving point",
  "jacobian ik is unstable or too complex to implement",
  "procedural spider legs must plant on terrain"
 ],
 "authority": "Aristidou & Lasenby, 2011",
 "url": "https://texelatlas.vercel.app/t/fabrik-ik/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 11.02,
  "tier": "moderate",
  "p50_ms": 0.3625,
  "p95_ms": 0.3691,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "fabrik-ik-specimen",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 8.73,
   "tier": "moderate",
   "p50_ms": 0.1388,
   "p95_ms": 0.1416,
   "speedup_x": 2.61,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 7.58,
   "tier": "moderate",
   "p50_ms": 0.2183,
   "p95_ms": 0.2184,
   "speedup_x": 1.66,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}