Community影像github.com

m4bwav/polywright-generate

從提示詞、2D 圖像、概念藝術或粗略模型建立 3D 模型:使用 ComfyUI(TRELLIS.2、Pixal3D、Hunyuan3D-2 經由 pw.py gen)或託管服務(Meshy、Tripo、Rodin),以及基於程式碼(bpy、build123d、CadQuery、OpenSCAD)的精確建模。適用於「幫我做一個龍的 3D 模型」、「將這張概念圖轉成 3D」、「圖像轉 3D」、「文字轉 3D」等任務。

polywright-generate 是什麼?

polywright-generate 是一個專為 AI 代理設計的 3D 模型生成技能,用於將想像或假設的 3D 模型轉化為實際資產。它支援兩種核心引擎:基於程式碼的建模(bpy、build123d、CadQuery、OpenSCAD)適用於有尺寸、可編輯的精確零件;基於生成器的建模(TRELLIS.2、Pixal3D、Hunyuan3D-2、Meshy、Tripo、Rodin)適用於有機、雕塑形狀的快速近似模型。使用者需根據物件特性而非習慣選擇引擎。工作流程包括:先收集參考圖像(建議 1024 px、白底、平光),然後執行 pw.py gen 命令,或編寫程式碼腳本進行參數化建模。生成後需檢查模型、記錄授權,並進行縮放與後處理(polywright-finish、polywright-print)。此技能支援 ComfyUI 自託管及託管 API,並內建授權記錄機制,確保每個生成結果都符合授權規範。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/m4bwav/polywright/tree/HEAD/skills/polywright-generate

Installed? Explore more 影像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

polywright-generate 是做什麼的?

兩種引擎負責建構想像的模型:程式碼(精確、可編輯、銳利、有尺寸)與生成器(有機、快速、近似、網格亂)。按物件選擇,而非習慣。回到中樞: ../polywright/SKILL.md。模型表格(含授權與 VRAM): references/generators.md。程式碼範例:references/code-modeling.md。

步驟 1:程式碼還是生成器?

物件引擎
有尺寸、與其他物件配合、多為平面與圓柱(支架、外殼、層板、建築、標誌、板條箱)程式碼:使用 build123d、CadQuery 或 OpenSCAD 製作可列印與 CAD 零件;使用 bpy 製作遊戲套件與建築
同一類物件的多種變化(圍欄、房屋、岩石、森林)程序化程式碼(bpy、Geometry Nodes),由少數主體資產生成
有機或雕塑類的一次性物件(雕像、生物、角色、樹幹、食物)生成器,需提供參考圖像或多視角圖集
會動畫化的角色生成器負責外形,再重製拓撲與骨架(polywright-finish)
擁有照片的真實物件優先嘗試 polywright-capture;生成器僅猜測隱藏面

擴散程序會使銳利邊緣模糊並任意產生尺寸;程式碼無法雕刻獅子的臉。許多好的模型兩者兼具:程式碼建造的基座,布林運算接合生成器的獅頭噴口。

步驟 2:生成器

  1. 先準備參考資料(polywright-references):一張乾淨的白底圖像,平光、透視小、1024 像素;角色使用 A-Pose;若要更好的背面,提供正面/左側/背面/右側等比例圖集。
  2. python ../polywright/scripts/pw.py doctor 顯示 ComfyUI 主機及其 3D 檢查點。
  3. 執行其中一種:
    • 內建 Hunyuan3D-2(僅形狀,16 GB 顯示卡約 100 秒,30 步,八叉樹 256): pw.py gen --image refs/front.png [--left L --back B --right R] --out work/raw.glb [--seed N]
    • 任何其他 ComfyUI 工作流程,採 API 格式或編輯器儲存的格式(範本檔案可直接使用;pw.py 會根據主機節點定義轉換):pw.py gen --image refs/front.png --workflow <file> --out work/raw.glb。 TRELLIS.2 與 Pixal3D 含 PBR 紋理:ComfyUI 的範本 3d_pixal3d_trellis2_image_to_model.json(位於 ComfyUI 安裝目錄的 comfyui_workflow_templates_json/templates);其開關預設選擇 Pixal3D,可加上 --set 316.value=true 切換為 TRELLIS.2。在 16 GB 顯示卡上(GPU 時間):TRELLIS.2 冷啟動 377 秒(熱啟動 73 到 190 秒),正面朝上,細節最佳;Pixal3D 329 秒,位於相機畫面內(傾斜時可使用 pw.py convert IN OUT --level 修正);兩者約 700k 三角形,4096 像素 PBR 紋理;Hunyuan3D-2 99 秒,僅形狀。--set NODE.input=VALUE 可變更任何輸入。
    • 託管 API(Meshy 有最透明的公開價格表;Tripo、Rodin、Hunyuan 3.x):透過其自有 API、MCP,或 ComfyUI 的合作節點。花費前需告知成本。
  4. 每次執行會寫入 <out>.gen.json(主機、模型、種子、步數)。記錄模型及其授權: pw.py manifest <dir> --add-tool "<model>" --tool-version <v>。
  5. 檢查:pw.py inspect work/raw.glb 然後 pw.py render work/raw.glb --out renders/raw。將結果與參考圖像比較:背面與底部是猜測;多餘肢體、熔化的細薄部分與融合的間隙很常見。在手工修正前,可嘗試不同種子或更好的視角重新生成。繪製的文字與數字會糊成一團,顏色會偏移:pw.py mark 可清除並重新繪製標記,並將顏色對齊照片顏色(L-003;影片用圖形)。

原始輸出未縮放、網格密集(數十萬三角形)、常為非流形、無 UV、Y 軸朝上。不可直接作為遊戲就緒或列印就緒模型:需先進行縮放與後製(polywright-finish、polywright-print)。

步驟 3:程式碼

撰寫腳本,使用具實際尺寸的命名零件建構物件,執行、檢視、修正:

  • bpy:pw.py bpy build.py -- --out work/model.blend(可能因 Blender 版本問題:polywright-blender)。
  • build123d 或 CadQuery(Python)或 OpenSCAD(openscad -o out.stl model.scad,使用 Manifold 後端)用於實體:建構時即為水密,可匯出 STEP 供 CAD 使用,以及 STL 或 3MF 供列印使用。

在腳本中加入檢查(總體尺寸、零件間隙、壁厚、零件數量)並印出結果;代理能良好地修復因回溯追蹤造成的當機,但形狀錯誤僅能透過測量與渲染來發現。回溯追蹤發生兩次後,應重新思考。

步驟 4:為生成或程式碼產生的網格加上紋理

TRELLIS.2 與 Pixal3D 在其工作流程中已烘焙 PBR 紋理。對於未上紋理的網格:TRELLIS.2 的形狀條件紋理階段、StableGen(Blender 附加元件,後端使用 ComfyUI,GPLv3)從相機投影 SDXL、Flux 或 Qwen Image 2.1(0.4.0 版本新增遮罩區域重新紋理與 SkinTokens 自動骨架綁定;Qwen Image 2.1 與 FIBO 2.0 Edit 僅供非商業使用,MOSS Image 為 Apache-2.0),或使用 CC0 材質庫(polywright-references)。Hunyuan 2.1 繪製約需 21 GB 記憶體。

授權(每次執行皆須記錄)

TRELLIS.2、Pixal3D、TripoSG、PartCrafter:MIT 授權。Hunyuan3D 開放權重:騰訊社群授權(不授權於歐盟、英國或南韓使用;月活躍用戶上限 100 萬;輸出物不得用於訓練其他模型)。SF3D 與 SPAR3D:Stability 社群授權(年營收低於 100 萬美元可免費使用)。託管服務:依方案條款。僅供研究使用之權重(PartPacker、Lyra、CHORD)不得用於任何出貨產品。商店要求 AI 揭露(polywright 提供參考路由)。

維護

常青單元,層級 fast(模型與授權每月變動)。附屬檔案:RESEARCH.md、 CHANGELOG.md、LEARNINGS.md、TESTS.md(含 evals/evals.json)、 MAINTENANCE.md、狀態存於 evergreen.json。每次使用前讀取 evergreen.json;到期時更新。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

m4bwav/polywright

Start here whenever a task needs a 3D model and no sibling below clearly owns it: a model of a real or imagined thing for a game (Unity, Roblox, Unreal, three.js), a 3D print, AI video or AR, or another plugin asking for a mesh. Picks the route (find, capture, generate, code), scaffolds the asset folder and manifest other plugins read, and runs pw.py (inspect, render a sheet, convert, check a budget, bpy headless, match a picture's camera, army blockouts with depth and pose passes for AI...

m4bwav/polywright-blender

Use whenever Blender is scripted, automated or debugged, before writing any bpy code: headless runs that report errors (pw.py bpy), the bpy API traps models still write in Blender 5.x (removed importers, renamed sockets, EEVEE names), tested recipes (modifiers, booleans, remesh, UVs, bakes, turntables, depth passes, batch exports), Blender MCP servers and their risks, and other 3D tools per OS. Use on 'write a Blender script', 'automate Blender', 'batch export .blend', any bpy traceback or...

m4bwav/polywright-finish

Use whenever a mesh must be made ready for a game engine, the web or AR: is it game-ready, too many polygons, LODs, retopology, UVs, baking, PBR and normal-map conventions, collision, rigging, and axis, unit and format export for Roblox, Unity, Unreal, Godot, three.js (meshopt, KTX2), USDZ and video blockouts. Use on 'is this game-ready', 'make this work in Roblox/Unity', 'optimise for the web', 'reduce polygons', 'add LODs', 'retopologise', 'bake normals', 'imports sideways or tiny', 'flip...

m4bwav/polywright-references

Use whenever reference images, views or textures for a 3D model are needed, before modelling or image-to-3D: orthographic front, side and back views with a height bar, A-pose turnarounds, multi-view sets, blockout renders repainted into consistent views, seamless textures and quick normal/height/roughness maps (pw.py texture). Use on 'what references do I need', 'reference sheet', 'front side back views', 'turnaround', 'seamless texture', 'PBR maps from this photo'. Not for flat graphic...

相關技能