Blender MCP
官方一个轻量级的MCP(模型上下文协议)服务器,用于Blender。它通过Blender的Python API提供自然语言接口,改进了对文档的访问,并允许用户探索和理解复杂的设置。
你可以用 Blender MCP 做什么?
- 分析场景性能 — 让助手从相机视角找出相对于屏幕尺寸多边形数量最高的对象。
- 重命名数据块 — 修正拼写错误或为对象、灯光、相机、纹理及其他数据块应用描述性命名规范。
- 查询数据关系 — 使用自然语言询问哪些对象使用了特定材质,或数据块之间的连接方式。
- 调试场景问题 — 识别打开文件中多边形数量最高的对象、非流形网格或其他常见问题。
- 记录几何节点设置 — 生成内联文档框架及文本数据块,说明节点组的功能及其结构。
文档
一个轻量级的 Blender MCP(模型上下文协议)服务器。它提供了与 Blender Python API 交互的自然语言界面,改善了文档访问,并允许用户探索和理解复杂的设置。
有关架构的技术细节和文档,请查看源代码。
安全警告
该 MCP 服务器将在 Blender 中执行 LLM 生成的代码,没有任何保护措施来防止您的数据被删除或发送到远程位置。为确保数据安全,建议使用虚拟机或无法访问敏感信息的系统。
安装
Blender 没有任何内置功能用于连接 LLM。
为了让 Blender 与 LLM 连接,必须手动下载、安装并运行三个外部工具。
要求:
- Blender 5.1 或更新版本
- 插件
- LLM 客户端
- MCP 服务器
插件
为了与您的 Blender 会话交互,您需要安装一个特定的插件用于 MCP 服务器集成。
拖放到 Blender 中
…或下载并从磁盘安装
如果您拖放到 Blender 中,您需要执行两次。第一次是添加 Blender Lab 仓库,第二次是安装插件本身。此方法允许您在此插件有新版本时接收更新通知。
LLM 客户端
MCP 服务器遵循明确定义的标准,并与众多客户端兼容。请遵循 Llama.cpp 文档,或安装您偏好的 LLM 客户端。
MCP 服务器
根据您的 LLM 客户端功能,有不同的 MCP 服务器安装方式。
- MCP 捆绑包:对于支持
.mcpb文件的较新客户端,请从发布页面下载最新包。Llama.cpp 尚不支持此功能。 - MCP 服务器:要从源代码安装,请查看 Llama.cpp 文档或设置说明。
运行
一旦您在 LLM 客户端中设置好 MCP 服务器,就可以开始探索您的 Blender 场景。
运行 blender-mcp 服务器的 llama.cpp Web 界面。
示例 1:场景分析
MCP 可用于以编程方式分析场景的性能瓶颈。以 Classroom 演示文件为例:
Classroom 演示文件。
此场景是 Blender 基准测试文件之一。这些文件之所以被纳入基准测试,是因为它们很好地代表了艺术家创建的真实制作文件。毫不奇怪,它可能包含易于优化的对象。
虽然检查多边形数量通常就足够了,但更有趣的是根据对象在最终渲染中显示的大小来绘制多边形数量图。这可以通过以下提示获得。
Analyze the scene and list the outliers: objects with highest polygon count but smaller size from the camera point of view.
绘制出的结果数据清楚地显示了两个与众不同的对象:alphabet 和 coat 1:
Classroom 演示场景的每屏幕区域多边形数量图表分析。
alphabet 对象有 2 万个多边形。由于其平面布局,可以用纹理替换,对最终结果影响很小。coat 1 对象由于其 Subsurf 修改器而有 3.7 万个多边形。如果内存是系统的瓶颈,降低细分级别可以减轻场景负担。
字母表位于场景后方,可以轻松地用纹理替换。外套也足够远,可以简化其网格。
这些结果的可靠性如何?
LLM 返回的初始分析仅考虑了影响视口的修改器。coat 1 对象有一个 Solidify 修改器,使其多边形数量翻倍,使其更加突出。尽管此场景未启用 Simplify,但此设置也会影响最终分析。
示例 2:各种提示
以下是一些其他已测试的用例。您需要粘贴整个“提示”内容才能使其生效。作为起点,您应使用相应的演示文件。操作的成功与否取决于所使用的模型。
| 用例 | 提示 | 演示文件 | 结果 |
|---|---|---|---|
| 数据块重命名:修复拼写错误 | 在当前打开的 Blender 文件中,修复所有数据块的名称以消除拼写错误。报告哪些数据块被修复。 | Scattering Pebbles | GRP-rocks → GRP-pebble, LGT-Lights → LGT-lights, Compositing Nodetree → Compositing Node Tree |
| 数据块重命名:更好的名称 | 在当前打开的 Blender 文件中,为所有数据块建议描述性名称,并在批准后应用。 | Scattering Pebbles | Camera → CAM-main, Area → LGT-sun-key, Area.001 → LGT-sun-fill, Area.002 → LGT-area-rim, GEO-pebble.001 → GEO-pebble-B, … |
| 使用自然语言查询数据关系 | 哪些对象使用了以下材质:pebbles | Scattering Pebbles | 7 个对象:GEO-pebble, GEO-pebble.001, GEO-pebble.002, GEO-pebble.003, GEO-pebble.004, GEO-pebble.005, GEO-pebble.006 |
| 场景调试 | 此文件中多边形数量最高的对象是什么?忽略未链接到任何场景的对象。 | Scattering Pebbles | GEO-ground,具有 4,096 个面。 |
| 几何节点文档 | 在当前打开的 Blender 文件中,解释主要的几何节点设置正在做什么。使用框架元素为其添加内联文档。创建一个包含分析结果的文本数据块。 | Scattering Pebbles | 4 个主要的颜色编码框架 + 包含解释的文本文件。 |
其他尚未探索的提示:
- 将所有数据块从法语翻译成英语。
- 我的网格没有被我的骨架变形,我该如何修复?
- Blender 渲染此场景时内存不足,我该如何优化?
- 此网格有奇怪的着色伪影,我该如何修复?
- 查找具有不良法线的网格对象。
- 检查我的场景中是否存在非均匀变换的网格对象。
- 我导出的视频在 Web 浏览器中无法播放,我应该更改哪些设置?
- 我应该使用哪些雕刻笔刷来创建和细化树枝?
- 设置合成节点以将我的图像同时保存为 SDR 和 HDR。
- 验证此清单:网格必须是流形的,所有对象必须具有材质,命名必须遵循约定,无绝对路径,… 数据块重命名:修复拼写错误
GRP-rocks → GRP-pebbles(场景仅包含鹅卵石对象,而非岩石)。
LGT-Lights → LGT-lights(大小写不一致)。
Compositing Nodetree → Compositing Node Tree(Nodetree 是一个复合词错误)。
数据块重命名:更好的名称
对象:
Camera→CAM-mainArea→LGT-sun-keyArea.001→LGT-sun-fillArea.002→LGT-area-rimGEO-pebble.001→GEO-pebble-BGEO-pebble.002→GEO-pebble-CGEO-pebble.003→GEO-pebble-DGEO-pebble.004→GEO-pebble-EGEO-pebble.005→GEO-pebble-FGEO-pebble.006→GEO-pebble-G
灯光数据块:
Area→LGT-sun-keyArea.001→LGT-sun-fillArea.002→LGT-area-rim
摄像机数据块:
Camera→CAM-main
纹理:
Texture→TEX-ground-cloudsTexture.001→TEX-ground-image
场景与世界:
World→WLD-environmentScene→SCN-main几何节点文档
创建的新框架:
添加到几何节点设置的文档框架。
文本数据块:
GEOMETRY NODES ANALYSIS -- "Pebble Scattering Nodes"
Applied to object: GEO-ground | Modifier: Pebbles
========================================================
OVERVIEW
--------
This node group scatters three size categories of pebble meshes across
the faces of a ground mesh. Each category uses its own density mask
and a global Factor multiplier so that coverage can be art-directed
per-layer without touching the raw mask textures. The three resulting
instance layers are merged with the original ground geometry and sent
to the Group Output.
INPUTS (Group Interface)
------------------------
Geometry -- The ground mesh to scatter pebbles on.
Large Pebbles Mask -- Float mask (e.g. vertex colour / texture) that
defines WHERE large pebbles may appear.
Medium Pebbles Mask-- Float mask for medium pebble placement regions.
Small Pebbles Mask -- Float mask for small pebble placement regions.
Factor -- Global density multiplier shared by all three
lanes (appears three times in the interface,
one per lane).
NODE GRAPH -- LANE BY LANE
--------------------------
+- LARGE PEBBLES LANE -----------------------------------------------------+
| Source object : GEO-pebble |
| Group Input.001 |
| +- Geometry ------------------------> Distribute Points on Faces |
| +- Large Pebbles Mask ------------> Distribute Points on Faces |
| | (Density Factor socket) |
| +- Factor --> Math.003 (x) -------> Distribute Points on Faces |
| (Density Max socket) |
| Distribute Points on Faces ----------> Instance on Points |
| Object Info (GEO-pebble) -----------> Instance on Points (Instance) |
| Random Rotation.001 [-pi, +pi] -----> Instance on Points (Rotation) |
| Random Value [0.25 - 0.60] -------> Instance on Points (Scale) |
| Instance on Points ------------------> Join Geometry.003 |
+--------------------------------------------------------------------------+
+- MEDIUM PEBBLES LANE ----------------------------------------------------+
| Source object : GEO-pebble.004 |
| Group Input.002 |
| +- Geometry ------------------------> Distribute Points on Faces.001 |
| +- Medium Pebbles Mask -----------> Math.004 (x) --> Math.005 (x) |
| +- Factor ------------------------> Math.005 (x) |
| Math.005 output --------------> Distribute Points on Faces.001 |
| (Density socket) |
| Distribute Points on Faces.001 -----> Instance on Points.001 |
| Object Info.001 (GEO-pebble.004) --> Instance on Points.001 |
| Random Rotation.002 [-pi, +pi] ----> Instance on Points.001 |
| Random Value.002 [0.25 - 0.45] -----> Instance on Points.001 |
| Instance on Points.001 -------------> Join Geometry.003 |
+--------------------------------------------------------------------------+
+- SMALL PEBBLES LANE -----------------------------------------------------+
| Source object : GEO-pebble.002 |
| Group Input.003 |
| +- Geometry ------------------------> Distribute Points on Faces.002 |
| +- Small Pebbles Mask -----------> Math.006 (x) --> Math.007 (x) |
| +- Factor ------------------------> Math.006 (x) |
| Math.007 output --------------> Distribute Points on Faces.002 |
| (Density socket) |
| Distribute Points on Faces.002 -----> Instance on Points.002 |
| Object Info.002 (GEO-pebble.002) --> Instance on Points.002 |
| Random Rotation [-pi, +pi] ----> Instance on Points.002 |
| Random Value.003 [0.10 - 0.35] -----> Instance on Points.002 |
| Instance on Points.002 -------------> Join Geometry.003 |
+--------------------------------------------------------------------------+
+- MERGE & OUTPUT ---------------------------------------------------------+
| Group Input.004 |
| +- Geometry (pass-through) --------> Join Geometry.003 |
| Join Geometry.003 |
| (inputs: large instances + medium instances + |
| small instances + original ground geo) |
| +- Geometry -----------------------> Group Output |
+--------------------------------------------------------------------------+
SCALE RANGES (uniform, per lane)
---------------------------------
Large pebbles : 0.25 - 0.60
Medium pebbles : 0.25 - 0.45
Small pebbles : 0.10 - 0.35
ROTATION (all lanes)
---------------------
All three axes randomised independently over [-pi, +pi],
giving each pebble instance a fully random orientation.
DENSITY CONTROL PATTERN (Medium & Small lanes)
-----------------------------------------------
The mask value and the Factor are first multiplied together
(Math.004 / Math.006), then that product is multiplied again
by a second value (Math.005 / Math.007) before being fed into
the Density socket. This two-stage multiply gives a non-linear
response curve, making the density fall off more aggressively
near the mask edges.
The Large lane uses a different (single-stage) approach:
the Density Factor socket receives the mask directly, and the
Factor is only used to scale Density Max via Math.003.
NOTES & SUGGESTIONS
--------------------
* The node group has no Seed input exposed; adding one would allow
re-randomising all three layers simultaneously without touching
individual nodes.
* The Factor input currently appears three times (once per lane).
Merging them into a single shared socket would simplify the
modifier panel.
* Consider labelling the unlabelled Math nodes (Math.003-.007)
and Random Value nodes to aid future maintenance.