Community编程与开发github.com

资产管线

将生成或手绘的艺术作品转换为游戏引擎可直接加载的格式。涵盖精灵裁剪、修剪与最近邻适配到帧尺寸、像素化到调色板、精灵表与精灵条、玩家/队伍颜色遮罩、无缝纹理以及从游戏模型渲染3D模型为精灵帧。

资产管线 是什么?

这个技能(asset-pipeline)专注于将美术资产(无论是AI生成的还是手工绘制的)转化为游戏引擎能够直接读取的最终文件。它通过一组 `um sprite ...` 和 `um render3d ...` 命令,精确控制输出的尺寸、帧布局、方向、透明度、调色板和格式。对于2D资产,该技能支持裁剪、修剪、缩放、像素化、调色板匹配、精灵表打包和队伍颜色遮罩。对于3D资产,它能够从GLB模型渲染出不同视角和动画(如行走、攻击、死亡)的精灵帧,并支持多种预设(如《帝国时代2》的等距视角或平台游戏的侧面视角)。该技能还涵盖纹理处理(如无缝平铺、PBR转换、DDS格式)、在游戏内的验证,以及通过UnityPy和特定游戏教程(如《泰拉瑞亚》、《我的世界》)处理来自其他游戏的资产的复杂流程。它非常适合模组制作者、独立游戏开发者或任何需要可靠、可重复管线来准备游戏资产的人。

兼容平台~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 技能负责生成图片。本技能负责生成游戏能接受的最终文件:正确的尺寸、帧布局、方向、透明度、调色板和格式。所有命令均为 um sprite ... 和 um render3d ...;每个命令都提供带有示例的 --help。

1. 从游戏本身学习目标格式

在转换任何内容之前,打开游戏自己的两三个资产,并在 MODLOG.md 中记录:

  • 尺寸: 帧大小、每张表上的帧数以及布局(垂直条带/网格/每帧一个文件)。
  • 方向: 美术的朝向(泰拉瑞亚:物品朝右,NPC 面朝左,引擎会翻转它们),以及枢轴点或热点位置(帝国时代2:单位的地面点位于画布中心)。
  • 透明度: 硬1位边缘(BC1 punch-through,像素艺术)或软边缘。
  • 风格: 调色板大小和轮廓(大多数像素艺术游戏中为深色1-2像素轮廓)。
  • 格式: PNG, DDS BC1/BC3/BC7, XNB, SLD, atlas + JSON...

绘制代码是最终权威。在泰拉瑞亚中,NPC 帧高度 = 纹理高度 / Main.npcFrameCount,因此任何一致的帧尺寸都有效。

2. 2D 管线

um sprite info raw.png                                    # 尺寸,阿尔法覆盖率,角落颜色
um sprite cutout raw.png cut.png                          # 纯色背景 → 透明(边界泛洪填充保留内部白色)
ul 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          # 廉价的空闲动画(bob/squash/wobble/flash)
ul sprite sheet sheet.png frames/*.png --vertical         # 泰拉瑞亚风格条带(或 --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             # 棋盘格 + 缩放:在发布前查看它!
  • 像素艺术: 仅缩放一次,使用最近邻插值,到最终尺寸。切勿缩放像素艺术两次。
  • 绘画/高清艺术: 使用 fit --smooth。
  • 真实帧: 对于除bob/squash之外的动画帧,使用基础精灵作为参考(“同一架无人机,旋翼倾斜,第2帧,共4帧”),通过 fal 编辑端点生成每个帧,然后以相同方式裁剪并适配每个帧。或者使用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-up 米单位,Unreal Z-up 厘米单位,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 金属-光滑度(光滑度 = 1 - 粗糙度,在alpha通道中)。
  • DDS: texconv(DirectXTex)或 magick 配合 DXT 设置。BC7 用于质量,BC1 用于裁切精灵,BC3 用于透明是柔和的场景。

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 键将游戏对象映射到预制件,而不是通过猜测名称。如果存在低质量变体,则优先使用(相同网格,更小的纹理)。
  • 蒙皮网格存储在绑定姿势中(通常是 T 姿势)。 对于游戏中的外观,在 t = 0 时自行评估空闲动画剪辑(UnityPy 可以读取 AnimationClip 对象,但不会采样它们;通用剪辑通过路径的 CRC32 绑定 Transform),然后重建世界矩阵,最后蒙皮。
  • 从容器根遍历层次结构,跳过非活动的 GameObject 及其子项,并丢弃辅助网格(眼睑、地面阴影、模板/轮廓材质)。
  • 轴: Unity 是左手系,Minecraft 是右手系:翻转一个轴用于位置和法线,并反转缠绕;翻转 V;钳制 UV。用命名骨骼验证(右手最终在右侧)。
  • 共享图集: 将每个部件的纹理裁剪到其 UV 边界框,并重新映射 UV。
  • 音频: AudioClip.samples 需要 FMOD(fmod_toolkit);使用 ffmpeg 编码为单声道 OGG。
  • Minecraft 方面: 资源包需要 pack.mcmeta(pack_format 15 for 1.20.1);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

相关技能