在 Blender 中使用 Stable Diffusion Render 圖片

在 Stable Diffusion 中生成圖片的速度有時候比 Blender 3D render 圖片更快,那麼可以用 Stable Diffusion 當成 renderer 使用嗎?答案是可以的。

在 Blender 中使用 Stable Diffusion Render 圖片
在 Blender 中使用 Stable Diffusion Render 圖片

在 Stable Diffusion 中生成圖片的速度有時候比 Blender 3D render 圖片更快,那麼可以用 Stable Diffusion 當成 renderer 使用嗎?答案是可以的,Stability AI 推出了 Blender 的插件,配合 DreamStudio API 使用就可以在 Blender 以 3D 場景為基礎生成圖片,但這個官方插件一定要使用 DreamStudio API,令靈活性有所不足。

Stability For Blender
Stability for Blender is the officially supported, free to use, zero-hassle way to use the Stability SDK inside Blender. With no GPU needed, Stability for Blender lets you use Stable Diffusion with just an internet connection.
不建議使用 stability 推出的官方插件

既然不建議使用官方插件,想必有更好的選擇!沒錯,以下我會介紹另一個非官方的 Blender 插件,此插件除了支援 DreamStudio API 外,也支援 Automatic1111 StableDiffusionWebUI 輸出的 API,即是說可以完全在本地完成 Blender 的 AI 圖片生成動作。

如果還沒安裝 Stable Diffusion 可以先看此 post:

MacOS 安裝 StableDiffusionWebUI 及 有用的 Extension
雖然網上有不少 Cloud 的 圖像生成 AI service,但是如果要大量/長期免費地使用,在本地安裝及依靠本機運算能力的 Stable Diffusion 是一個不錯的選擇。
Automatic1111 的 StableDiffusionWebUI 安裝教學

AI Render

AI Render 官方介紹影片

安裝

名副其實就是用 AI 來 render 圖片,大家可以在 Blender Market 上下載。

Ai Render - Stable Diffusion In Blender
Render with Stable Diffusion in Blender. This add-on renders an AI generated image based on a text prompt and your scene. Create incredible AI generated images with Stable Diffusion easily, without running any code on your own computer!
建議使用 AI Render

註冊/登入後下載 AI Render 的 .zip 檔案,不用解壓。在 Blender Preferences > Add-ons 中 Install 選擇 AI Render 的 .zip 檔進行安裝,完成後點選 Render: AI Render - Stable Diffusion in Blender。

AI Render 安裝完成

按左上角的小箭咀打開設定,由於今次教學會使用 Automatic1111 的 StableDiffusionWebUI 的 API,所以在 Setup: Stable Diffusion Backend 中選擇 Automatic1111 (local),其他設定也可以不改直接使用。

輸入你 Stable Diffusion 的 URL

設定 StableDiffusionWebUI API

  • Windows 用戶
  • 打開 webui-user.bat
  • 將 set COMMANDLINE_ARGS= 改成 set COMMANDLINE_ARGS=--api
  • 然後重新開啟 StableDiffusionWebUI
  • MacOS/Linux 用戶
  • 打開 webui-user.sh
  • 將 #export COMMANDLINE_ARGS="" 改成 export COMMANDLINE_ARGS="--api"
  • 然後重新開啟 StableDiffusionWebUI

確定你 Blender 中的 Local Web Server URL = 你 StableDiffusionWebUI 的位置。


怎樣使用?

首先打開 Blender 隨便加幾個物件及加點顏色並確保在鏡頭內見到。

在Blender隨便加些物件

在 Render Properties 頁面可以找到 AI Render,我把 Image Size 改成 768 x 768 , Prompt 加入一些簡單 prompts 1girl, building, masterpiece, best quality, high resolution, intricate details, cinematic lighting, 8k, HDR, colorful , Negative prompt 中預設有些 prompts 我就不改了。

在 Render Properties 可以更改 AI Render 設定

一切準備好了就可以按 F12 開始 render,Blender Render 完成 rendering 後 Stable Diffusion 也會馬上開始運作,然後在 AI Render 的 Tab 中顯示,由於在 Blender 內沒有 Stable Diffusion 的進度,所以沒完成前不要關閉 Blender。

在 AI Render 也預設了不少風格,大家可以在 Blender 中直接選取風格。

AI Render 內預設的風格
AI Render 官方教學影片

總結

AI Render 的功能遠比官方的插件強大,甚至支援 ControlNet 等強大功能,雖然也可以在 Blender 輸出圖片給 Stable Diffusion Img2Img,但直接將 Stable Diffusion 當成 Blender 的 Render 來用也有不錯的體會,相信對很多有用 Blender 的用家有很大的幫助。

Read more

Unity AI Assistant 2.7.0 將不再支援 MCP 連接

Unity AI Assistant 2.7.0 將不再支援 MCP 連接

相信有不少人用 Unity AI MCP 來連接 Claude Code / Codex 等 AI 工具進行開發,近日隨著 Unity AI 進入公測,Unity 官方 Package com.unity.ai.assistant 亦升級到 v2.7.0-pre.2 。這個新版本的 Unity AI Assistant 在 Unity MCP Server 上加上了限制,Connected Clients limit 在 0 個 direct connection(以前是 Unlimited),就是不讓開發者使用其他 AI 工具來支援開發。 官方也有說明可以怎樣做,

Game Engine 的選擇

Game Engine 的選擇

在前陣子在決定寫 game 的期間,我試用了三大主流 Game Engine 來實作 demo,現在比較一下 Unreal,Unity 及 Godot 適合什麼開發者。 自我定位 在開始選擇前,我首先要確定自己是什麼開發者,以什麼角度去選擇 Game Engine。 * 首先我是獨立開發者,就是一個人會負責所有東西,繪圖設計,故事劇情,程式開發,宣傳銷售,後續經營,所以簡單很重要。 * 我使用 Macbook Pro M1 來開發,由於我沒有 desktop,單靠效能有限的主機來開發,所以效能夠不夠對我來說也是很重要。 * 遊戲平台,我的初期目標是 Steam/Andriod/iOS,如果有成果才會推向各大主機,雖然三大 Game Engine 都支持多平台輸出,但實際上調查後發現還是有一些限制,我會在下面解釋。 * 遊戲類型,