Blender MCP

官方

一个轻量级的MCP(模型上下文协议)服务器,用于Blender。它通过Blender的Python API提供自然语言接口,改进了对文档的访问,并允许用户探索和理解复杂的设置。

你可以用 Blender MCP 做什么?

  • 场景性能分析 — 让您的AI分析打开的Blender场景,并识别相对于屏幕尺寸具有高多边形数量的对象,如教室演示中的异常检测。
  • 数据块重命名 — 让助手修正当前文件中所有数据块的拼写错误或建议描述性名称,仅在您批准后应用更改。
  • 自然语言场景查询 — 询问关于对象关系的问题,例如“哪些对象使用了材质‘pebbles’?”或识别场景中多边形数量最高的对象。
  • 几何节点文档 — 请求对主要几何节点设置的解释,包括内联帧文档和总结分析的文本数据块。
  • 场景调试 — 获取故障排除帮助,如非均匀缩放网格、法线错误或对象未随骨架正确变形等问题。

文档

一个用于 Blender 的轻量级 MCP(模型上下文协议)服务器。它通过 Blender 的 Python API 提供自然语言界面,改善对文档的访问,并允许用户探索和理解复杂的设置。

有关架构的技术细节和文档,请查看源代码

[!warning] 警告 安全警告
MCP 服务器将在 Blender 中执行 LLM 生成的代码,没有任何防护措施来保护你的数据免遭删除或被发送到远程位置。为确保数据安全,建议使用虚拟机或不含敏感信息的系统。

安装

Blender 没有任何用于连接 LLM 的内置功能。

为了让 Blender 与 LLM 连接,必须手动下载、安装并运行三个外部工具


插件

为了与你的 Blender 会话交互,你需要为 MCP 服务器集成安装一个特定的插件。

…或下载从磁盘安装

如果你拖放到 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 网页界面。


示例 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.

绘制出的结果数据清晰地显示了两个从其他对象中脱颖而出的对象:alphabetcoat 1

Graph analysis of the polycount per screen area

Classroom 演示场景中每屏幕区域多边形数量的图形分析。

alphabet 对象有 20k 个多边形。由于其扁平布局,可以用纹理替换,对最终结果几乎没有负面影响。coat 1 对象由于其细分曲面修改器而有 37k 个多边形。如果内存是系统的瓶颈,降低细分级别可以减轻场景负担。

字母位于场景后方,可以轻松替换为纹理。外套也足够远,可以简化其网格。

[!info] 信息 这些结果有多可靠?

LLM 返回的初始分析仅考虑了影响视口的修改器。coat 1 对象有一个实体化修改器,使其多边形数量翻倍,使其成为更明显的异常值。尽管此场景未启用简化,但该设置也会影响最终分析。


示例 2:各种提示词

以下是一些其他经过测试的用例。你需要粘贴完整的“提示词”内容才能使其生效。作为起点,你应该使用对应的演示文件。操作的成功率将取决于所使用的模型。

用例提示词演示文件结果
数据块重命名:修复拼写错误With the current open Blender file fix the name of all the data-blocks to remove typos. Report back which data-blocks got fixed.Scattering PebblesGRP-rocks → GRP-pebble, LGT-Lights → LGT-lights, Compositing Nodetree → Compositing Node Tree
数据块重命名:更好的名称With the current open Blender file suggest descriptive names for all data-blocks, and apply if approved.Scattering PebblesCamera → CAM-main, Area → LGT-sun-key, Area.001 → LGT-sun-fill, Area.002 → LGT-area-rim, GEO-pebble.001 → GEO-pebble-B, …
使用自然语言查询数据关系Which objects are using the following material: pebblesScattering Pebbles7 个对象:GEO-pebble, GEO-pebble.001, GEO-pebble.002, GEO-pebble.003, GEO-pebble.004, GEO-pebble.005, GEO-pebble.006
场景调试What is the object with the highest poly-count on this file? Ignore objects which are not linked to any scene.Scattering PebblesGEO-ground,包含 4,096 个面。
几何节点文档With the current open Blender file explain what the main geometry nodes setup is doing. Add inline documentation for it with frame elements. Create a Text data-block with the result of analysis.Scattering Pebbles4 个主要颜色编码帧 + 带说明的文本文件。

其他待探索的提示词:

  • 将所有数据块从法语翻译成英语。
  • 我的网格没有被我的骨架变形,我该如何修复?
  • Blender 渲染此场景时内存不足,我该如何优化?
  • 这个网格有奇怪的着色伪影,我该如何修复?
  • 查找具有法线错误的网格对象。
  • 检查我的场景中是否有非均匀变换的网格对象。
  • 我导出的视频无法在我的网页浏览器中播放,我应该更改哪些设置?
  • 我应该使用哪些雕刻笔刷来创建和细化树枝?
  • 设置合成节点以将我的图像同时保存为 SDR 和 HDR。
  • 验证此检查清单:网格必须是流形的,所有对象必须有材质,命名必须遵循约定,不能有绝对路径,…… 数据块重命名:修复拼写错误

GRP-rocksGRP-pebbles(场景中只包含鹅卵石对象,没有岩石)。

LGT-LightsLGT-lights(大小写不一致)。

Compositing NodetreeCompositing Node Tree(Nodetree 是一个复合词错误)。

数据块重命名:更好的名称

对象

  • CameraCAM-main
  • AreaLGT-sun-key
  • Area.001LGT-sun-fill
  • Area.002LGT-area-rim
  • GEO-pebble.001GEO-pebble-B
  • GEO-pebble.002GEO-pebble-C
  • GEO-pebble.003GEO-pebble-D
  • GEO-pebble.004GEO-pebble-E
  • GEO-pebble.005GEO-pebble-F
  • GEO-pebble.006GEO-pebble-G

灯光数据块

  • AreaLGT-sun-key
  • Area.001LGT-sun-fill
  • Area.002LGT-area-rim

相机数据块

  • CameraCAM-main

纹理

  • TextureTEX-ground-clouds
  • Texture.001TEX-ground-image

场景与世界

  • WorldWLD-environment
  • SceneSCN-main 几何节点文档

创建的新帧

Documentation frames added to the geometry nodes setup.

添加到几何节点设置中的文档帧。

文本数据块

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.