Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

材質

使用現有的 Godot 材質

匯出工具處理材質的其中一個方法為嘗試將 Blender 材質與現有的 Godot 材質做配對。這樣做的優點即為能使用 Godot 材質系統的所有功能,但也代表看不到有在 Blender 中套用材質的模型。

為此,匯出工具會在 Godot 中找出與 Blender 上相同名稱的材質。所以當從 Blender 中匯出包含有 PurpleDots 材質的物件時,匯出工具會尋找 PurpleDots.tres 檔案並指派至物件中。若 PurpleDots.tres 不是 SpatialMaterialShaderMaterial 或找不到該檔案,則匯出工具會轉而將 Blender 中的材質匯出。

匯出工具尋找 .tres 的位置是由「Material Search Path」選項來判斷的:

../../../_images/material_search.jpg
有下列選項:
  • Project Directory - 專案資料夾:會嘗試尋找 project.Godot 並遞迴搜尋子資料夾。若找不到 project.Godot 則會拋出錯誤。適用於沒有衝突名稱的專案。

  • Export Directory - 匯出資料夾:於匯出路徑中的子資料夾內尋找材質。適用於有重複材質名稱且需要控制所指派材質的專案。

  • None - 無:不搜尋材質,從 Blender 檔案中匯出。

匯出 Cycles/EEVEE 材質

匯出工具對於將 Cycles/EEVEE 材質節點樹轉換為 Godot Shader Material 有基本支持。請注意,有些 Shader Node 由於難以實作所以尚未支援。未支援的 Shader Node 如下:

  • 所有 noisy texture

  • generated texture coordinates

  • group node

  • 除了 PrincipledBSDF, Diffuse, Glossy, Glass, add shadermix shader 以外的 Shader Node

警告

如果可以的話,請儘量使用 GGX 分佈的 PrincipledBSDF 作為輸出 Shader Node,只有這種 Shader Node 能保證產生完全正確的結果。其他 Shader Node 則只能產生相近結果。

有時材質可能無法用於匯出 (如有不支援的節點),或材質使用 Blender Internal Engine。僅有漫射色彩與一些旗標 (如 Unshaded) 會從 Sparial Material 中匯出。

產生外部材質

匯出材質的預設設定會將所有的材質都放在 escn 檔案內。可設定選項來讓 Godot 中開啟 escn 檔案時產生外部 .material 檔案。

../../../_images/external_mat_option.jpg

.material 檔可指派至任何材質槽為外部資源。

../../../_images/gd_dot_material.jpg