In this piece
img2threejs: Rebuild an image as editable Three.js code
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:
- The agent examines the reference, noting the features it can see and where it is unsure.
- A specification captures the components, their materials, and how they relate to one another.
- Code constructs the stage in progress, and a browser renders it.
- 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.
| The change | What to ask for | What to verify first |
|---|---|---|
| Recolour the shade | Make the matching material available to an application control | Every other lamp instance keeps its own colour |
| Turn the lamp head | A named pivot with an agreed axis and limits on its motion | The shade turns on its hinge and stays attached |
| Lengthen or shorten the arm | Change the specification and regenerate, or add a geometry parameter on purpose | Attachments and proportions still fit the variant you intended |
| Choose a configuration customers can buy | Wire the scene controls to validated application state | What 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 doctorFor 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.
| Planned use | Reason to evaluate it | What would change the call |
|---|---|---|
| Interactive product prototype | Components with names can handle selection and movement | Geometry gaps block the interaction you need |
| Stylised scene that explains something | Editing the source can show the features a concept needs to be taught | An approximation would get the mechanism across incorrectly |
| First version of a configurator | It lets you test how product options change the scene | Valid variants cannot be shown reliably in the scene |
| Asset that deforms or depends on exact dimensions | A prototype can help pin down the requirement | Sign-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.
| Check | What to do | What to keep as evidence |
|---|---|---|
| Shape and scale | Compare against the reference view, the side, and the rear, and confirm the agreed total height | Captures with labels, the dimension result, and a list of regions that were inferred |
| Editable geometry | Alter one arm dimension via whichever source of truth you chose | A diff you can review and a model with attachments that still line up |
| Independent materials | Display two lamp instances and change the colour of just one shade | The other instance stays as it was |
| Part motion | Swing the head across its intended range | The right hinge axis, plus any intersections or limits written down |
| Product state | Pick a configuration, save it, and load it again | The controls and the scene both show the same valid variant |
| Device performance | Load it and interact with it on the slowest device you support | Startup, frame time, draw calls, and memory, measured against the agreed budgets |
| Lifecycle | Open, exit, and reopen the viewer many times | No build-up of GPU resources the application owns, and no doubled controls |
| Fallback | Operate it by keyboard and switch the 3D path off | Product 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.
