Blender MCP

官方

一個輕量級的 MCP(模型上下文協定)伺服器,專為 Blender 設計。它提供與 Blender Python API 的自然語言介面,改善對文件資料的存取,並讓使用者能夠探索與理解複雜的設定。

你可以用 Blender MCP 做什麼?

  • 場景分析 — 請您的助理分析開啟中的 Blender 場景,並找出效能異常的物件,例如相對於螢幕上尺寸具有高多邊形數量的物件。
  • 資料區塊重新命名 — 指示助理修正目前檔案中所有資料區塊的拼字錯誤,或建議更具描述性的名稱,且僅在您核准後才套用變更。
  • 自然語言查詢 — 直接查詢物件之間的關係,例如詢問哪些物件使用了特定材質,或場景中哪個物件的多邊形數量最高。
  • 幾何節點文件 — 請助理解釋複雜的幾何節點設定、新增內嵌文件框架,並建立包含完整分析的文字資料區塊。
  • 場景除錯 — 請助理診斷目前專案中的問題,例如網格變形問題、著色瑕疵或非均勻縮放的物件。

文件

一個輕量級的 MCP(Model Context Protocol)伺服器,用於 Blender。它提供與 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 可用於以程式化方式分析場景中的效能瓶頸。以教室示範檔案為例:

教室示範檔案。

此場景是 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:

Graph analysis of the polycount per screen area

教室示範場景中每個螢幕區域的多邊形數量圖形分析。

alphabet 物件有 20,000 個多邊形。由於其平坦的配置,可以用紋理取代,對最終結果的影響很小。coat 1 物件因其 Subsurf 修改器而有 37,000 個多邊形。如果記憶體是您系統的瓶頸,降低細分層級可以減輕場景負擔。

字母位於場景後方,可以輕鬆地用紋理取代。外套也足夠遠,可以簡化其網格。

[!info] 資訊 這些結果有多可靠?

LLM 回傳的初始分析僅考慮影響視埠的修改器。coat 1 物件具有 Solidify 修改器,使其多邊形數量加倍,使其更為突出。雖然此場景未啟用 Simplify,但此設定也會影響最終分析。


範例 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.散佈鵝卵石GRP-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.散佈鵝卵石Camera → 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: pebbles散佈鵝卵石7 個物件: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.散佈鵝卵石GEO-ground 有 4,096 個面。
Geometry Nodes 文件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.散佈鵝卵石4 個主要顏色編碼框架 + 含說明的文字檔案。

其他尚未探索的提示詞:

  • 將所有資料區塊從法文翻譯成英文。
  • 我的網格沒有被我的骨架變形,我該如何修復?
  • Blender 在渲染此場景時記憶體不足,我該如何最佳化?
  • 此網格有奇怪的著色偽影,我該如何修復?
  • 尋找具有法線不良網格的物件。
  • 檢查我的場景中是否有非均勻變換的網格物件。
  • 我匯出的影片無法在我的網頁瀏覽器中播放,我應該更改哪些設定?
  • 我應該使用哪些雕刻筆刷來建立和細化樹枝?
  • 設定合成節點,將我的影像同時儲存為 SDR 和 HDR。
  • 驗證此檢查清單:網格必須是流形、所有物件必須有材質、命名必須符合慣例、不得有絕對路徑、… 資料區塊重新命名:修正拼字錯誤

GRP-rocks → GRP-pebbles(場景中僅包含鵝卵石物件,而非岩石)。

LGT-Lights → LGT-lights(大小寫不一致)。

Compositing Nodetree → Compositing Node Tree(Nodetree 是複合詞錯誤)。

資料區塊重新命名:更好的名稱

物件:

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

燈光資料區塊:

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

相機資料區塊:

  • Camera → CAM-main

紋理:

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

場景與世界:

  • World → WLD-environment
  • Scene → SCN-main Geometry Nodes 文件

建立的新框架:

Documentation frames added to the geometry nodes setup.

新增至 geometry nodes 設定的文件框架。

文字資料區塊:

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.