Community程式設計與開發github.com

asset-pipeline

將人工或自動生成的美術資源,轉換為遊戲引擎可直接載入的格式。涵蓋圖片裁切、修剪、最近鄰縮放至幀尺寸、調色盤像素化、精靈圖表與條帶、玩家/隊伍色彩遮罩、無縫紋理,以及將 3D 模型渲染為遊戲使用的精靈幀。

asset-pipeline 是什麼?

此技能「asset-pipeline」專為遊戲開發者與模組製作者設計,提供一套完整的 CLI 工具(以 `um sprite ...` 和 `um render3d ...` 為命令主體),能將原始美術資源(2D 圖片或 3D 模型)轉換為遊戲引擎可直接載入的檔案。它不僅支援基本的精靈裁切、修剪與縮放,還包含進階功能如像素化、調色盤匹配、動畫幀生成、精靈圖表製作、玩家/隊伍色彩遮罩、無縫紋理處理,以及將 3D 模型渲染成 2D 精靈幀(支援多種遊戲類型如 AoE2、平台遊戲、等距視角等)。此技能適用於所有需要處理遊戲資源的開發環境,只要在 PATH 中包含 Blender 即可使用 3D 渲染功能。其核心優勢在於提供可重現的資源管線(透過腳本或 Makefile),從分析原始遊戲資源格式開始,到最終在遊戲中驗證成果,每個步驟都有對應的 CLI 命令與詳細的 `--help` 文件。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/rehan-remade/universal-modder/tree/main/skills/asset-pipeline

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

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

說明文件

資源管線:從美術到引擎可接受的檔案

fal-assets 這個技能負責生成圖片。而這個技能負責製作遊戲能接受的檔案:正確的尺寸、幀佈局、方向、Alpha、調色盤和格式。所有命令都以 um sprite ... 和 um render3d ... 為前綴;每個命令都有 --help 並附帶範例。

1. 從遊戲本身學習目標格式

在開始轉換之前,先打開兩三個遊戲自己的資源,並在 MODLOG.md 中記錄以下資訊:

  • 尺寸: 幀尺寸、每張圖表的幀數、以及佈局(垂直條帶 / 網格 / 每個幀一個檔案)。
  • 方向: 美術資源的面向(Terraria:物品朝右,NPC 朝左,引擎會自動翻轉它們),以及樞紐或熱點的位置(AoE2:單位的接地點在畫布中央)。
  • Alpha: 硬 1-bit 邊緣(BC1 punch-through、像素藝術)或柔和邊緣。
  • 風格: 調色盤大小和輪廓(多數像素藝術遊戲使用 1-2px 的深色輪廓)。
  • 格式: PNG、DDS BC1/BC3/BC7、XNB、SLD、atlas + JSON……

繪圖程式碼是最終的權威。在 Terraria 中,NPC 的幀高度 = 紋理高度 / Main.npcFrameCount,因此任何一致的幀尺寸都能運作。

2. 2D 資源管線

um sprite info raw.png                                    # 尺寸、Alpha 覆蓋率、角落顏色
um sprite cutout raw.png cut.png                          # 平面背景 → 透明(邊界洪水填充保留內部白色區域)
um sprite cutout raw.png cut.png --grey 150 --keep-top 0.8   # 同時移除柔和的灰色陰影 / 底層地面
um sprite fit cut.png item.png --size 64x26 --hard-alpha  # 修剪 + 一次性最近鄰縮放到幀尺寸
um sprite fit cut.png npc.png --size 38x34 --anchor bottom   # 站立精靈位於幀的底部邊緣
um sprite pixelate cut.png px.png --size 32x32 --colors 16 --outline   # 從繪畫風格藝術產生真正的像素藝術
um sprite palette px.png px2.png --from stock_sprite.png  # 對齊到遊戲自己的顏色
um sprite frames npc.png frames/ --n 3 --kind bob         # 便宜的閒置動畫(上下擺動/擠壓/搖晃/閃爍)
um sprite sheet sheet.png frames/*.png --vertical         # Terraria 風格條帶(或 --cols N 網格)
um sprite slice sheet.png out/ --frame 32x32              # 反向操作
um sprite team-mask unit.png unit_grey.png --hue blue     # 玩家色彩遮罩(+ 去飽和精靈)
um sprite preview item.png look.png --scale 6            # 棋盤格 + 縮放:在輸出前檢查它!
  • 像素藝術: 只縮放一次,使用最近鄰縮放,到最終尺寸。切勿對像素藝術進行兩次縮放。
  • 繪畫 / HD 藝術: 使用 fit --smooth。
  • 真實幀: 對於超出 bob/squash 的動畫幀,使用 fal edit 端點以基礎精靈為參考(「同一架無人機,旋翼傾斜,第 2 幀,共 4 幀」)生成每個幀,然後以相同方式裁切和適配每個幀。或者使用 3D(見下方)。

3. 3D → 精靈(一致的角度和動畫)

um fal model3d concept.png --name unit                   # 紋理化 GLB(預設使用 Trellis 2)
um render3d assets/gen/unit.glb frames/ --preset aoe2 --length 80 --forward-yaw -90 \
  --anims idle:10:bob,walk:12:walk,attack:16:lunge,death:20:die --shadows --samples 40
um render3d assets/gen/unit.glb side/ --preset side --canvas 128 --length 110 --engine eevee   # 平台遊戲面向右 + 左

預設:

預設投影攝影機面向數
aoe2正交30°16(從東方順時針)
iso8正交30°8
trueiso正交35.264°8
topdown正交—8
side正交—2(右、左)
turntable透視—24(宣傳/圖標旋轉)
  • --length 設定模型在 1x 縮放下最長水平邊的像素數,因此要匹配原始資源的尺寸。
  • --forward-yaw 旋轉模型使其鼻頭朝向 +X 軸;請檢查第一幀。
  • --shadows 添加一個僅陰影的渲染通道(*_s.png),適用於將陰影保留在獨立圖層的引擎。
  • 動作:bob、walk、lunge、die、wreck、spin。
  • 然後使用 um sprite sheet 或引擎專用腳本(例如 examples/aoe2-de-civ/sld.py)進行打包。
  • 需要 Blender(blender 在 PATH 中,或設定 BLENDER=...)。Cycles 渲染器會盡可能使用 GPU。
  • 紋理太暗:提高 --sun / --ambient 參數,或在後製中調亮。
  • 對於直接可用的遊戲 3D 模型(非精靈),使用 um fal run tripo3d/tripo/remesh [email protected] face_limit:=8000 重新網格化,然後在 Blender 中轉換(GLB → FBX/OBJ),並使用引擎的縮放和軸慣例:Unity Y 軸向上,單位為公尺;Unreal Z 軸向上,單位為公分;Bethesda NIF 則使用 PyNifly。

4. 紋理與材質

  • 無縫拼接: um fal texture 生成時已是無縫拼接。使用 um sprite tile-preview t.png t3.png 檢查。使用 um sprite seamless 修復其他圖片的接縫。
  • PBR 組合: um fal pbr。轉換為引擎的打包方式:Unreal ORM(遮擋/粗糙度/金屬度分別在 RGB 通道),Unity metallic-smoothness(平滑度 = 1 - 粗糙度,位於 Alpha 通道)。
  • DDS: 使用 texconv(DirectXTex)或 magick 搭配 DXT 設定。BC7 用於高品質,BC1 用於裁切精靈,BC3 用於需要柔和 Alpha 的場合。

5. 在遊戲中驗證

將一個轉換後的資源放入遊戲,並與原始資源並排截圖(um win shot)。檢查比例、面向、樞紐、輪廓和調色盤。修正配方,然後使用相同的命令批次轉換其餘資源(使用一個小腳本或 Makefile,這樣資源管線就能從 assets/gen/ 可重複執行)。

6. 轉換客用遊戲的 Unity 資源(混搭)

使用 UnityPy 讀取使用者自己的安裝,並寫入一個本地、私有的資源包。切勿將輸出放入模組、其儲存庫或發行版中;每位使用者應在自己的副本上執行轉換器。

  • 記憶體: UnityPy.load() 會解壓整個 bundle(一個 865 MB 的 bundle 可能會變成 8.7 GB 的 RAM)。只解壓序列化檔案,並延遲、逐塊讀取 .resS / .resource 檔案;每個轉換模組應在自己的行程中執行。
  • 環境: UnityPy.Environment(path=""),並同時載入相互參照的 bundle;否則 UnityPy 會在工作目錄中搜尋遺失的依賴項。
  • 尋找資源: Addressables bundle 名稱會根據更新進行雜湊(透過前綴尋找);Addressables 2.x 有一個二進位 catalog.bin。透過 GUID 鍵將遊戲物件對應到 prefab,而不是猜測名稱。如果存在低品質變體,優先使用它(相同網格,較小紋理)。
  • 蒙皮網格以綁定姿勢儲存(通常為 T 姿勢)。 為了取得遊戲中的外觀,請自己評估時間點 t=0 的 idle 片段(UnityPy 可以讀取 AnimationClip 物件,但不會對其進行取樣;Generic 片段透過路徑的 CRC32 綁定 Transform),重建世界矩陣,然後進行蒙皮。
  • 從容器根節點走訪階層結構,跳過非活躍的 GameObject 及其子物件,並移除輔助網格(眼瞼、地面陰影、模板/輪廓材質)。
  • 軸向: Unity 是左手座標系,Minecraft 是右手座標系:翻轉一個軸(位置和法線),反轉繞線方向;翻轉 V 方向;限制 UV 範圍。使用一個命名的骨骼進行驗證(右手最終應在右側)。
  • 共享圖集: 將每個部分的紋理裁切到其 UV 邊界框,並重新映射 UV。
  • 音頻: AudioClip.samples 需要 FMOD(fmod_toolkit);使用 ffmpeg 編碼為單聲道 OGG。
  • Minecraft 部分: 資源包需要 pack.mcmeta(1.20.1 的 pack_format 為 15);ResourceLocation 只接受 [a-z0-9_./-] 字元。對於姿勢網格,使用 RenderType.entityCutoutNoCull 繪製的自訂網格檔案比 forge:obj(會用到方塊圖集紋理、usemtl)更穩健。
  • Oracle: 透過重新讀取您寫入的檔案來渲染預覽表,並仔細檢查它們。

Individual skills in this repo

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

fal-assets

Generate game assets with fal (fal.ai) through the fal MCP server, the `um fal` CLI (REST) or `fal api`. Covers sprites and icons with transparent backgrounds, consistent variants and animation frames, pixel art, seamless textures, PBR material maps, image-to-3D models, remeshing, auto-rigging, sound effects, music, voice lines, and trailer or cutscene video. Use whenever a mod needs new art, audio or 3D models, or the user mentions fal, generating sprites, textures, models, SFX or music for a game.

game-automation

Launch, see and drive a real game so an agent can test its own mods. Covers launching via Steam or the exe, windowed mode at a fixed size, screenshots of the game window (GPU-safe capture), clicking and typing into menus, holding keys, relative mouse, crash-reporter cleanup, killing by PID, reading logs, scripted test scenes, and an in-game JSON bridge that lets an agent observe and act. Windows-first (also from WSL), with notes for Linux and macOS. Use when a mod must be verified in game, when navigating menus automatically, or when building a repeatable test or demo scene.

game-recon

Figure out how a specific installed game can be modded, before writing any mod code. Covers where it

game-research-websearch

Research a game, engine or modding technique on the open web with archive-aware, rate-limit-safe searches — Wayback Machine/archive.today for dead forums (XeNTaX, Zenhax, old threads), GitHub code/repo search, Nexus/Steam Workshop/Thunderstore APIs, Reddit JSON, YouTube transcripts, plus archive snapshots as evidence. Use when starting work on a game (

mashup-mods

Build cross-game mashups and total conversions, the

mod-any-game

Mod a PC game the user owns, taking an idea to working in the real game and recorded. It covers new items, weapons, enemies, bosses, units, civilizations, mechanics, art, sound, VR and cross-game mashups. Use when the user wants to mod, extend, hack on, reverse engineer or mash up a game (

port-a-mod

Port an existing mod to a newer game version or another mod loader while keeping its behaviour, values and quirks. Typical cases are an old Forge 1.7.10 or 1.12 Minecraft mod moving to modern Fabric or NeoForge, a Skyrim LE plugin moving to SE/AE, or a tModLoader 1.3 mod moving to 1.4. It covers pinning one source version, a private decompiled reference, an adaptation matrix, extracting the mod

publish-mod

Package and release a finished game mod. Covers the pre-release lint (no game files, decompiled code or leaked keys), README and install steps, credits and AI disclosure, versioning, where to upload (Nexus Mods, Steam Workshop, Thunderstore, mod.io, GitHub releases), and the post with a video. Use when the user wants to ship, share, upload, release or post a mod.

reverse-engineering

Read how a game actually works so a mod can hook it. Decompile .NET/Mono (ILSpy), IL2CPP (Cpp2IL, Il2CppDumper), Java (Vineflower) and native code (Ghidra, IDA, via MCP servers); dump data and asset formats; reverse-engineer a binary file format and prove it with a round trip; read live memory (Cheat Engine, Frida, x64dbg); find render passes (RenderDoc). Use when a mod needs game internals, e.g.

share-field-notes

Search and contribute to the shared AI-modding knowledge base, where field notes record how specific games were modded, decompiled or reverse-engineered (exact versions, route, engine facts, verification, gotchas). Use before starting work on a game (

showcase-video

Record and cut a short showcase video of a game mod, or a compilation of clips, ready to post on X/YouTube. Records the game window with only the game

相關技能