עברית 📰 Blog
← Back to Blog
Working with Claude

Turn One Photo of an Object Into a Live 3D Model Made of Code

Masterphub Team
Editorial
October 6, 2026

Share this article

Turn One Photo of an Object Into a Live 3D Model Made of Code

Turn One Photo of an Object Into a Live 3D Model Made of Code

You have a picture of a bike, a pair of earbuds or a treasure chest. You want it spinning in 3D on a web page. The usual path is a 3D artist, Blender, or a paid model download. There is another way now: let an AI coding agent rebuild the object from scratch in Three.js, using only code.

No mesh file. No photogrammetry. The model is made of basic shapes (boxes, cylinders, curves), generated geometry and shaders, all written as code that runs in the browser.

Why build it with code instead of a file

  • It moves. A code model can have real parts: a wheel that turns, a lid that opens, a joint that bends. A downloaded mesh is usually one frozen piece.
  • It is light. A few kilobytes of code instead of a heavy model file.
  • You can change it with words. "Make the handle longer", "make it matte black". The agent edits the code.

How the method works

The trick is not to ask for the whole thing at once. Good results come from building in passes, and checking each pass against the photo before moving on:

  1. List the details first. Before writing code, the agent writes down every small thing that makes the object look like itself: screws, rounded edges, logos, scratches, shiny or matte parts.
  2. Blockout. Rough shapes only, to get the size and proportions right.
  3. Structure and form. Real parts, with pivots where things should move.
  4. Materials. Metal, plastic, rubber, fabric, each region on its own.
  5. Lighting and polish. Then a final check.

After every pass the agent renders the model, looks at it next to the photo, and fixes what does not match. That loop is what makes it work.

An open source project called img2threejs packages this whole method as a skill for Claude Code, Codex or OpenCode, with quality gates between the steps. You can also run the same idea by hand with any coding agent.

A prompt to start with

Here is a reference photo of [OBJECT]. Rebuild it as a procedural Three.js model in one TypeScript file that returns a THREE.Group. Use only primitives, generated geometry and shader materials. No external model files.

Work in passes and stop after each one to show me a render next to the photo:
1. List every identity detail you see (shapes, edges, screws, logos, materials, wear).
2. Blockout with correct proportions.
3. Real parts with pivots for anything that moves ([MOVING PARTS]).
4. Materials per region.
5. Lighting and a simple orbit-camera demo page.

At each pass, say what still does not match the photo and fix it before moving on.

Where it works best

  • Hard objects (gadgets, tools, furniture, vehicles, props) come out best.
  • Characters and real faces are much harder. One photo can't give the back or sides, so expect a stylized result, or give more angles.
  • Products for a store or a landing page: a spinning 3D version of your product, with no 3D artist.

Frequently asked questions

Do I need to know Three.js? No. You need to be able to run the page the agent builds and say what looks wrong.

How long does it take? A simple object: minutes. A detailed one: several rounds of passes. The pass-by-pass checking is where the time goes, and also where the quality comes from.

Can I use any photo? Use photos of objects you own or have rights to. A clean photo with plain background and good light gives the best result.

Share this article