When to Use
- - Generate synthetic training data with controlled parameter variations
- Create procedural image datasets with ground truth metadata
- Automate rendering workflows for ML training data
- When you need parameter-sweep renders without manual Blender interaction
When NOT to Use
- - Real-time rendering or interactive preview needs (this is batch/offline)
- Complex scene manipulation beyond Value Node adjustments
- If Blender is not installed or unavailable in PATH
Requirements
- - Blender 4.0+ installed and available in INLINECODE0
- Python 3.10+ for the synthclaw package
- Cycles or EEVEE render engine (auto-selected)
Configuration
No additional configuration required. Ensure blender command is available:
CODEBLOCK0
Tools
renderproceduralscene
Adjusts procedural Value Nodes and renders a frame in Blender.
Parameters:
- -
blend_file (string, required): Absolute path to the .blend file - INLINECODE3 (object, required): Key-value pairs of Value Node names and float values (e.g.,
{"GrainScale": 2.5, "Roughness": 0.3}) - INLINECODE5 (string, required): Where to save the rendered image (e.g.,
/path/to/output.png) - INLINECODE7 (integer, optional): Cycles samples (default: 128). Ignored for EEVEE.
- INLINECODE8 (string, optional): Render engine -
"CYCLES" (default) or INLINECODE10 - INLINECODE11 (integer, optional): Custom timeout in seconds. Defaults: 1800 for CYCLES, 60 for EEVEE.
- INLINECODE12 (string, optional): Complete path to a real-world reference image. Used for computing LPIPS similarity and Naturalness Delta.
- INLINECODE13 (boolean, optional): Set to
true to compute Naturalness/LPIPS metrics after rendering. Default false.
Returns:
- - On success: INLINECODE16
- On error: INLINECODE17
Examples:
Production quality (CYCLES):
CODEBLOCK1
Fast testing (EEVEE):
CODEBLOCK2
renderproceduralscene_fast
Convenience function for fast EEVEE rendering. Same as render_procedural_scene with engine="EEVEE".
Parameters:
- -
blend_file (string, required): Absolute path to the .blend file - INLINECODE21 (object, required): Key-value pairs of Value Node names and float values
- INLINECODE22 (string, required): Where to save the rendered image
renderproceduralscene_production
Convenience function for production Cycles rendering. Same as render_procedural_scene with engine="CYCLES" and higher samples.
Parameters:
- -
blend_file (string, required): Absolute path to the .blend file - INLINECODE26 (object, required): Key-value pairs of Value Node names and float values
- INLINECODE27 (string, required): Where to save the rendered image
- INLINECODE28 (integer, optional): Cycles samples (default: 512)
analyze_blend
Analyzes a .blend file and returns available Value Nodes that can be manipulated.
Parameters:
- -
blend_file (string, required): Absolute path to the .blend file
Returns: Dict containing status, a complexity object evaluating scene realism, and value_nodes (available parameter names with current values).
Engine Comparison
| Feature | CYCLES | EEVEE |
|---|
| Quality | Photorealistic | Real-time |
| Speed |
Slow (minutes) | Fast (seconds) |
| Timeout | 30 minutes | 1 minute |
| Use case | Production | Testing |
| Samples | Configurable | N/A |
Safety & Limitations
- - Headless execution: Blender runs with
-b flag for security - Parameter validation: Only float values accepted; non-numeric input is rejected
- No shell injection: Uses
subprocess.run(shell=False) with -- separator - CPU fallback: Automatically uses CPU rendering for Cycles if no GPU available
- Timeout protection: Long renders are killed after timeout to prevent hanging
Files
| File | Purpose |
|---|
| INLINECODE36 | OpenClaw execution wrapper with engine selection |
| INLINECODE37 |
Blender-side Python script (handles both engines) |
|
scripts/analyze_blends.py | Blender-side analysis script |
|
config/render_schema.json | Tool schema for LLM function calling |
|
config/analyze_schema.json | Schema for blend file analysis |
Example Workflow
- 1. User: "Render with grain scale increased and surface rougher"
- Agent calls
analyze_blend to see available parameters - Agent calls
render_procedural_scene_fast (EEVEE) for quick preview - If preview looks good, agent calls
render_procedural_scene_production (CYCLES) for final output - Render completes, path returned to user
Version
Compatible with Blender 4.0+. Not backwards compatible with 2.7x.
技能名称:synthclaw
详细描述:
使用时机
- - 生成具有可控参数变化的合成训练数据
- 创建带有真实元数据的程序化图像数据集
- 自动化机器学习训练数据的渲染工作流
- 需要参数扫描渲染且无需手动操作Blender时
不适用场景
- - 需要实时渲染或交互式预览(此为批量/离线模式)
- 超出数值节点调整范围的复杂场景操作
- 未安装Blender或PATH中不可用
系统要求
- - 已安装Blender 4.0+且可在$PATH中调用
- Python 3.10+用于synthclaw包
- Cycles或EEVEE渲染引擎(自动选择)
配置
无需额外配置。确保blender命令可用:
bash
blender --version
工具
renderproceduralscene
调整程序化数值节点并在Blender中渲染单帧。
参数:
- - blendfile(字符串,必填):.blend文件的绝对路径
- parameters(对象,必填):数值节点名称与浮点值的键值对(例如:{GrainScale: 2.5, Roughness: 0.3})
- outputpath(字符串,必填):渲染图像保存路径(例如:/path/to/output.png)
- samples(整数,可选):Cycles采样数(默认:128)。EEVEE模式下忽略。
- engine(字符串,可选):渲染引擎 - CYCLES(默认)或EEVEE
- timeout(整数,可选):自定义超时时间(秒)。默认值:CYCLES为1800,EEVEE为60。
- referenceimage(字符串,可选):真实参考图像的完整路径。用于计算LPIPS相似度和自然度差值。
- computemetrics(布尔值,可选):设置为true可在渲染后计算自然度/LPIPS指标。默认false。
返回结果:
- - 成功时:{status: success, output: /path/to/output.png, log: ..., engine: CYCLES, samples: 128, metrics: {naturalnessmean: 0.85, lpipsalex: 0.12}}
- 错误时:{status: error, message: ...}
示例:
生产级质量(CYCLES):
json
{
blend_file: /home/user/project/assets/test.blend,
outputpath: /home/user/output/render01.png,
parameters: {
GrainScale: 3.0,
DisplacementStrength: 1.5
},
engine: CYCLES,
samples: 256
}
快速测试(EEVEE):
json
{
blend_file: /home/user/project/assets/test.blend,
outputpath: /home/user/output/testrender.png,
parameters: {
GrainScale: 3.0
},
engine: EEVEE
}
renderproceduralscene_fast
用于快速EEVEE渲染的便捷函数。等同于renderproceduralscene的engine=EEVEE模式。
参数:
- - blendfile(字符串,必填):.blend文件的绝对路径
- parameters(对象,必填):数值节点名称与浮点值的键值对
- outputpath(字符串,必填):渲染图像保存路径
renderproceduralscene_production
用于生产级Cycles渲染的便捷函数。等同于renderproceduralscene的engine=CYCLES模式并采用更高采样数。
参数:
- - blendfile(字符串,必填):.blend文件的绝对路径
- parameters(对象,必填):数值节点名称与浮点值的键值对
- outputpath(字符串,必填):渲染图像保存路径
- samples(整数,可选):Cycles采样数(默认:512)
analyze_blend
分析.blend文件并返回可操作的数值节点列表。
参数:
- - blend_file(字符串,必填):.blend文件的绝对路径
返回结果: 包含status、评估场景真实感的complexity对象以及value_nodes(可用参数名称及当前值)的字典。
引擎对比
| 特性 | CYCLES | EEVEE |
|---|
| 质量 | 照片级真实 | 实时渲染 |
| 速度 |
慢(分钟级) | 快(秒级) |
| 超时 | 30分钟 | 1分钟 |
| 用途 | 生产环境 | 测试环境 |
| 采样数 | 可配置 | 不适用 |
安全性与限制
- - 无头执行: Blender使用-b标志运行以确保安全
- 参数验证: 仅接受浮点值;拒绝非数字输入
- 无shell注入: 使用subprocess.run(shell=False)并带--分隔符
- CPU回退: 若无GPU可用,自动使用CPU渲染Cycles
- 超时保护: 超时后强制终止长时间渲染以防止挂起
文件
| 文件 | 用途 |
|---|
| src/synthclaw/blenderskill.py | 带引擎选择的OpenClaw执行包装器 |
| scripts/agentbridge.py |
Blender端Python脚本(处理两种引擎) |
| scripts/analyze_blends.py | Blender端分析脚本 |
| config/render_schema.json | 用于LLM函数调用的工具架构 |
| config/analyze_schema.json | 用于blend文件分析的架构 |
工作流示例
- 1. 用户:渲染时增加颗粒尺度并使表面更粗糙
- 智能体调用analyzeblend查看可用参数
- 智能体调用renderproceduralscenefast(EEVEE)快速预览
- 若预览效果良好,智能体调用renderproceduralscene_production(CYCLES)生成最终输出
- 渲染完成,路径返回给用户
版本
兼容Blender 4.0+。不向后兼容2.7x版本。