Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions external_plugins/product-3d-showcase/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "product-3d-showcase",
"version": "0.1.0",
"description": "Turn a glTF/GLB product model into a consistent set of marketing assets: multi-angle product images on white or transparent backgrounds with studio lighting and a soft ground shadow, a frame-exact 360° turntable video (WebM, plus MP4 with ffmpeg) and a self-contained web 3D viewer that works offline. Renders locally with three.js; no API keys.",
"description_i18n": {
"en": "Turn a glTF/GLB product model into a consistent set of marketing assets: multi-angle product images on white or transparent backgrounds with studio lighting and a soft ground shadow, a frame-exact 360° turntable video (WebM, plus MP4 with ffmpeg) and a self-contained web 3D viewer that works offline. Renders locally with three.js; no API keys.",
"zh-CN": "把 glTF/GLB 产品模型做成一整套统一风格的展示素材:白底或透明底的多角度产品图(影棚灯光、柔和地面阴影)、逐帧精确的 360° 旋转视频(WebM,装了 ffmpeg 再出 MP4),以及可离线打开的网页 3D 展示。用 three.js 在本地渲染,无需 API 密钥。"
},
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"keywords": [
"3d",
"product",
"gltf",
"glb",
"three.js",
"turntable",
"360",
"product photo",
"viewer",
"产品图",
"3D 展示",
"白底图",
"360 度"
],
"skills": "skills",
"mcpServers": {
"product-3d-showcase": {
"type": "stdio",
"command": "node",
"args": [
"${ZCODE_PLUGIN_ROOT}/dist/server.mjs"
],
"cwd": "${ZCODE_PROJECT_DIR}",
"timeoutMs": 900000,
"env": {
"ZCODE_WORKSPACE_ROOT": "${ZCODE_PROJECT_DIR}",
"FFMPEG_PATH": "${user_config.ffmpegPath}"
}
}
},
"ui": {
"surfaces": [
{
"id": "editor",
"title": {
"zh-CN": "产品 3D 展示",
"en-US": "Product 3D Showcase"
},
"icon": "box",
"server": "product-3d-showcase",
"resourceUri": "ui://product-3d-showcase/panel.html",
"availability": "session"
}
]
},
"userConfig": {
"ffmpegPath": {
"type": "string",
"default": "",
"title": "ffmpeg 路径(可选)",
"description": "可选。只有把 360° 视频另存为 MP4 时需要 ffmpeg。默认在 PATH 和 /opt/homebrew/bin、/usr/local/bin 中查找。"
}
}
}
21 changes: 21 additions & 0 deletions external_plugins/product-3d-showcase/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Penova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
58 changes: 58 additions & 0 deletions external_plugins/product-3d-showcase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Product 3D Showcase

Turn a glTF/GLB product model into a consistent set of marketing assets: multi-angle product images, a 360° turntable video and a web 3D viewer.

## Features

- **Studio scene**: three.js with a neutral room environment, key/fill/rim lights (presets: studio, soft, dramatic), ACES tone mapping and exposure control.
- The model is centred, placed on the floor and auto-framed so it fills the shot the same way for every angle.
- An optional soft ground shadow is rendered on an invisible floor, so it also works on transparent backgrounds.
- **Angles**: presets (front, three-quarter left/right, side, back, top) or your own. Drag the live preview to a view and press **+ Add this view**. Each angle has a name, yaw, pitch and zoom.
- **Product images**: one PNG per angle, square, 256–4096 px, on white, transparent or any colour.
- **360° turntable video**:
- Rendered frame by frame and encoded with WebCodecs (VP9/VP8) into WebM, so it is smooth and frame-exact even on slow machines. Length and size are configurable; 30 fps.
- With ffmpeg installed, an H.264 MP4 (yuv420p, faststart) is also written for shops and social media.
- **Web 3D viewer**: `viewer/index.html` + `viewer.js` + `model.js`. It opens from disk (file://) with no server and no network, with drag-to-rotate, zoom, auto-rotate and the same lighting. You can put it on any static host.
- **Models**: `.glb`, or `.gltf` with external `.bin` and textures, which are inlined automatically.

## Usage

Ask the agent in ZCode Desktop:

- "Make white-background product shots of bottle.glb: front, 45° left and right, side and back"
- "Add a 6-second 360° video and a web 3D viewer, with transparent PNGs"
- "Use softer lighting and add a low hero angle"

## Tools

| Tool | Purpose |
|---|---|
| `showcase_open` | Open a model with optional settings; shows what is inside (meshes, materials, textures, size) |
| `showcase_save` | Save angles, lighting, background, shadow, exposure, sizes, video and viewer options |
| `showcase_export` | Render and save all outputs in the open panel |

Output goes to `showcase/<model>/`: `<angle>.png`, `turntable.webm` (+ `.mp4`), `viewer/` and `showcase.json` (the settings, reused next time).

## Scope (v0.1)

- glTF 2.0 only. Convert OBJ/FBX/USDZ first, for example with Blender (File → Export → glTF 2.0).
- Draco/meshopt-compressed and KTX2-textured models are not supported yet.
- Rendering needs WebGL in the panel. The video background is never transparent; with a transparent background, the video uses white.
- No AI image generation or background scenes.

## Privacy, network and files

- **Everything runs locally.** No network, no uploads, no API keys or accounts.
- Reads only the model you choose and the files it refers to. Writes only to the output folder in the workspace.
- ffmpeg (optional) is called with argument arrays, without a shell. No hooks.

## Build and test (developers)

- Source: `ui-plugins/product-3d-showcase/`.
- Build: `pnpm install --frozen-lockfile && pnpm build`, then add `dist/local-marketplace` as a local source.
- Tests: `pnpm --filter @penova/plugin-product-3d-showcase test` and `test:e2e`.
- `E2E_MODELS` points to a folder with `WaterBottle.glb` and `avocado/` from the Khronos glTF-Sample-Assets (CC0).

## Third-party components and licenses

MIT licensed (author: Penova). Bundled: three.js (MIT), MCP SDK and ext-apps (MIT), zod (MIT); the full list is in `dist/THIRD_PARTY_NOTICES.txt`. ffmpeg is not bundled.
77 changes: 77 additions & 0 deletions external_plugins/product-3d-showcase/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 产品 3D 展示

把 glTF/GLB 产品模型做成一整套统一风格的展示素材:多角度产品图、360° 旋转视频和网页 3D 展示。

## 功能

- **影棚场景**:three.js 渲染,中性室内环境光,加主光、补光、轮廓光。
- 灯光预设:影棚、柔光、戏剧。
- ACES 色调映射,曝光可调。
- 模型自动居中、落地、取景,每个角度占画面的比例一致。
- 可选柔和地面阴影,画在看不见的地面上,透明底也能用。
- **角度**:
- 预设:正面、左右 45°、侧面、背面、俯视。也可以自定义。
- 在实时预览里拖到想要的视角,点“+ 加入这个角度”。
- 每个角度有名字、水平角、俯仰角和缩放。
- **产品图**:每个角度一张方形 PNG,256–4096 px,白底、透明底或任意颜色。
- **360° 旋转视频**:
- 逐帧渲染,用 WebCodecs(VP9/VP8)编码成 WebM。机器慢也不会掉帧,帧数精确。
- 时长和尺寸可调,30 fps。
- 装了 ffmpeg 会再出一份 H.264 MP4(yuv420p、faststart),方便传电商平台和社交媒体。
- **网页 3D 展示**:
- 由 `viewer/index.html`、`viewer.js` 和 `model.js` 组成。
- 直接双击就能打开(file://),不需要服务器和网络。
- 可拖动旋转、缩放、自动旋转,灯光与产品图一致。
- 也可以放到任何静态托管上。
- **模型**:`.glb`;也支持带外部 `.bin` 和贴图的 `.gltf`,会自动内联。

## 使用

在 ZCode Desktop 里对 Agent 说:

- “用 bottle.glb 做一套白底产品图:正面、左右 45°、侧面、背面”
- “再出一段 6 秒的 360° 旋转视频和网页 3D 展示,图片要透明底”
- “灯光柔和一点,再加一个低机位的主图角度”

## 工具

| 工具 | 作用 |
|---|---|
| `showcase_open` | 打开模型,可同时传设置。会报告模型里有什么:网格、材质、贴图、大小 |
| `showcase_save` | 保存设置:角度、灯光、背景、阴影、曝光、尺寸、视频和网页展示选项 |
| `showcase_export` | 在打开的面板里渲染并保存全部输出 |

输出在 `showcase/<模型名>/`:

- `<角度>.png`
- `turntable.webm`,以及 `.mp4`
- `viewer/`
- `showcase.json`:设置,下次打开时沿用

## 范围(v0.1)

- 只支持 glTF 2.0。OBJ/FBX/USDZ 请先转换,例如用 Blender:文件 → 导出 → glTF 2.0。
- 暂不支持 Draco/meshopt 压缩和 KTX2 贴图的模型。
- 渲染需要面板里的 WebGL。
- 视频背景不支持透明;透明底时视频用白底。
- 不含 AI 生图或背景场景生成。

## 隐私、网络与文件

- **全部在本地运行。** 不联网、不上传,不需要 API 密钥或账号。
- 只读取你选择的模型及其引用的文件;只写入工作区里的输出文件夹。
- ffmpeg(可选)以参数数组调用,不经过 shell。没有 hooks。

## 构建与测试(开发者)

- 源码:`ui-plugins/product-3d-showcase/`。
- 构建:`pnpm install --frozen-lockfile && pnpm build`,再把 `dist/local-marketplace` 添加为本地来源。
- 测试:`pnpm --filter @penova/plugin-product-3d-showcase test` 和 `test:e2e`。
- `E2E_MODELS` 指向含 `WaterBottle.glb` 与 `avocado/` 的文件夹。这两个模型来自 Khronos glTF-Sample-Assets,CC0 授权。

## 第三方组件与许可证

本插件以 MIT 许可证发布,作者 Penova。

- 打包进插件的组件:three.js(MIT)、MCP SDK 与 ext-apps(MIT)、zod(MIT)。完整清单见 `dist/THIRD_PARTY_NOTICES.txt`。
- 不打包 ffmpeg。
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: product-3d-showcase
description: 把 glTF/GLB 产品模型做成多角度产品图(白底/透明底)、360° 旋转视频(WebM/MP4)和可离线打开的网页 3D 展示。用户提到“产品 3D 展示 / 产品图 / 白底图 / 360 度视频 / 3D 模型展示 / glb”时使用。
---

# 产品 3D 展示

1. 打开:`showcase_open(model: "xx.glb" 或 "xx.gltf", settings?)`。
- 结果会说明模型的网格、材质、贴图数量和大小。
- OBJ/FBX/USDZ 不支持:请用户先用 Blender 导出 glTF 2.0。
2. 按用户的要求设置,然后调用 `showcase_save(settings)`。settings 必须带 `model`。
- 角度 `angles`:
- 预设名:front、three-quarter-left、three-quarter-right、side、back、top。
- 也可以写 `{name, yaw, pitch, zoom}`。yaw 0 是正面,正数向右转;pitch 是俯视角度,低机位用 0–5。
- 背景 `background`:`"#ffffff"`、`"transparent"` 或其他颜色。
- 其他选项:
- `lighting`:"studio"、"soft" 或 "dramatic"。
- `shadow`、`exposure`。
- `size`:图片像素。
- `video: {enabled, seconds, size}`、`viewer`、`output`。
- 告诉用户也可以在面板里拖动预览选角度。
3. 导出:`showcase_export(settings)`。
- 渲染在面板里完成,面板要保持打开。
- 完成后面板会把文件清单发回上下文。
- 告诉用户输出文件夹里有什么:PNG、`turntable.webm`(装了 ffmpeg 还有 `.mp4`)和 `viewer/index.html`。网页展示可以直接双击打开,或放到任何静态托管上。
51 changes: 51 additions & 0 deletions marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,57 @@
"把上一个 Hi3D 任务生成的模型按角色拆分成部件"
]
}
},
{
"name": "product-3d-showcase",
"componentTypes": [
"ui"
],
"source": "./external_plugins/product-3d-showcase",
"displayName": "Product 3D Showcase",
"displayName_i18n": {
"en": "Product 3D Showcase",
"zh-CN": "产品 3D 展示"
},
"description": "Turn a glTF/GLB product model into a consistent set of marketing assets: multi-angle product images on white or transparent backgrounds with studio lighting and a soft ground shadow, a frame-exact 360° turntable video (WebM, plus MP4 with ffmpeg) and a self-contained web 3D viewer that works offline. Renders locally with three.js; no API keys.",
"description_i18n": {
"en": "Turn a glTF/GLB product model into a consistent set of marketing assets: multi-angle product images on white or transparent backgrounds with studio lighting and a soft ground shadow, a frame-exact 360° turntable video (WebM, plus MP4 with ffmpeg) and a self-contained web 3D viewer that works offline. Renders locally with three.js; no API keys.",
"zh-CN": "把 glTF/GLB 产品模型做成一整套统一风格的展示素材:白底或透明底的多角度产品图(影棚灯光、柔和地面阴影)、逐帧精确的 360° 旋转视频(WebM,装了 ffmpeg 再出 MP4),以及可离线打开的网页 3D 展示。用 three.js 在本地渲染,无需 API 密钥。"
},
"version": "0.1.0",
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"category": "productivity",
"keywords": [
"3d",
"product",
"gltf",
"glb",
"three.js",
"turntable",
"360",
"product photo",
"viewer",
"产品图",
"3D 展示",
"白底图",
"360 度"
],
"examplePrompts": [
"Make white-background product shots of bottle.glb: front, 45° left and right, side and back",
"Add a 6-second 360° video and a web 3D viewer, with transparent PNGs",
"Use softer lighting and add a low hero angle"
],
"examplePrompts_i18n": {
"zh-CN": [
"用 bottle.glb 做一套白底产品图:正面、左右 45°、侧面、背面",
"再出一段 6 秒的 360° 旋转视频和网页 3D 展示,图片要透明底",
"灯光柔和一点,再加一个低机位的主图角度"
]
}
}
]
}
Loading