# 🦀 SpriteStudio Player for wgpu

Play **[SpriteStudio](<https://www.webtech.co.jp/eng/spritestudio/>)** animations (`.ssab`) through [wgpu](<https://wgpu.rs/>) — one renderer, one set of shaders, and four ways to call it. Your artist rigs the motion in a dedicated editor; you load the file and press play. No video files, no re-authoring, no engine lock-in.

wgpu puts **WebGPU, Vulkan, DirectX 12 and Metal** behind a single API, which is why a browser canvas, a Windows game and a macOS app can all be served by the same library instead of by four ports of it.

> [!TIP]
>
> **Try it in your browser**
>
> [▶️ Open the WebGPU demo](<https://cri-middleware.github.io/SSPlayerForWgpu/demo/index.md>), published beside these pages. Nothing to install; it needs a WebGPU-capable browser. Drop a folder of your own `.ssab` on its first page and it plays them, atlases and sibling packs included.

> [!TIP]
>
> **No SpriteStudio data of your own yet?**
>
> The [official sample data](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/>) works as-is — that page is Japanese only, but the downloads themselves are language-neutral. [Ringo](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/#ringo>) is a good character sample, and [Particle](<https://www.webtech.co.jp/help/ja/spritestudio7/download/sample/#Perticle_sample>) is a good one if you want effects. To make your own, you use SpriteStudio itself — see [its site](<https://www.webtech.co.jp/eng/spritestudio/>).

## 🚀 Start here

Four ways to call one library. Pick the one your app is written in — each path is complete on its own, and you never need the other three.

- **Rust**

  ---

  You own a `wgpu::Device` and a render pass — your own renderer, `winit`, `egui`, `Slint`. The player draws into the pass you opened.

  [Get started with Rust](<https://cri-middleware.github.io/SSPlayerForWgpu/start/rust/index.md>)
- **Bevy**

  ---

  Add a plugin, spawn three components. Characters go into Bevy's own 2D pass, on the device Bevy already owns. You never touch wgpu.

  [Get started with Bevy](<https://cri-middleware.github.io/SSPlayerForWgpu/start/bevy/index.md>)
- **C / C++**

  ---

  A static library and one header. Hand it your `HWND`, `CAMetalLayer`, `Window` or `wl_surface` and call two functions per frame — DX12, Metal or Vulkan underneath. **No wgpu type ever crosses the ABI.**

  [Get started with C / C++](<https://cri-middleware.github.io/SSPlayerForWgpu/start/cpp/index.md>)
- **JavaScript / TypeScript**

  ---

  An npm package with the WebGPU renderer compiled to WebAssembly, plus a `<ss-player-webgpu>` element for the one-character case. The device is built for you.

  [Get started on the web](<https://cri-middleware.github.io/SSPlayerForWgpu/start/web/index.md>)

Whichever you pick, you also need a `.ssab` — see [Preparing assets](<https://cri-middleware.github.io/SSPlayerForWgpu/start/assets/index.md>). Nothing of your own is required to try the player first: every sample runs on the SDK's own test animations.

## ✨ What it does

- **Blend animations instead of cutting.** A walk underneath, an aim overlay on top, a one-shot reaction crossfading in: several animations on one character at once ([Motion blending](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/motion-blending/index.md>)).
- **Hooks into your game logic.** The markers the animator put on the timeline — user data, signals, sound — reach you as the playhead crosses them ([Events and user data](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/events/index.md>)).
- **Change a character at runtime, without re-exporting.** Hide a part, swap its cell, tint it, or ask where it is to hang a health bar off a bone ([Part overrides](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/part-overrides/index.md>)); swap a whole atlas for a costume or a palette ([Texture replacement](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/texture-replacement/index.md>)).
- **A crowd for close to one character's CPU cost.** One character drawn at many placements shares one playhead, one evaluation and one upload of its geometry ([Crowds](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/crowds/index.md>)).
- **In a game world or in a box.** Characters draw at the size the artist made them, or fit a panel, a card or a preview pane your layout decided ([Fitting into a box](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/placement/index.md>)). Masks clip through a stencil, or without one where the pass has none, as in Bevy ([Masks](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/masks/index.md>)).

## 🧭 How these docs are laid out

| Section | Who reads it |
| --- | --- |
| **[Get started](<https://cri-middleware.github.io/SSPlayerForWgpu/start/rust/index.md>)** | Everyone, **once**. Four short paths, one per environment; each is complete on its own — install, load, play, frame loop. This is the only place you choose. |
| **[Guide](<https://cri-middleware.github.io/SSPlayerForWgpu/guide/concepts/index.md>)** | Everyone, from then on. One text with the code in per-language tabs: pick your language on any page and the whole site follows. |
| **[API reference](<https://cri-middleware.github.io/SSPlayerForWgpu/reference/rust/index.md>)** | When you need the exact name of something. One page per face. |
| **[wgpu hosts](<https://cri-middleware.github.io/SSPlayerForWgpu/wgpu/borrow-model/index.md>)** | Only if you own the device — a Rust application or an engine adapter. A C++ or browser reader never needs this section. |
| **[For Player & SDK Developers](<https://cri-middleware.github.io/SSPlayerForWgpu/development/build/index.md>)** | Building every face of the library yourself, using a changed Player in a host, and how the player is put together. |

Two more things are published beside this text rather than inside it: the [Rust API reference](<https://cri-middleware.github.io/SSPlayerForWgpu/api/index.md>) (rustdoc for `ssplayer_wgpu` and `ssplayer_bevy`) and the [WebGPU demo](<https://cri-middleware.github.io/SSPlayerForWgpu/demo/index.md>). Both are in the navigation as well: the rustdoc under API reference, the demo under Get started.

## 🗺️ From editor to screen

```
flowchart LR
    sspj[".sspj<br/>+ PNG / WebP"] -->|ssconverter| ssab[".ssab"]
    ssab --> lib

    lib["ssplayer-wgpu<br/>SSRenderer / SSScene / SSPlayer"]

    lib -->|Rust| rust["Your wgpu app"]
    lib -->|Rust adapter| bevy["Bevy"]
    lib -->|C ABI| cpp["C / C++<br/>DX12 · Metal · Vulkan"]
    lib -->|wasm-bindgen| web["Browser<br/>WebGPU"]
```

Conversion happens **ahead of time**: this player converts nothing at runtime and bundles no converter. See [Preparing assets](<https://cri-middleware.github.io/SSPlayerForWgpu/start/assets/index.md>).

## 🔗 Related

- [SpriteStudio Docs](<https://cri-middleware.github.io/SpriteStudio-Docs/>) — the portal for the SDK and every official player.
- [SpriteStudio-SDK](<https://github.com/cri-middleware/SpriteStudio-SDK>) — `ssruntime` and `ssab`, the shared core this player links directly.
- [SpriteStudio Player for Web](<https://github.com/cri-middleware/SSPlayerForWeb>) — the WebGL player, the answer where WebGPU is missing.
- [SSConverterGUI](<https://github.com/cri-middleware/SSConverterGUI>) — desktop converter.
