camera-to-blender README

The project's README from github.com/ahujasid/camera-to-blender. As one markdown file: README.md.

Camera to 3D

Point your phone at an object, take a photo, and watch a 3D model appear in Blender in under a minute.

Take photo → background removed → 3D model generated → auto-imported into Blender.

The camera UI is built for phone. You run the server on the computer where Blender is open, then open the web app on your phone. A laptop webcam works too.

You'll need

Setup

1. Install

pip install -r requirements.txt
cp .env.example .env

Put your API keys in .env:

TRIPO_API_KEY=your_tripo_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here

2. Start the server

uvicorn relay_server:app --host 0.0.0.0 --port 8000

In a second terminal:

ngrok http 8000

ngrok gives you a URL like https://abc123.ngrok-free.app. You'll use it for both the phone and Blender.

3. Connect Blender

  1. Edit → Preferences → Add-ons → Install, pick ws_import_addon.zip, enable it

  2. Press N in the 3D viewport → WS Import tab

  3. Paste your ngrok URL, but swap https for wss and add /ws?client=blender:

    wss://abc123.ngrok-free.app/ws?client=blender
    
  4. Click Connect. It should say Status: Connected

4. Use it

Open the ngrok URL on your phone, allow camera access, and point at an object. Tap the shutter, confirm the photo, then wait ~30–60 seconds. When the model is ready, tap Send to Blender.

Settings

All optional except the Tripo key. Set these in .env:

Variable Description
TRIPO_API_KEY Required. Generates the 3D models
GEMINI_API_KEY Removes the photo background. Leave empty to skip it and use the photo as-is
PORT Server port, defaults to 8000

Running without a phone

To test from your laptop webcam, skip ngrok. Open http://localhost:8000 and point Blender at ws://localhost:8000/ws?client=blender.

If something breaks

Camera won't open on phone — you need the https:// ngrok URL, not a local IP.

"Failed to send to Blender" — the add-on isn't connected. Check the WS Import panel says Connected, and that your URL starts with wss:// and ends with ?client=blender.

ngrok URL stopped working — free ngrok URLs change every restart. Reconnect Blender with the new one.

Background removal fails — usually a Gemini quota or key problem. You can leave GEMINI_API_KEY empty to skip it.

What's in here

relay_server.py          The server: talks to the APIs, relays models to Blender
webapp/                  The phone camera app
blender_addon/           Add-on source
ws_import_addon.zip      The add-on to install in Blender

If you edit the add-on source, repackage it before installing:

zip -r ws_import_addon.zip blender_addon -x "*/__pycache__/*" "*.pyc"

License

MIT — see LICENSE.

camera-to-blender (ahujasid/camera-to-blender)

Searching Database…

这是什么?一个把实物照片变成 3D 模型并自动导入 Blender 的工具——用手机对准某个物体拍张照,模型大约一分钟后就会出现在 Blender 里。
这是 Blender 插件、Web 应用,还是别的东西?它由三个部分协同工作:一个本地 Python 服务器、一个在手机上打开的相机 Web 应用,以及一个通过 WebSocket 连接服务器以接收成品模型的 Blender 插件。
怎么让它跑起来?把 API 密钥放进 .env 文件,启动服务器,运行 ngrok 获取一个 HTTPS URL,然后安装 wsimportaddon.zip 这个 Blender 插件,并把 ngrok URL(换成 wss://...)粘贴到它的 WS Import 面板中完成连接。
开始之前需要准备什么?你需要 Python 3.10+、Blender 3.0+、必需的 Tripo3D API 密钥(用于生成 3D 模型)、可选的 Gemini API 密钥(用于去除照片背景),以及 ngrok(手机使用时必需,因为手机需要 HTTPS)。
有什么需要提前知道的坑吗?免费的 ngrok URL 每次重启都会变化,所以每次都要用新 URL 重新连接 Blender 插件;另外,如果背景去除失败,通常是 Gemini 配额或密钥的问题,留空 Gemini 密钥即可跳过这一步。
不用手机可以试用吗?可以,你可以完全跳过 ngrok,把 Blender 指向 ws://localhost:8000/ws?client=blender,用笔记本摄像头测试。
为什么偏偏需要 ngrok?手机摄像头要在浏览器中工作必须使用 HTTPS 连接,因此用 ngrok 通过手机可访问的安全 HTTPS 隧道把本地服务器暴露出去。
Tripo3D 密钥的实际作用是什么?它是必需的 API 密钥,负责驱动从照片生成 3D 模型的核心环节——没有它,整条流水线无法创建模型。
如果 Blender 提示模型发送失败,是怎么回事?这说明 WS Import 插件没有连上;检查面板是否显示「Status: Connected」,以及你粘贴的 URL 是否以 wss:// 开头、以 /ws?client=blender 结尾。
Creator
ahujasid
Size
<0.1 MB
Stars
848
Updated
CommitSep 05
Age
1mo
Commits · 90 Days