img2threejs: Turn an image into editable Three.js code

Back
Kevin Riedl

10 min read · 7 Nov 2026
Last reviewed

Next
Made on your device, with no Instagram connection. We copy the post link for Instagram’s Link sticker.

A product photo shows your desk lamp. A configurator also needs a shade that changes colour and a head that rotates around the correct hinge. The model needs distinct parts that your application can control.

img2threejs is an agent skill that rebuilds a reference image as a procedural Three.js model written in TypeScript. It gives your coding agent a staged reconstruction workflow. The output is source you can inspect and change, with an object hierarchy that can support interactions. The official img2threejs repository explains that contract.

Sources checked: . This guide draws on project documentation and generator source at release v2.0.1. The lamp example and acceptance checks are proposed exercises; we have not run an image reconstruction or measured its speed, fidelity or cost.

img2threejs.org identifies itself as a separate hosted service. Its Native Mesh pipeline and download packages are not features of the GitHub skill covered here.

What does img2threejs generate?

img2threejs produces a structured reconstruction specification and TypeScript that builds a Three.js object. Your agent provides visual judgment; scripts validate the specification and control stage progression. An application must display and operate the finished model.

The pipeline architecture describes the sequence from blockout through structure, form, materials, surface detail, lighting, interaction and optimisation. In practical terms:

  1. The agent studies the reference and records visible features and uncertainty.
  2. It describes components, materials and their relationships in a specification.
  3. Code builds the current stage, which is rendered in a browser.
  4. The agent compares that render with the reference and corrects deficiencies before advancing.

The inspected TypeScript factory generator derives the function name from the target name. That function takes one options object and returns a THREE.Group; the specification is compiled into its source. The file imports Three.js and addon helpers, so the model still has runtime dependencies.

Why is editable TypeScript useful for a 3D web app?

Editable TypeScript exposes how the object is assembled, so a developer can change the parts a configuration or animation needs. Demonstrate this with a real change request before adopting the workflow. Readable source does not automatically give you convenient controls.

The generator exposes component maps through root.userData.sculptRuntime. The runtime hierarchy guide explains pivots for movement, sockets for attachments and collider descriptions. A collider description does not add a physics simulation to your app.

Which change belongs where in an editable 3D workflow
Change you needImplementation to requestCheck before accepting it
Change the shade colourExpose the relevant material through an application controlOther lamp instances keep their own colours
Rotate the lamp headUse a named pivot with an agreed axis and motion limitsThe shade rotates around its hinge without detaching
Change the arm lengthEdit the specification and regenerate, or deliberately add a geometry parameterAttachments and proportions still match the intended variant
Select a purchasable configurationConnect scene controls to validated application stateThe displayed combination matches the saved product variant

Arbitrary dimensions are not built-in factory options. Decide whether the specification or hand-maintained TypeScript owns future edits; regenerating from an old specification can discard a fix.

After inspecting the generated export, add it to your existing scene. This filename and factory name are illustrative:

import { createDeskLampModel } from "./generated/desk-lamp";

const lamp = createDeskLampModel({ castShadow: true });
scene.add(lamp);

This adds the constructed object to the scene. Camera placement, rendering, controls and resource cleanup remain application work.

How do you install img2threejs for your coding agent?

Install the skill for one supported coding agent, then restart the agent. The installation guide lists macOS and Linux, Git, Node.js 18 or newer, and Python 3.10 or newer. Runtime versions must also meet your agent’s requirements. The reviewed installer does not support Windows.

npx --yes img2threejs@latest install --host codex
npx --yes img2threejs@latest doctor

Replace codex with claude, opencode or hermes for that host. Hermes needs the guide’s additional profile-link step. doctor reports installation state, not model quality. If an existing unmanaged skill blocks installation, inspect that path before changing it.

The commands follow the documented installation route and were not executed for this article. Record the resolved skill release and commit: @latest can change. The npm package manifest identifies an installer CLI. Adding this package to your web application does not give it an image-conversion API.

What should you ask the agent to build?

Ask img2threejs for an object with named, editable parts and explicit review requirements. The input suitability rubric favours readable silhouettes and identifiable objects; it excludes exact mesh extraction and manufacturing-grade dimensions.

Use this original trial brief with a reference image you are authorised to provide. Replace the illustrative 400 mm height with a measured dimension. Supply side and rear references when those surfaces matter.

Use the installed img2threejs skill for ./reference.png.

Build the desk lamp as a procedural Three.js model in TypeScript.
Target: an interactive browser product prototype.
Set one scene unit to one metre and neutral-pose height to 0.4 units.

Keep the base, arm and shade separately identifiable.
Give the shade a named pivot at the physical hinge.
List inferred surfaces and dimensions before building them.
Ask for another view when a required feature cannot be established.

Keep the reconstruction specification with the generated source.
Identify the exported factory and its actual options.
Render a matched reference view plus side and rear views.
Show an untextured view so material detail cannot hide geometry errors.

Demonstrate one shade-colour change and one hinge movement.
Report remaining defects, dependencies and any external assets or calls.
Stop for review if the agreed interaction needs a different asset workflow.

Check the silhouette and hinge before refining surface detail. A texture pass cannot fix a misplaced hinge. Keep the accepted specification and source in the same commit so another developer can reproduce the edit.

Where does procedural image-to-3D fit?

We would start with a browser prototype whose separate parts must respond to user input. A desk lamp gives you a concrete editing task. Check whether the reconstruction supports that task before commissioning a catalogue of similar objects.

Our starting points for an img2threejs pilot
Intended useWhy evaluate itCondition that changes the decision
Interactive product prototypeNamed components can support selection and movementMissing geometry prevents the required interaction
Stylised explanatory sceneSource edits can express the features needed to teach a conceptApproximation would communicate the wrong mechanism
Early configuratorYou can test how product choices affect the sceneThe scene cannot represent valid variants consistently
Dimension-critical or deforming assetA prototype may help clarify the requirementAcceptance needs CAD accuracy, verified topology or specialist rigging

The project’s character-likeness workflow can project reference imagery onto procedural geometry. TypeScript output alone does not establish a texture-free workflow. Inspect the generated model’s dependencies.

The plugin architecture separates the base workflow from specialist extensions. Characters still need rigging and deformation checks before their hierarchy can support the intended motion.

If your decision concerns a wider game-asset pipeline, our AI 3D generator comparison for game development covers tool selection, topology and engine handover.

Can you export the result to GLB or Blender?

Three.js can export a scene to GLB; inspect the result in Blender or your intended destination before accepting it. The official exporter reference lists supported scene data and extensions. The file does not preserve the TypeScript program that constructed the scene.

After import, test materials, animation and scale. Custom shaders and application logic need separate handling. Keep the source alongside the exported asset. GLB remains editable in suitable tools; procedural source gives you another way to maintain it.

The optional img2glb plugin documents hosted TRELLIS image-to-mesh generation, with its own network and dependency requirements. That route generates a mesh from the image; it does not export your procedural factory’s result.

How do you check a generated model before shipping?

Test img2threejs output in the destination application against the change a user must perform. A matching reference view can hide an incorrect rear surface or pivot. The project’s self-correction guide also warns that passing a two-dimensional comparison is insufficient to establish three-dimensional realism.

These are proposed checks, not reported test results. Agree device and performance budgets before the run, then record observations and unresolved defects.

Proposed acceptance evidence for the desk-lamp prototype
CheckExerciseEvidence to retain
Shape and scaleCompare the reference view, side and rear; verify the agreed overall heightLabelled captures, dimension result and a list of inferred regions
Editable geometryChange one arm dimension through the chosen source of truthReviewable diff and a model whose attachments still align
Independent materialsShow two lamp instances and recolour only one shadeThe second instance remains unchanged
Part motionMove the head through its intended rangeCorrect hinge axis and documented intersections or limits
Product stateSelect, save and reload a configurationThe same valid variant appears in the controls and scene
Device performanceLoad and interact on the slowest supported deviceMeasured startup, frame time, draw calls and memory against agreed budgets
LifecycleRepeatedly enter, leave and reopen the viewerNo accumulating application-owned GPU resources or duplicate controls
FallbackUse keyboard controls and disable the 3D pathProduct information and configuration remain usable

The Three.js resource-cleanup guide explains that unused geometries, materials and textures need explicit disposal. Removing an object from a scene is not enough. Track ownership so you do not dispose of a resource another model still uses.

Include these checks in your QA for AI-generated code. Geometry approval can miss a broken configuration save, while a passing TypeScript build can miss an incorrect shape.

What does an img2threejs workflow cost?

Budget for agent usage, rejected attempts and the work needed to integrate an accepted asset. The project’s token-cost document calls its figures engineering estimates, so we would not use them as a production quote.

Record the pilot’s output, agent usage, human minutes and remaining defects, then compare that result with your existing modelling workflow. Judge fidelity against the intended use: a prototype and a customer-facing catalogue have different acceptance bars.

Local files do not establish where your agent processes images. Confirm the host, model endpoint and optional plugin calls before supplying confidential product references.

When would we use img2threejs?

Try img2threejs when editable parts are central to your browser prototype and the team can review the reconstruction. Start with one object and a meaningful interaction. Keep the workflow if its source makes the next approved change easier to implement and verify.

Our guide to moving an AI-built prototype into production helps define the handover. The Hyperstate AI case study provides adjacent AI application experience; it does not document img2threejs or 3D modelling work.

For an actual viewer or configurator, our interactive 3D development service is the relevant starting point. Discuss one product, its required interactions and target devices so the pilot has a clear acceptance decision.

img2threejs questions

Is img2threejs a standalone AI model?
No. The reviewed project supplies an agent skill, supporting scripts and a procedural reconstruction workflow. Your coding agent supplies the model reasoning and visual judgment. Evaluate the chosen agent and workflow together, and record both versions if you want to repeat an accepted result later.
Do you need a local GPU?
The base installation guide does not specify a local inference GPU. Hardware requirements depend on where your chosen agent’s model runs and how you render the scene. A local model or an optional generation backend can add separate requirements. Browser performance still needs testing on the device your audience will use.
Will img2threejs produce a React Three Fiber component?
The core output is a TypeScript factory returning a Three.js Group, not an automatically generated React component. React Three Fiber supports existing objects through its primitive integration, which does not automatically dispose of the attached object. Plan state mapping and resource ownership, then test mounting and unmounting in your application.
Does img2threejs recover the hidden side of an object?
A single photograph cannot establish surfaces it does not show. Treat hidden details as inferred, provide additional views when they matter and inspect the result from those angles. For an exact product representation, use measured references and appropriate source assets instead of accepting an invented rear surface because the front looks convincing.
Do you still need Blender or a 3D artist?
That depends on the accepted deliverable. A reviewed browser prototype may be maintained directly in TypeScript. Work that needs controlled topology, detailed sculpting, deformation or a specific export pipeline can still need a 3D specialist and suitable authoring tools. Test one representative asset before changing your team’s production process.
Is the img2threejs source open for commercial projects?
The reviewed repository carries the Apache-2.0 licence. Keep its applicable notices and review the terms of dependencies and model services. The software licence does not establish permission to reproduce an arbitrary reference photograph, brand or depicted design; record the permissions relevant to your actual asset.

Make the 3D model work in your product

Bring one product reference, its required interactions and the devices your customers use. Agree the scene behaviour, configuration state, performance budget and fallback before expanding the viewer.

Relevant service:

Inbox, without the noise

Follow the work that matters to you

Get a short email when we publish something new. Follow the whole blog or only the problems you care about.

What would you like to receive?
Choose your topics

Free, double opt-in, no tracking pixels.

Back
Kevin Riedl

10 min read · 7 Nov 2026
Last reviewed

Next

Get the next Delivery and QA field note

One concise email when we publish. No tracking pixels, and no inbox filler.

Free, double opt-in, no tracking pixels.