by hoainho
Rebuild the object in a reference image as a code-only, procedural, quality-gated, animation-ready Three.js model. Token-efficient image-to-3D.
# Add to your Claude Code skills
git clone https://github.com/hoainho/img2threejsimg2threejs is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by hoainho. Rebuild the object in a reference image as a code-only, procedural, quality-gated, animation-ready Three.js model. Token-efficient image-to-3D. It has 85 GitHub stars.
img2threejs's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/hoainho/img2threejs" and add it to your Claude Code skills directory (see the Installation section above). img2threejs ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
img2threejs is primarily written in Python. It is open-source under hoainho on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh img2threejs against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
Rebuild the object visible in a reference image as a code-only procedural Three.js model, gated by a staged sculpting pipeline and an AI-vision self-correction loop. This is reconstruction-by-code, not photogrammetry, mesh extraction, or downloaded art packs.
Agent-agnostic: works under Claude Code, Codex, or OpenCode. Wherever this doc says "agent vision" or "agent browser tool", use whatever the host provides — native image reading, a browser MCP (playwright/chrome-devtools), the project preview, or a user-supplied screenshot.
The user attaches/points to an object image and wants a procedural Three.js model, a reconstruction/animation/destruction plan, a sculpt spec, or code. Also for material studies, action-ready props, game objects, botanical/mechanical parts, and stylized reconstructions.
Sculpt from a photo, in order — never one-shot a mesh:
references/validation-rubric.md).qualityContract before any code.State explicitly when output is approximate/stylized/low-poly. A single image cannot reveal hidden sides or guarantee exact geometry — say so instead of faking confidence.
Run scripts from the skill root (scripts/...). Pure Python 3.10+ stdlib, no pip installs.
Full flags: references/scripts.md. Never let a script score visuals — that is the agent's job.
scripts/probe_reference_image.py <image> (metadata only, not a visual check).scripts/new_pre_spec_assessment.py "Name" --image <img> --complexity <simple|moderate|complex|ultra-complex> --out assessment.json. Rules: references/pre-spec-assessment.md.
Set objectClass.primaryDomain (object | character | hybrid) and fill the seeded
detailInventory (its targetMinDetails scales with complexity).
2b. Detail inventory (do not skip for detailed subjects) — scan zones and enumerate every
identity-defining small detail (gloss, bevel, fasteners, linework, contours, stains):
scripts/build_detail_inventory.py <image> --mode grid-3x3 --out-dir <dir> --out di.json.
Each detail MUST map to a component.localFeatures or material.localOverrides entry — never
prose only. Taxonomy + 3D-term recipes: references/detail-inventory.md.
2c. Character/hybrid subjects — capture head-unit proportions + facial/body landmarks:
scripts/extract_reference_landmarks.py <image> --out anatomy.json --overlay overlay.png, then
fill preSpecAssessment.anatomy. Route: references/character-reconstruction.md. For maximum
likeness use the projection-first path (references/likeness-maximization.md): solve the camera
(solve_reference_camera.py), de-light the photo (delight_reference.py), and project it onto
the fitted mesh (bake_projected_texture.py). A single image cannot guarantee 100% likeness —
report per-region confidence and request more views for a real person.scripts/new_sculpt_spec.py "Name" --image <img> --assessment assessment.json --out object-sculpt-spec.json.
Replace generic starter featureReviewTargets with the object's real identity-defining
systems (≤5 critical, ≤3 important per pass); for characters add anatomy-proportion,
face-landmark-placement, pose-silhouette, outfit-and-palette. Use 3D-graphics terms only
(references/3d-graphics-terminology.md), never "nice/smooth/shiny".scripts/extract_reference_pbr.py <crop> --out-dir <dir> --material-id <id> --target-threshold 0.7.
Confidence < 0.7 is a stop/refine-input signal, not a pass. It is inference, not inverse rendering.scripts/validate_sculpt_spec.py object-sculpt-spec.json then --strict-quality.
Strict blocks shallow specs (a complex object with one root, no repetition systems, no
local overrides, no micro groups is NOT implementation-ready even if JSON validates).scripts/sculpt_pass_orchestrator.py status object-sculpt-spec.json
scripts/sculpt_pass_orchestrator.py check object-sculpt-spec.json --pass-id <pass>
scripts/generate_threejs_factory.py object-sculpt-spec.json --out src/createObjectModel.ts
(generator is pass-gated: a future --pass-id fails until prior passes are reviewed continue).scripts/make_visual_comparison_sheet.py --reference <img> --render <shot> --out cmp.png --json.scripts/append_sculpt_review.py object-sculpt-spec.json --pass-id <pass> --fidelity <0-1> --action <continue|refine-spec|refine-code|request-input|stop> --summary "..." --render-screenshot <shot> --comparison-image cmp.png --ai-vision-score <0-1> --layer-scores-json '{...}' --feature-reviews-json <f.json> --in-place.scripts/sculpt_pass_orchestrator.py sync object-sculpt-spec.json --in-place.references/validation-rubric.md.continue is allowed only with a render + comparison sheet + global
AI-vision score ≥ threshold (default 0.7) AND every critical feature ≥ its own threshold.
Details + per-layer scorecard: references/browser-screenshot-feedback.md.root.userData.sculptRuntime. references/action-ready-models.md.attachment.parentSocket,
localStart, localEnd, contactType, embedDepth/overlap, gapTolerance — no mid-air parts.
references/attachment-joint-correctness.md.references/material-lighting-realism.md — independent PBR channels
(never alias albedo into roughness/normal/AO), macro/meso/micro frequency bands, real lights.moderate+ subjects strict-quality blocks code gen until the
detailInventory reaches targetMinDetails and every detail maps to a real component/material
entry (gloss needs low-roughness/clearcoat; fasteners need instancing/micro parts).primaryDomain is character/hybrid (or --character), the spec
author auto-builds a stylized humanoid template (head/neck/torso/arms + hair, glasses,
headphones, face features), flattened to world space under a hidden root, with per-part
character materials and character build passes (proportion-lock, feature-placement).
strict-quality requires a filled anatomy block (head-units, proportions, face landmarks) and
character feature targets. Suitability routing for humans: references/validation-rubric.md
(stylized vs maximum-likeness). Stylized bust, not a face-copy; refine positions per reference.After every pass, decide exactly one: continue | refine-spec | refine-code | request-input | stop.
refine-spec fixes a wrong/missing/shallow spec (re-validate, don't patch code around it);
refine-code fixes geometry/material/lighting that doesn't match a sound spec. Full root-cause
guide + fidelity scale: references/self-correction-loop.md.
TypeScript + plain Three.js unless the project uses a wrapper. Group factory
createObjectNameModel(spec, options), reconstruction data kept separate from renderer objects,
deterministic seeds for all procedural noise. Prefer primitives / Shape extrude / curve+tube /
instancing / displacement / generated canvas textures before any external art. Full geometry &
material recipes + hard-won failure patterns: references/procedural-patterns.md.
Rebuild the object in a reference image as a code-only, procedural Three.js model.
Quality-gated, animation-ready, and deliberately token-efficient — reconstruction-by-code, not photogrammetry, mesh extraction, or downloaded art packs.

A single reference image reconstructed in code — correct proportions, colours, bevels, gold trim, and an emissive emblem — running live in the browser.
Every model in the gallery is generated code, running in your browser. No mesh files, no downloads.
Reconstructions built entirely from primitives, procedural shaders, and generated geometry. The clips below are the live models running in-browser — open each one to orbit it and read the generated source.
| Demo | Preview | Subject | View | Source |
|---|---|---|---|---|
| Sony WF-1000XM3 Earbuds + Case | hard-surface object | Live | code | |
| ISSACA 12 Gauge Shotgun | hard-surface object | Live | code | |
| Gerber Paracord Knife | hard-surface object | Live | code | |
| Doraemon House (isometric diorama) | hard-surface object | Live | code | |
| War-Hauler "SECTOR 07" | hard-surface object | Live | code | |
| Crowned Loot Chest | hard-surface object | Live | code |
The gallery source lives in hoainho/img2threejs-showcase. If this project is useful, a star on this repo helps others find it.
You give it one reference image of an object. It produces a THREE.Group factory written in TypeScript that recreates that object from primitives, procedural shaders, and generated geometry — with a runtime hierarchy (pivots, sockets, colliders) so the result is ready to animate, not an inert lump.
It runs under Claude Code, Codex, or OpenCode. It is agent-agnostic: wherever the docs say "agent vision" or "agent browser tool", it uses whatever the host provides — native image reading, a browser MCP, the project preview, or a user-supplied screenshot.
object, character, or hybrid. Objects follow the hard-surface pipeline; characters route through an anatomy-aware track (head-unit proportions, facial landmarks, pose) documented in references/character-reconstruction.md.detailInventory of identity-defining small details (gloss, bevel/rounding, screws/rivets, engraved or painted linework, contours, stains and wear). Every detail must map to a real component or material entry, and a strict-quality gate blocks generation until the inventory is complete. Taxonomy: references/detail-inventory.md.references/likeness-maximization.md.The skill runs a staged sculpting pipeline. Scripts gate each stage; the agent's vision is the only thing that can approve a pass.
flowchart TD
A[Reference image] --> B[Probe and suitability gate]
B --> C[Pre-Spec Assessment: class, complexity, quality contract]
C --> D[Author ObjectSculptSpec: components, materials, sockets]
D --> E{Validate and strict-quality}
E -- too shallow --> D
E -- ok --> F[Locked build passes]
F --> G[Generate Three.js factory: current pass only]
G --> H[Render in browser and screenshot]
H --> I[Package one side-by-side sheet]
I --> J{Agent vision review}
J -- score below threshold --> K[Self-correct: refine-spec or refine-code]
K --> F
J -- pass --> L{More passes?}
L -- yes --> F
L -- no --> M[Animation-ready Three.js model]
The model is sculpted in a fixed order; a pass unlocks only after the previous one is reviewed and accepted:
blockout → structural-pass → form-refinement → material-pass → surface-pass → lighting-pass → interaction-pass → optimization-pass
Each pass has its own acceptance criteria. A pass is marked continue only with a real render, a comparison sheet, an agent-vision score at or above threshold, and every identity-defining feature at or above its own threshold.
continue requires a render plus a comparison sheet plus a passing vision score.root.userData.sculptRuntime.After every pass the agent chooses exactly one action: continue, refine-spec, refine-code, request-input, or stop. refine-spec fixes a wrong or shallow spec and re-validates; refine-code fixes geometry, material, or lighting that does not match a sound spec.
Install — place this folder in your skills directory:
git clone https://github.com/hoainho/img2threejs.git ~/.claude/skills/img2threejs
Invoke — in Claude Code, attach or point to an object image and run:
/img2threejs Rebuild this object as a Three.js model, keep the proportions, angles, and colours.
Follow the pipeline — the skill validates the image, writes an assessment and spec, generates the factory pass by pass, and shows you a side-by-side comparison at each step until the render matches.
The scripts run from the skill root and need only Python 3.10+ — nothing to install.
python3 scripts/probe_reference_image.py <image>
python3 scripts/new_pre_spec_assessment.py "Name" --image <image> --out assessment.json
python3 scripts/new_sculpt_spec.py "Name" --image <image> --assessment assessment.json --out spec.json
python3 scripts/validate_sculpt_spec.py spec.json --strict-quality
python3 scripts/generate_threejs_factory.py spec.json --out src/createObjectModel.ts
Most image-to-3D agent loops burn tokens by asking the model to do mechanical work — re-reading the whole model every pass, scoring pixels, validating JSON by hand, re-running steps it already did. img2threejs pushes all of that into deterministic scripts and spends model tokens only where judgment is actually required.
struct and zlib. Nothing to install means nothing to debug in-context.