@jojonadam/dsh-blender 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ node test/provider.test.mjs
|
|
|
58
58
|
python3 skills/blender-studio/scripts/blender_client.py doctor
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
实机验证:Blender 5.2.1 LTS · macOS · METAL,EEVEE 256×256 冒烟 3.5s;参数化地砖(9 块 + 选择性 Bevel + glTF)3.6s
|
|
61
|
+
实机验证:Blender 5.2.1 LTS · macOS · METAL,EEVEE 256×256 冒烟 3.5s;参数化地砖(9 块 + 选择性 Bevel + glTF)3.6s;Cycles 256×256 / 16 采样 CPU 1.3s、Metal 首次 4–5 分钟(kernel 编译,2026-10-19)。
|
|
62
62
|
|
|
63
63
|
## 品牌
|
|
64
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jojonadam/dsh-blender",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Blender production pack for DeepSeek Harness: headless bpy runner, render/export helpers, modeling cookbook, 5.x pitfalls and procedural asset pipeline. 本地建模 · 零依赖客户端 · 5.2 LTS 校准。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -40,6 +40,15 @@ license: MIT
|
|
|
40
40
|
- 世界背景为纯黑且没有灯光时,默认立方体也会接近黑;
|
|
41
41
|
- 先在 `smoke` 上验证,再怀疑场景。
|
|
42
42
|
|
|
43
|
+
### Cycles 渲染特别慢(几分钟一张)
|
|
44
|
+
|
|
45
|
+
- **现象**:EEVEE 几秒,Cycles 同分辨率要几分钟,CPU 占用却很低。
|
|
46
|
+
- **原因**:macOS 的 Cycles Metal 后端每次启动都要编译 kernel;如果进程写不了 kernel 缓存,就会**每次重编译**。
|
|
47
|
+
- **处置**:
|
|
48
|
+
- 迭代阶段用 EEVEE;
|
|
49
|
+
- 小场景/定稿可用 `--device CPU`(简单场景反而快);
|
|
50
|
+
- 需要 GPU 时,让 Blender 在可写缓存的环境里跑,或接受首轮编译成本。
|
|
51
|
+
|
|
43
52
|
### 输出目录无权限
|
|
44
53
|
|
|
45
54
|
- 错误形如 `Permission denied` / `Operation not permitted` 写 PNG;
|
|
@@ -51,18 +51,26 @@ python3 scripts/blender_client.py run \
|
|
|
51
51
|
## 4. 渲染已有工程 / 导出
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
#
|
|
54
|
+
# EEVEE 单帧(快,适合迭代)
|
|
55
55
|
python3 scripts/blender_client.py render \
|
|
56
56
|
--blend outputs/blender/tiles/scene.blend \
|
|
57
57
|
--out outputs/blender/tiles/final.png \
|
|
58
58
|
--samples 64 --res 1024
|
|
59
59
|
|
|
60
|
+
# Cycles 单帧(真实光影;macOS 用 --device METAL,小场景可先试 CPU)
|
|
61
|
+
python3 scripts/blender_client.py render \
|
|
62
|
+
--blend outputs/blender/tiles/scene.blend \
|
|
63
|
+
--out outputs/blender/tiles/final_cycles.png \
|
|
64
|
+
--engine CYCLES --device METAL --samples 32 --res 512
|
|
65
|
+
|
|
60
66
|
# 更复杂的导出(glTF / USD / FBX)直接在脚本里做,不要在命令行拼
|
|
61
67
|
python3 scripts/blender_client.py run --script my_export.py --blend scene.blend
|
|
62
68
|
```
|
|
63
69
|
|
|
64
70
|
输出统一放 `outputs/blender/<主题>/`,文件名带版本或日期;生成后用 `present` 把图片给用户看。
|
|
65
71
|
|
|
72
|
+
> ⚠️ Cycles 在 macOS 上首次运行要编译 Metal kernel(可能几分钟)。如果进程写不了 kernel 缓存,每次都会重编译——迭代用 EEVEE,定稿再上 Cycles。
|
|
73
|
+
|
|
66
74
|
## 5. 领域路由
|
|
67
75
|
|
|
68
76
|
| 用户问题 | 调用技能 |
|
|
@@ -166,10 +166,24 @@ scene.render.resolution_percentage = 100
|
|
|
166
166
|
scene.render.image_settings.file_format = 'PNG'
|
|
167
167
|
scene.render.filepath = {str(out)!r}
|
|
168
168
|
scene.frame_set({int(args.frame)})
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
|
|
170
|
+
if {args.engine!r} == 'CYCLES':
|
|
171
|
+
try:
|
|
172
|
+
prefs = bpy.context.preferences.addons['cycles'].preferences
|
|
173
|
+
prefs.compute_device_type = {args.device!r}
|
|
174
|
+
prefs.get_devices()
|
|
175
|
+
for device in prefs.devices:
|
|
176
|
+
device.use = device.type != 'CPU'
|
|
177
|
+
scene.cycles.device = 'CPU' if {args.device!r} == 'CPU' else 'GPU'
|
|
178
|
+
except Exception as exc:
|
|
179
|
+
print('DSH_CYCLES_WARN', exc)
|
|
180
|
+
scene.cycles.samples = {int(args.samples)}
|
|
181
|
+
else:
|
|
182
|
+
try:
|
|
183
|
+
scene.eevee.taa_render_samples = {int(args.samples)}
|
|
184
|
+
except Exception:
|
|
185
|
+
pass
|
|
186
|
+
|
|
173
187
|
bpy.ops.render.render(write_still=True)
|
|
174
188
|
print('DSH_RENDER_OK')
|
|
175
189
|
"""
|
|
@@ -225,6 +239,7 @@ def main() -> int:
|
|
|
225
239
|
p_render.add_argument("--out", required=True)
|
|
226
240
|
p_render.add_argument("--engine", default="BLENDER_EEVEE")
|
|
227
241
|
p_render.add_argument("--samples", type=int, default=32)
|
|
242
|
+
p_render.add_argument("--device", default="METAL", help="Cycles 计算设备:METAL / CUDA / OPTIX / CPU")
|
|
228
243
|
p_render.add_argument("--res", default="512")
|
|
229
244
|
p_render.add_argument("--frame", type=int, default=1)
|
|
230
245
|
p_render.add_argument("--timeout", type=float, default=900)
|