20 breaking releases
Uses new Rust 2024
| 0.21.0 | Nov 25, 2025 |
|---|---|
| 0.20.0 | Jun 9, 2025 |
| 0.19.0 | Apr 3, 2025 |
| 0.18.0 | Mar 6, 2025 |
| 0.2.0 | Nov 22, 2023 |
#1127 in Graphics APIs
1.5MB
30K
SLoC
xc3_wgpu
A Xenoblade Chronicles model rendering library.
Getting Started
The first step is to initialize an [Renderer]. This only needs to be done once since the renderer can be updated using methods as screen size and parameters change. The initial size should match the current window dimensions.
Models and maps are all loaded from the same [xc3_model] types. The shader database is optional but will improve rendering accuracy.
In each frame, render the [ModelGroup] using Renderer::render_models.
use xc3_wgpu::{MonolibShaderTextures, Renderer};
use xc3_model::shader_database::ShaderDatabase;
let monolib_shader = MonolibShaderTextures::from_file(&device, &queue, "monolib/shader");
let renderer = Renderer::new(&device, &queue, 1920, 1080, wgpu::TextureFormat::Bgra8Unorm, &monolib_shader);
let database = ShaderDatabase::from_file("xc3.bin")?;
let root = xc3_model::load_model("ch01011013.wimdo", Some(&database))?;
let groups = xc3_wgpu::load_model(&device, &queue, &[root], &monolib_shader);
let roots = xc3_model::load_map("ma59a.wismhd", Some(&database))?;
let groups = xc3_wgpu::load_map(&device, &queue, &roots, &monolib_shader);
Animation
Skeletal animations should use ModelGroup::update_bone_transforms and the Animation type from [xc3_model].
xc3_wgpu
A model and map rendering library using xc3_model and wgpu.
xc3_wgpu is designed to be simple and easy to debug rather than having perfect in game accuracy. The renderer is built to match Xenoblade 3 but works with all supported games due to conversions built into xc3_model to handle differences in materials and shader outputs. Unique shaders are generated for each model at runtime to recreate the assignments and layering for G-Buffer textures. This makes comparing models in debuggers like RenderDoc between xc3_wgpu and an emulator much easier. Deferred lighting and post processing is currently very basic since the focus is on improving accuracy of model texture assignments and layering that also benefits tools like xc3_gltf or xenoblade_blender.
Dependencies
~51MB
~773K SLoC