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.
$ npx -y skills add img2threejs/img2threejs --agent claude-code
Run the curl in your terminal, the rest in Claude Code.
Repo: img2threejs/img2threejs
What's inside
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.
Reference images reconstructed in code as animation-ready Three.js models, 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. Open any model to orbit it, inspect its reference, and read the generated source.
| Demo | Subject | View | Source |
|---|---|---|---|
| Glock-18 · Ghost Protocol (Well-Worn) | CS2 weapon | Live | code |
| Classic Knife · Fade (Minimal Wear) | CS2 weapon | Live | code |
| BMX Endurance Bike | hard-surface object | Live | code |
| M9 Bayonet · Doppler Phase 2 | CS2 weapon | Live | code |
| 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) | diorama | Live | code |
| War-Hauler "SECTOR 07" | hard-surface object | Live | code |
| Crowned Loot Chest | hard-surface object | Live | code |
The gallery source lives in img2threejs/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 grimoire/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: grimoire/intake/detail_inventory.md.grimoire/character/likeness_maximization.md.geometryDescriptor.visualHull intersects at least two deterministic orthographic binary silhouettes into a bounded, welded voxel mesh. It records unseen areas as low-confidence rather than inventing hidden detail. Schema and runtime check: grimoire/scripts.md.docs/cs2/review-gates.md.forge/state.py records an ordered, evidence-backed intake/pass checklist for generic, character, and CS2 profiles. forge/next.py --state resumes from that checklist while the existing spec, render, and review gates remain authoritative.ObjectSculptSpec, rendered from controlled camera views, and accepted only after a per-region comparison gate. See docs/materials/README.md.grimoire/build/python_threejs_render_bridge.md.A staged sculpting pipeline turns the reference image into a spec, then generates and vision-reviews one build pass at a time — blockout → structural → form → material → surface → lighting → interaction → optimization — self-correcting until every identity-defining feature clears its threshold.
→ Full pipeline diagram, gates, self-correction logic, and the token-efficiency design: docs/ARCHITECTURE.md
A staged sculpting pipeline turns the reference image into a spec, then generates and vision-reviews one build pass at a time — blockout → structural → form → material → surface → lighting → interaction → optimization — self-correcting until every identity-defining feature clears its threshold. Deterministic Python scripts handle validation and gating; model tokens are spent only on visual judgment and code.
→ Full pipeline diagram, gates, self-correction logic, script reference, and the token-efficiency design: docs/ARCHITECTURE.md
Install — place this folder in your skills directory:
git clone https://github.com/img2threejs/img2threejs.git ~/.claude/skills/img2threejs
If you use more than one host, keep a single checkout and point each entrypoint at it as a symlink, so they cannot drift apart:
~/.claude/skills/img2threejs -> <your checkout>
~/.codex/skills/img2threejs -> <your checkout>
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.
That is enough: the skill classifies the subject, runs the detail inventory, and gates every pass on its own.
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.
For a multi-session reconstruction, create a local state index first:
python3 forge/state.py init --reference <image> --profile character --spec object-sculpt-spec.json
python3 forge/next.py --state .img2threejs/state.json
The one-liner leaves the judgement calls to the skill. When you already know what "correct" means for your subject, say so — each line below maps onto a real gate or artifact in the pipeline, so it changes what gets enforced rather than just adding adjectives:
/img2threejs Rebuild the subject in this image as a procedural Three.js model.
Fidelity Hold proportions and silhouette to the reference. Enumerate the identity-defining
details first — bevels and rounding, panel seams, fasteners, engraved or painted
linework, gloss vs matte zones, wear — and drop any detail you cannot place on a
real component instead of faking it.
Materials Derive the finish class and gradient stops from the reference pixels, not from
memory. Flag any colour that will not survive tone-mapping.
Runtime Expose pivots and sockets for whatever should move, plus a userData.tick for a
looping idle animation.
Gates Run --strict-quality, and do not advance a pass until the side-by-side review
passes. Report per-region confidence for anything the image cannot show.
Useful additions depending on the subject:
Maximize likeness: fit the parametric template to the landmarks, de-light and camera-match the reference, then project it. Tell me which regions are inferred.This is a creature, not a humanoid — use the quadruped body plan and the body-unit proportion system.The coat is candy-coat, not gem-metal. Keep the hue; do not let the environment steal it.Stay at low effort and skip the presentation composer; I only need the evaluation render.The scripts run from the skill root and need only Python 3.10+ — nothing to install.
python3 forge/stage1_intake/probe_image.py <image>
python3 forge/stage2_spec/new_pre_spec_assessment.py "Name" --image <image> --out assessment.json
python3 forge/stage2_spec/new_sculpt_spec.py "Name" --image <image> --assessment assessment.json --out spec.json
python3 forge/stage2_spec/validate_sculpt_spec.py spec.json --strict-quality
python3 forge/stage3_build/generate_threejs_factory.py spec.json --out src/createObjectModel.ts
The factory generator repeats the strict-quality gate and is fail-closed: on failure it returns
BLOCKED with the spec artifact, failure metrics, causes, and next action, and does not write a
factory. --allow-nonstrict is only for explicit legacy test fixtures, never production output.
For the script-by-script reference, the full scripts table, and expected artifacts, see docs/ARCHITECTURE.md.
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.The net effect: you still get a faithful 3D model from an image, but the expensive model context is reserved for visual judgment and code, not bookkeeping. For the full per-stage and per-cycle token breakdown, see docs/TOKEN_COST.md.
| Script | Role |
|---|---|
stage1_intake/probe_image.py | Image metadata and obvious technical issues (not a visual check). |
stage2_spec/new_pre_spec_assessment.py | Classify the object, score complexity, emit a quality contract. |
stage2_spec/new_sculpt_spec.py | Author the ObjectSculptSpec from the assessment. |
stage2_spec/validate_sculpt_spec.py | Validate the spec; --strict-quality blocks shallow specs before codegen. |
stage1_intake/extract_pbr_evidence.py | Reference-derived PBR evidence per crop (inference, not inverse rendering). |
stage1_intake/material_region_analysis.py | Crop material regions, run texture/PBR evidence, and resolve registry profiles. |
stage2_spec/apply_material_analysis.py | Wire region assignments, priors, maps, and provenance into ObjectSculptSpec. |
stage3_build/orchestrate_passes.py | Locked pass state: status, check, sync. |
stage3_build/generate_threejs_factory.py | Emit the Three.js Group factory for the current unlocked pass. |
stage4_review/material_views.py | Emit multi-angle, zoomed, microscope, environment, and capture-readback contracts. |
stage4_review/material_comparator.py | Compare the visible material crop and classify per-channel mismatches. |
stage4_review/material_feedback.py | Apply bounded, material-scoped corrections through the existing stop policy. |
stage4_review/material_gate.py | Block material-pass until registry, crop, render, compatibility, and comparison evidence passes. |
stage4_review/make_comparison_sheet.py | Package one reference-vs-render sheet for review. |
stage4_review/append_review.py | Record a per-pass review: scores, decision, evidence. |
stage4_review/cs2_review.py | Evaluate the blocking CS2 knife review contract and versioned scene thresholds. |
_shared/feature_acceptance_policy.py | Internal helper enforcing per-feature score thresholds. |
stage1_intake/build_detail_inventory.py | Slice the reference into zones and scaffold a detail inventory. |
stage1_intake/extract_landmarks.py | Overlay a landmark grid and scaffold an anatomy block for characters. |
stage1_intake/solve_camera_pose.py | Emit a reference-camera block so the render can be camera-matched. |
stage1_intake/delight_albedo.py | Approximate a neutral albedo from the photo before texture projection. |
stage3_build/bake_projected_texture.py | Emit a projection/UV-bake descriptor for photo-texture projection. |
The grimoire/ folder holds the detailed rubrics each gate applies (validation, pre-spec assessment, procedural patterns, material and lighting realism, attachment correctness, action-ready models, self-correction).
The stdlib-only core can use an isolated evidence layer without taking on runtime dependencies:
SAM2 component masks, Depth Anything V2 relative-depth priors, MediaPipe face/pose landmarks,
Chrome DevTools diagnostics, Three.js scene inspection, Playwright cross-browser fallback, and
version-aware Context7 retrieval. These tools never approve a pass or silently provide geometry.
Install, routing, provenance rules and exact commands:
docs/integrations/reference_fidelity_tooling.md.
ObjectSculptSpec JSON: the full component tree, materials, repetition systems, sockets, and a recorded review history for every pass.createObjectNameModel(spec, options) factory returning a THREE.Group, with root.userData.sculptRuntime exposing nodes, sockets, colliders, and destruction groups.Shipped:
animalAnatomy spec, spine-loft geometry, ΔE00 colour gates.Next — one theme per release:
The arc: assets (v1.4–v1.5) → worlds (v1.6–v1.7) → production (v1.8–v1.9) → an AI game-asset platform that generates playable worlds from reference images (v2.0).
→ Full roadmap — per-version detail, the four-phase long view, and the tracked capability gaps: ROADMAP.md. Technical specification: docs/UPGRADE_PLAN.md.
A single image cannot reveal hidden sides or guarantee exact geometry. The skill states plainly when output is approximate, stylized, or low-poly, and infers unseen faces by mirroring visible ones rather than faking confidence. It is strong for hard-surface objects; characters are stylized reconstructions, not photoreal likeness. "This cannot reach the requested fidelity from this image" is a valid, expected result.
If img2threejs is useful to you, a star helps others find it.
img2threejs is free and open source. If it saved you time or found its way into your project, consider supporting continued development:
VietQR / MoMo / PayPal also work — see the donate page. VietQR / MoMo / PayPal also work — see the donate page.
Atlas Cloud is a full-modal AI inference platform that gives developers a single AI API to access video generation, image generation, and LLM APIs. Instead of managing multiple vendor integrations, you connect once and get unified access to 300+ curated models across all modalities. Check out Atlas Cloud's new coding plan promotion for more budget-friendly API access: https://www.atlascloud.ai/console/coding-plan
Contributions are welcome — procedural material recipes, new gates, host coverage, and demos especially. See CONTRIBUTING.md and the roadmap for where the project is headed.
Apache License 2.0. See LICENSE.
.github/
FUNDING.yml
ISSUE_TEMPLATE/
bug_report.yml
contribution_intent.yml
feature_request.yml
pull_request_template.md
release.yml
workflows/
beta-release.yml
ci.yml
issue-triage.yml
pr-issue-close-policy.yml
release.yml
.gitignore
assets/
logo.svg
sponsors/
atlas-cloud-logomark-black.svg
atlas-cloud-logomark-white.svg
CHANGELOG.md
CLAUDE.md
CONTRIBUTING.md
docs/
ARCHITECTURE.md
cs2/
cs2-anatomy/
gloves.md
heavy.md
knives.md
pistols.md
rifles.md
smgs.md
snipers.md
3D_Technical_Mapping.json
3D_Technical_Reference.md
3D_Vocabulary_CS2_Dictionary.md
3D_Vocabulary_CS2.json
distill.md
review-gates.md
integrations/
reference_fidelity_tooling.md
issue-triage.md
materials/
IMAGE_MATERIAL_ANALYSIS.md
material-reference.json
README.md
THREEJS_MATERIAL_REFERENCE.md
raw/
.keep
img2threejs-skill-dataset.json
RESEARCH_TRELLIS2_TO_IMG2THREEJS.md
specs/
render-profile.v2.example.json
render-profile.v2.schema.json
vocabulary/
core_3d_reconstruction.jsonl
core_3d.jsonl
cs2_reconstruction.jsonl
cs2.jsonl
README.md
TOKEN_COST.md
UPGRADE_PLAN.md
forge/
_shared/
artifact_cache.py
color_metrics.py
feature_acceptance_policy.py
image_hash.py
jpeg.py
pipeline_routing.py
sdf_primitives.py
spec_search_profiles.json
spec_search.py
status_banner.py
subdivision.py
workflow_state.py
materials/
__init__.py
compatibility.py
reference.py
next.py
report.py
requirements.txt
stage1_intake/
analyze_texture.py
bind_detail_properties.py
build_detail_inventory.py
camera_fitting_math.py
camera_fitting_solver.py
camera_fitting_types.py
camera_image_helpers.py
check_intake_correctness.py
check_reference_admission.py
cs2_foundation.py
cs2_manifest.py
cs2_review_contract.py
delight_albedo.py
detect_cs2.py
detect_reference_effects.py
extract_cs2_textures.py
extract_gradient_stops.py
extract_landmarks.py
extract_part_color_recipe.py
extract_pbr_evidence.py
fetch_cs2_metadata.py
locate_cs2_vpk.py
material_region_analysis.py
probe_glb.py
probe_image.py
run_vision_adapter.py
search_specs.py
semantic_decomposition.py
solve_camera_pose.py
stage2_spec/
apply_material_analysis.py
cs2_adapters.py
derive_geometry.py
humanoid_proportions.py
new_pre_spec_assessment.py
new_sculpt_spec.py
validate_sculpt_spec.py
stage3_build/
bake_projected_texture.py
decimate.py
generate_threejs_factory.py
module_cache.py
morph_targets.py
orchestrate_passes.py
uv_unwrap.py
visual_hull.py
stage4_review/
_fit_divine_eye.py
append_review.py
attachment_anchor.py
calibrate_eye.py
check_part_coverage.py
compare_region_passes.py
correction_loop.py
cs2_review.py
diagnose_render_multi_angle.py
diagnose_render.py
divine_eye.py
fit_params.py
geometry_integrity.py
joint_loops.py
make_comparison_sheet.py
material_comparator.py
material_feedback.py
material_gate.py
material_views.py
mesh_reference_compare.py
multi_pass.py
objectness.py
pairwise_penetration.py
per_feature.py
render_bridge.py
self_intersection.py
turntable_gate.py
validate_render_profile.py
vlm_gate.py
stage5_rig/
__init__.py
emit_rig.py
geodesic_skinning.py
NOTES.md
rig_spec.py
validate_rig_payload.py
state.py
tests/
fixtures/
implicit_character_torso_limb.json
knife_review_scene.json
subdivision_cage.json
visual_hull_two_views.json
showcase_test_support.py
test_analyze_texture.py
test_attachment_anchor.py
test_calibrate_eye.py
test_camera_fitting_cli.py
test_camera_fitting_safety.py
test_camera_fitting.py
test_character_rig_derivation.py
test_color_metrics.py
test_color_recipe.py
test_correction_loop.py
test_cs2_foundation.py
test_cs2_manifest.py
test_cs2_review.py
test_decimation_wiring.py
test_divine_eye.py
test_fit_params.py
test_geodesic_skinning.py
test_geometry_derivation.py
test_glb_reference.py
test_gradient_stops.py
test_hierarchy_scale.py
test_hue_zone_parity.py
test_humanoid_proportions.py
test_humanoid_silhouette_profile.py
test_intake_binding.py
test_issue_triage.py
test_joint_admission_gate.py
test_joint_loops.py
test_jpeg.py
test_material_pipeline.py
test_material_reference.py
test_module_cache.py
test_multi_angle.py
test_objectness.py
test_optional_vision_tooling.py
test_part_collision_morphs_lod.py
test_per_feature.py
test_pipeline_routing.py
test_pipeline.py
test_primitive_watertightness.py
test_recessed_and_open_shell_topology.py
test_reference_admission.py
test_reference_effects.py
test_release_metadata.py
test_render_bridge.py
test_render_profile.py
test_repetition_system_scale.py
test_rig_hierarchy_emission.py
test_rig_milestone0.py
test_sdf_primitives.py
test_search_specs.py
test_self_intersection.py
test_showcase_tsc_smoke.py
test_specular_wash.py
test_structure_gates.py
test_subdivision.py
test_tessellation_tiers.py
test_tier1_diagnostics.py
test_turntable_gate.py
test_uv_unwrap.py
test_validate_rig_payload.py
test_visual_hull_carve.py
test_visual_hull.py
test_vlm_gate.py
test_workflow_state.py
test_ws6_docs.py
grimoire/
build/
analysis_by_synthesis_fitting.md
cs2_finishes.md
geometry_patterns.md
implicit_sdf_modeling.md
python_threejs_render_bridge.md
subdivision_surfaces.md
threejs_texture_reference.md
visual_hull_reconstruction.md
character/
head_construction.md
likeness_maximization.md
reconstruction.md
structure_decomposition.md
stylized_hair_threejs.md
threejs_hair_parameter_contract.json
feedback/
render_capture.md
shading_realism.md
glossary/
3d_vocabulary.md
intake/
cs2_intake_contract.md
cs2_technical_analysis.md
cs2_texture_acquisition.md
detail_inventory.md
image_analysis.md
local_spec_search.md
quality_contract.md
surface_topology.md
validation_rubric.md
readiness/
action_rigging.md
joint_attachment.md
procedural_rigging_contract.md
standard_character_pipeline.md
review/
divine_eye_microscope.md
gates_reference.md
self_correction.md
scripts.md
integrations/
mesh3d/
generate_reference_mesh.py
vision/
.python-version
pyproject.toml
README.md
reference_vision.py
uv.lock
LICENSE
README.md
ROADMAP.md
scripts/
capture_threejs_playwright.py
character_audit.sh
issue_triage.py
release_metadata.py
SKILL.md
skills/
cs2_technical_analysis.md
cs2-knife.md
cs2-pistol.md
generic-extract-skill.mdFAQ
img2threejs is a Claude Code plugin with 1 hand-picked skill for content work, indexed on Flowy. Install it with the command on its page. It includes img2threejs. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.