跳到正文

正在自动登录…

← 返回项目列表

Hugo-Dz/spritefusion-sprite-normals

法线贴图生成

为像素艺术精灵和动画生成法线贴图的工具,支持CLI和WebAssembly库,适用于2D游戏开发中的动态光照效果。

AI 中文解读 · 根据仓库描述与 README 生成 · 2026/10/20 01:41:40 · 查看原文

值得看Rust应用与服务兼有 库与框架
累计 Stars
585
当前热度
1~7 天 · 小火
仓库创建时间
打开 GitHub ↗项目网站 ↗

选用指南

AI 根据 README 整理 · 2026/10/20 01:41:40

适用场景

适用于2D游戏开发中需要动态光照和法线贴图的场景,以及像素艺术动画需要匹配法线贴图帧的情况。

查看 README 依据
- ✅ Generate surface relief from a sprite's silhouette and shading. - ✅ Keep the original pixel resolution and transparency. - ✅ Process sprites, sprite sheets, and animations locally. ## Perfect for - **2D games** with moving lights and normal-mapped sprites. - **Pixel art animations** that need matching normal-map frames. - **Asset pipelines** using a native CLI or browser-based processing. ## 💻 CLI ### Build from source Requires [Rust](https://www.rust-lang.org/) 1.85 or newer. From this directory: ```bash cargo build --release --locked ```
使用方式

可通过命令行工具使用,支持PNG、GIF、APNG输入,也可作为WebAssembly库集成到网页应用中。

查看 README 依据
The binary is available at `target/release/spritefusion-sprite-normals`. To install it locally: ```bash cargo install --path . --locked ``` ### Usage ```text spritefusion-sprite-normals <INPUT>... [OPTIONS] ``` - `<INPUT>`: PNG sprites or sheets, GIF, or APNG files. - `-o <OUTPUT>`: Output normal PNG for one input. - `--output-dir <DIR>`: Output directory for a batch. - `--normal-strength <VALUE>`: Overall strength. Defaults to `1.5`. - `--detail-strength <VALUE>`: Relief from painted shading. Defaults to `6`. - `--detail-scale <PIXELS>`: Shading smoothing. Defaults to `0.6`.
cargo build --release --target wasm32-unknown-unknown --no-default-features --locked wasm-bindgen target/wasm32-unknown-unknown/release/spritefusion_sprite_normals.wasm --target web --out-dir pkg ``` Use the generated package in your project: ```js import init, { generate_normal_map } from "./pkg/spritefusion_sprite_normals.js"; await init(); const result = generate_normal_map(inputBytes, JSON.stringify({ strength: 1.5 })); try { const normalPng = result.normal_png; const colorPng = result.color_png; const metadata = JSON.parse(result.metadata);
部署要求

构建CLI需要Rust 1.85或更高版本;WebAssembly构建需要wasm32-unknown-unknown目标及wasm-bindgen CLI 0.2.126。

查看 README 依据
- ✅ Generate surface relief from a sprite's silhouette and shading. - ✅ Keep the original pixel resolution and transparency. - ✅ Process sprites, sprite sheets, and animations locally. ## Perfect for - **2D games** with moving lights and normal-mapped sprites. - **Pixel art animations** that need matching normal-map frames. - **Asset pipelines** using a native CLI or browser-based processing. ## 💻 CLI ### Build from source Requires [Rust](https://www.rust-lang.org/) 1.85 or newer. From this directory: ```bash cargo build --release --locked ```
Frames are arranged in row-major order. `delays_ms` contains `[numerator, denominator]` pairs in milliseconds. PNG sheets keep their layout and receive a default 100 ms frame delay. Source loop counts are not exported. Normal PNGs are data textures: disable sRGB sampling in your engine. Use artwork at its native pixel resolution. Generation estimates relief from color and shape; painted highlights can also become surface detail. ## 🌐 Web (WASM) Build with the `wasm32-unknown-unknown` Rust target and [wasm-bindgen](https://wasm-bindgen.github.io/wasm-bindgen/) CLI `0.2.126`: ```bash
已知限制

输入文件限制为64 MiB和4,194,304像素(含处理填充),动画输入额外限制最多256帧和4,194,304总解码像素;源循环次数不导出。

查看 README 依据
// Use these bytes to save files or create image URLs. } finally { result.free(); } ``` Pass a `Uint8Array` and `"{}"` for default settings. Optional keys are `strength`, `detail`, `smoothing`, `volume`, `frame_width`, `frame_height`, and `directx`. Returned arrays own their bytes and remain valid after `free()`. The CLI and WASM module use the same generator and animation decoder. Inputs are limited to 64 MiB and 4,194,304 pixels including processing padding; animated inputs additionally allow up to 256 frames and 4,194,304 total decoded pixels. ## Development ```bash
Frames are arranged in row-major order. `delays_ms` contains `[numerator, denominator]` pairs in milliseconds. PNG sheets keep their layout and receive a default 100 ms frame delay. Source loop counts are not exported. Normal PNGs are data textures: disable sRGB sampling in your engine. Use artwork at its native pixel resolution. Generation estimates relief from color and shape; painted highlights can also become surface detail. ## 🌐 Web (WASM) Build with the `wasm32-unknown-unknown` Rust target and [wasm-bindgen](https://wasm-bindgen.github.io/wasm-bindgen/) CLI `0.2.126`: ```bash

README

正在加载 README…

收录信息

仓库创建时间
2026/10/19 21:26:45
首次达标收录
2026/10/20 01:36:51
统计更新时间
2026/10/22 19:00:56

按创建时长与累计 Stars 判断等级。首次达标收录后,即使未达当前门槛仍保留;累计 Stars 和仓库状态会定期更新。确认只有 README 及辅助文件的仓库会停止公开。

模型评估

值得看加权总分 4.0 / 5

新颖度
3.0
实用价值
4.6
成熟度
4.7
实质含量
3.8

由 Jev 模型根据仓库描述与 README 评估,2026/10/20 01:36:51 生成。评分仅供参考,不是代码、安全或许可证审查;热度等级另按创建时长与累计 Stars 计算。

仓库信息

最近推送
2026/10/20 18:31:00
许可证标识
MIT
Fork 数
42
当前状态
未归档

收录记录

按创建时长与累计 Stars 首次收录:小火
首次发现项目