img2threejs: Rebuild an image as editable Three.js code

Back
Atta Ur Rehman

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.

Picture a product photo of your desk lamp. For a configurator, that same lamp needs a shade whose colour can change and a head that turns on the right hinge, which means a model built from separate parts your application can drive.

img2threejs is an agent skill: it turns a reference image into editable Three.js code, rebuilding the object as a procedural model in TypeScript. Your coding agent gets a reconstruction workflow split into stages. What comes out is source code you can read and modify, organised as an object hierarchy capable of supporting interactions. That contract is set out in the official img2threejs repository.

Sources checked: . Everything here is based on the project’s documentation and its generator source at release v2.0.1. Both the lamp example and the acceptance checks are exercises we propose; we did not run a reconstruction from an image, nor did we measure speed, fidelity, or cost.

img2threejs.org identifies itself as a separate hosted service. The Native Mesh pipeline and downloadable packages it offers do not belong to the GitHub skill this guide covers.

What img2threejs actually outputs

The result is a structured reconstruction specification plus TypeScript code that constructs a Three.js object. Visual judgment comes from your agent, while scripts check the specification and govern when each stage can move on. Showing and running the finished model is the job of an application.

According to the pipeline architecture, work moves from blockout to structure, form, materials, surface detail, lighting, interaction, and finally optimisation. Put simply:

  1. The agent examines the reference, noting the features it can see and where it is unsure.
  2. A specification captures the components, their materials, and how they relate to one another.
  3. Code constructs the stage in progress, and a browser renders it.
  4. Before moving on, the agent checks that render against the reference and fixes what falls short.

In the TypeScript factory generator we inspected, the name of the target determines the function name. The function accepts a single options object and hands back a THREE.Group, with the specification compiled into the source. Because the file imports Three.js and its addon helpers, the model keeps runtime dependencies.

What editable TypeScript gives a 3D web app

With editable TypeScript you can see how the object is put together, so a developer can alter whichever parts an animation or configuration depends on. Prove that with a genuine change request before committing to the workflow. Source that is easy to read does not, by itself, hand you easy controls.

Component maps are exposed by the generator via root.userData.sculptRuntime. As the runtime hierarchy guide describes, pivots handle movement, sockets handle attachments, and there are collider descriptions as well. Having a collider description does not give your app a physics simulation.

Where each kind of change goes in an editable 3D workflow
The changeWhat to ask forWhat to verify first
Recolour the shadeMake the matching material available to an application controlEvery other lamp instance keeps its own colour
Turn the lamp headA named pivot with an agreed axis and limits on its motionThe shade turns on its hinge and stays attached
Lengthen or shorten the armChange the specification and regenerate, or add a geometry parameter on purposeAttachments and proportions still fit the variant you intended
Choose a configuration customers can buyWire the scene controls to validated application stateWhat is shown matches the saved product variant

The factory offers no built-in options for arbitrary dimensions. Settle whether future edits belong to the specification or to TypeScript maintained by hand, because regenerating from an outdated specification can throw away a fix.

Once you have reviewed the generated export, add it to the scene you already have. The filename and factory name here are only examples:

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

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

That places the built object in the scene. Positioning the camera, rendering, controls, and cleaning up resources are still up to your application.

Installing img2threejs for your coding agent

Install the skill for a single supported coding agent and then restart that agent. Requirements in the installation guide are macOS or Linux, Git, Node.js 18 or later, and Python 3.10 or later, and your agent may impose its own runtime versions on top. Windows is not supported by the installer we reviewed.

Node.js 18 is simply the oldest version the installer works with. On a fresh installation pick a supported LTS release (22, 24, or 26 at present) and confirm what the host agent itself needs. In the commands that follow, the npm installer and the skill release are pinned independently. Naming the tag explicitly also skips the installer’s default check for the latest release, which helps on networks that route through an HTTPS proxy. Node.js release schedule.

npx --yes img2threejs@0.2.0 install --host codex --ref v2.0.1
npx --yes img2threejs@0.2.0 doctor

For a different host, swap codex for claude, opencode, or hermes. Hermes requires one extra step from the guide to link a profile. What doctor tells you is the state of the installation, not how good the model is. When an unmanaged skill already in place stops the install, look at that path before you alter anything.

We took these commands from the documented install route and did not run them while writing. Note the resolved commit that doctor reports. The npm package manifest describes an installer CLI, so putting the package in your web application will not give the app an API for converting images.

What to ask the agent for

Request an object whose parts are named and editable, and spell out how it will be reviewed. The input suitability rubric prefers clear silhouettes and recognisable objects, and it rules out exact mesh extraction and dimensions precise enough for manufacturing.

Pair this trial brief, which we wrote ourselves, with a reference image you have permission to share. Swap the example height of 400 mm for one you have measured, and add side and rear references wherever those surfaces count.

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.

Review the silhouette and the hinge before you polish surface detail, since no texture pass will correct a hinge in the wrong place. Commit the approved specification together with the source so a second developer can repeat the edit.

Where procedural image-to-3D is a good fit

Our first choice would be a browser prototype with separate parts that have to react to the user. A desk lamp hands you a specific editing job. Confirm that the reconstruction can handle it before you order a whole catalogue of comparable objects.

Where we would begin an img2threejs pilot
Planned useReason to evaluate itWhat would change the call
Interactive product prototypeComponents with names can handle selection and movementGeometry gaps block the interaction you need
Stylised scene that explains somethingEditing the source can show the features a concept needs to be taughtAn approximation would get the mechanism across incorrectly
First version of a configuratorIt lets you test how product options change the sceneValid variants cannot be shown reliably in the scene
Asset that deforms or depends on exact dimensionsA prototype can help pin down the requirementSign-off depends on CAD accuracy, verified topology, or specialist rigging

Through its character-likeness workflow, the project can project reference images onto procedural geometry. So getting TypeScript output does not prove the workflow avoids textures; check what the generated model depends on.

Under the plugin architecture, specialist extensions sit apart from the core workflow. A character’s hierarchy still has to pass rigging and deformation checks before it can drive the motion you want.

When the question is a broader pipeline for game assets, our comparison of AI 3D generators for game development deals with choosing tools, topology, and handing over to an engine.

Exporting to GLB or Blender

Three.js is able to export a scene as GLB; open the file in Blender or wherever it is headed and inspect it before you sign it off. Supported scene data and extensions are listed in the official exporter reference. The exported file keeps none of the TypeScript program that built the scene.

Once imported, check materials, animation, and scale. Application logic and custom shaders have to be dealt with separately. Store the source next to the exported asset: suitable tools can still edit a GLB, and procedural source offers a second route for maintaining it.

Hosted TRELLIS image-to-mesh generation is documented in the optional img2glb plugin, which brings network and dependency requirements of its own. It creates a mesh straight from the image rather than exporting what your procedural factory built.

Checking a generated model before it ships

Test the output inside the application it is going into, against the change a user actually has to make. One view that matches the reference can conceal a wrong back surface or pivot. The project’s own self-correction guide cautions that clearing a two-dimensional comparison does not prove the model is realistic in three dimensions.

We are suggesting these checks; they are not results we have reported. Settle the device and performance budgets before running them, and then write down what you observe and any defects left open.

Suggested acceptance evidence for the desk-lamp prototype
CheckWhat to doWhat to keep as evidence
Shape and scaleCompare against the reference view, the side, and the rear, and confirm the agreed total heightCaptures with labels, the dimension result, and a list of regions that were inferred
Editable geometryAlter one arm dimension via whichever source of truth you choseA diff you can review and a model with attachments that still line up
Independent materialsDisplay two lamp instances and change the colour of just one shadeThe other instance stays as it was
Part motionSwing the head across its intended rangeThe right hinge axis, plus any intersections or limits written down
Product statePick a configuration, save it, and load it againThe controls and the scene both show the same valid variant
Device performanceLoad it and interact with it on the slowest device you supportStartup, frame time, draw calls, and memory, measured against the agreed budgets
LifecycleOpen, exit, and reopen the viewer many timesNo build-up of GPU resources the application owns, and no doubled controls
FallbackOperate it by keyboard and switch the 3D path offProduct details and configuration still work

As the Three.js resource-cleanup guide points out, geometries, materials, and textures you no longer use must be disposed of explicitly; taking an object out of the scene does not do it. Keep track of who owns each resource so you never dispose of one that a different model still needs.

Fold these checks into the QA you run on AI-generated code. Approving the geometry can overlook a configuration save that fails, and a clean TypeScript build can overlook a wrong shape.

The cost of an img2threejs workflow

Set aside budget for agent usage, attempts you throw away, and the effort of integrating the asset you accept. The figures in the project’s token-cost document are described as engineering estimates, so we would not treat them as a quote for production.

Log what the pilot produced, the agent usage, the minutes people spent, and the defects still open, and set that against how you model today. Measure fidelity against what the asset is for, since a prototype and a catalogue shown to customers face different bars for acceptance.

Keeping files local says nothing about where your agent sends images for processing. Before handing over confidential product references, confirm the host, the model endpoint, and any calls optional plugins make.

When we would reach for img2threejs

It is worth trying when editable parts sit at the heart of your browser prototype and your team is able to review the reconstruction. Begin with a single object and an interaction that matters. Stick with the workflow if its source makes the next approved change simpler to build and to verify.

To plan the handover, see our guide to moving an AI-built prototype into production. Our Mainstay Digital case study shows related experience in 3D product visualization, though it does not cover any img2threejs work.

If you need a real viewer or configurator, begin with our interactive 3D development service. Talk to us about one product, the interactions it needs, and your target devices so the pilot ends in a clear accept-or-reject decision.

img2threejs questions

Is img2threejs an AI model in its own right?
No. What the project we reviewed provides is an agent skill, helper scripts, and a procedural reconstruction workflow; the model reasoning and visual judgment come from your coding agent. Assess the agent you pick and the workflow as a pair, and note the version of each if you may need to reproduce an approved result.
Is a local GPU required?
No local inference GPU is listed in the basic installation guide. What hardware you need depends on where your agent’s model runs and how the scene gets rendered, and a local model or an optional generation backend may bring requirements of their own. You still have to test browser performance on the devices your audience actually uses.
Does img2threejs output a React Three Fiber component?
What you get is a TypeScript factory that returns a Three.js Group; no React component is generated for you. Existing objects can be used in React Three Fiber via its primitive integration, and that integration will not dispose of the attached object on its own. Work out how state maps across and who owns each resource, then test mounting and unmounting inside your app.
Can img2threejs reconstruct the side of an object you cannot see?
No single photo can prove what a surface it does not show looks like. Regard hidden details as guesses, add more views where they matter, and examine the result from those angles. When you need the product represented exactly, rely on measured references and suitable source assets rather than accepting a made-up back just because the front looks right.
Will you still need Blender or a 3D artist?
It comes down to what deliverable you accept. Once reviewed, a browser prototype can be kept up directly in TypeScript. Anything that calls for controlled topology, fine sculpting, deformation, or a particular export pipeline may still require a 3D specialist using proper authoring tools. Try one typical asset before you change how your team produces them.
Can the img2threejs source be used in commercial projects?
The repository we reviewed is published under the Apache-2.0 licence. Retain the notices that apply and check the terms of its dependencies and of any model services. The licence covers the software only and gives you no right to copy whatever reference photo, brand, or design appears in it, so document the permissions that apply to the asset you are actually using.

Get the 3D model working inside your product

Come with a single product reference, the interactions it must support, and the devices your customers rely on. Settle scene behaviour, configuration state, the performance budget, and a fallback before the viewer grows.

The service that fits:

Back
Atta Ur Rehman

10 min read · 7 Nov 2026
Last reviewed

Next