A plugin to use the kajiya renderer with bevy

Overview

πŸ•ŠοΈ πŸ’‘ bevy-kajiya

A plugin that enables use of the kajiya renderer in bevy

WARNING: This plugin is barebones and supports a limited set of features. Please go read more about kajiya for context. It is an experiment in Rust rendering, not intended to be a fully featured renderer.

Yes, you can visualize some bevy entities in ray-traced glory, but don't expect much else for now; there is a finite number of meshes that can be instanced and meshes cannot be uninstanced yet. Expect some bugs and crashes!

Example

See bevy-kajiya-playground for basic usage of bevy and bevy-kajiya in a bevy app. You can fly around a simple scene with moving meshes in first person, manipulate the sun, and view a reflection of your player model in a mirror.

Usage

You must disable the default bevy renderer. Additionally, a patch is required for ray-tracing extensions. Put the following in your top-level Cargo.toml:

[dependencies]
bevy = { version = "0.6.0", default-features = false, features = ["bevy_winit"] }
bevy-kajiya = { path = "../path/to/bevy-kajiya" }

[patch.crates-io]
# Official ray-tracing extensions
rspirv = { git = "https://github.com/gfx-rs/rspirv.git", rev = "dae552c" }
spirv_headers = { git = "https://github.com/gfx-rs/rspirv.git", rev = "dae552c" }

kajiya does not support resizable windows yet. The window might be larger than anticipated due to the OS' DPI settings, so you may have to decrease the requested resolution. Make sure to use these window settings:

    .insert_resource(WindowDescriptor {
        width: 1920.,
        height: 1080.,
        vsync: false,
        resizable: false,
        ..Default::default()
    })

Add these plugins:

    .add_plugins(DefaultPlugins)
    .add_plugins(BevyKajiyaPlugins)

Scenes

You specify the scene to be loaded on startup with the KajiyaSceneDescriptor resource inserted in App::new(). The scene as specified by "my-scene" should be located in assets/scenes/my-scene.ron

    .insert_resource(KajiyaSceneDescriptor {
        scene_name: "my_scene".to_string(),
        ..Default::default()
    })

Scene Format Example

The renderer looks for all meshes in assets/meshes/. In this example, the mesh files should be located in assets/meshes/336_lrm/ and assets/meshes/floor/

(
    instances: [
        (
            position: (0, -0.001, 0),
            mesh: "336_lrm",
        ),
        (
            position: (0, 0, 0),
            mesh: "floor",
        ),
    ]
)

Meshes

You must run bake.cmd any time mesh assets have been modified (or if first time building). Adding new meshes requires adding a line in bake.cmd:

%BAKE% --scene "assets/meshes/my_mesh/scene.gltf" --scale 1.0 -o my_mesh

Then you can spawn the mesh with:

    commands.spawn_bundle(KajiyaMeshInstanceBundle {
        mesh_instance: KajiyaMeshInstance { 
            mesh: KajiyaMesh::User("my_mesh".to_string()),
        },
        transform: Transform::from_translation(Vec3::new(0.0, 0.0, 0.0)),
        ..Default::default()
    });

Camera

You must spawn exactly one camera. Put this in your setup system:

    commands.spawn_bundle(KajiyaCameraBundle {
        camera: KajiyaCamera {
            aspect_ratio: window.requested_width() / window.requested_height(),
            ..Default::default()
        },
        ..Default::default()
    })
You might also like...
Renderer-agnostic toolkit for Indie Game Developers

Indie Toolkit Renderer-agnostic toolkit for Indie Game Developers Features Not yet implemented: app_kit debug_kit input_kit asset_kit audio_kit Implem

A Bevy plugin for loading the LDtk 2D tile map format.
A Bevy plugin for loading the LDtk 2D tile map format.

bevy_ldtk ( Tileset from "Cavernas" by Adam Saltsman ) A Bevy plugin for loading LDtk tile maps. Usage use bevy::prelude::*; use bevy_ldtk::*; fn mai

Inspector plugin for the bevy game engine
Inspector plugin for the bevy game engine

bevy-inspector-egui This crate provides the ability to annotate structs with a #[derive(Inspectable)], which opens a debug interface using egui where

A plugin for Egui integration into Bevy
A plugin for Egui integration into Bevy

bevy_egui This crate provides a Egui integration for the Bevy game engine. Features: Desktop and web (bevy_webgl2) platforms support Clipboard (web su

Crossterm plugin for the bevy game engine
Crossterm plugin for the bevy game engine

What is bevy_crossterm? bevy_crossterm is a Bevy plugin that uses crossterm as a renderer. It provides custom components and events which allow users

A prototype plugin providing a simple line drawing api for bevy.
A prototype plugin providing a simple line drawing api for bevy.

bevy_debug_lines A prototype plugin providing a simple line drawing api for bevy. See docs.rs for documentation. Expect breakage on master. Click on t

Bevy plugin helping with asset loading and organisation

Bevy asset loader This Bevy plugin reduces boilerplate when loading game assets. The crate offers the AssetCollection trait and can automatically load

A sprite-sheet animation plugin for bevy
A sprite-sheet animation plugin for bevy

Benimator A sprite sheet animation plugin for bevy Features A SpriteSheetAnimation component to automatically update the indices of the TextureAtlasSp

A Bevy Engine plugin for making 2D paths, smooth animations with Bezier curves
A Bevy Engine plugin for making 2D paths, smooth animations with Bezier curves

bevy_pen_tool A Bevy Engine plugin for making 2D paths and smooth animations with Bezier curves TODO: Mesh-making functionality for building 2D shapes

Releases(v0.3.0)
Owner
Sebastian Hamel
CubeSat flight software engineer
Sebastian Hamel
Pixel-Perfect, 2D Renderer for Bevy that Seamlessly Targets Desktop and Web

bevy_retro ( Screenshot of Bounty Bros. game made with Bevy Retro and Skip'n Go ) Bevy Retro is a 2D, pixel-perfect renderer for Bevy that can target

Katharos Technology 224 Dec 23, 2022
Sdf 2d shape renderer for Bevy

bevy_smud Sdf 2d shape rendering for Bevy. Bevy smud is a way to conveniently construct and render sdf shapes with Bevy. Given a shape function/expres

Johan Klokkhammer Helsing 85 Jan 2, 2023
Bevy Simple Portals is a Bevy game engine plugin aimed to create portals.

Portals for Bevy Bevy Simple Portals is a Bevy game engine plugin aimed to create portals. Those portals are (for now) purely visual and can be used t

Sélène Amanita 11 May 28, 2023
A high-performance renderer to render glTF models that use the `KHR_materials_transmission` and `KHR_materials_volume` extensions.

This is a high-performance renderer designed among other things to render glTF models that use the KHR_materials_transmission and KHR_materials_volume

Ashley 21 Dec 5, 2022
A Bevy plugin to use Kira for game audio

Bevy Kira audio This bevy plugin is intended to try integrating Kira into Bevy. The end goal would be to replace or update bevy_audio, if Kira turns o

Niklas Eicker 172 Jan 5, 2023
Bevy plugin for an AssetServer that can load embedded resources, or use other AssetServers based on the path.

Bevy-Embasset Embed your asset folder inside your binary. bevy-embasset adds support for loading assets embedded into the binary. Furthermore, it can

Johnny Tidemand Vestergaard 9 Aug 4, 2022
Random utility stuff for bevy for my personal use. You're welcome to use it, too, if you like.

bevy_cleancut Random utility stuff for bevy for my personal use. You're welcome to use it, too, if you like. Stuff It's all in the prelude: use bevy_c

Nathan Stocks 3 Aug 15, 2024
Rust-based replacement for the default Minecraft renderer

wgpu-mc ?? A blazing fast alternative renderer for Minecraft Intro WebGPU is a new web specification designed to provide modern graphics and compute c

Birb 1 Jun 28, 2022
Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering.

Provok Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering. Input Provok is fed with a JSON

Ossama Hjaji 67 Dec 10, 2022
πŸ¦…πŸ¦ Fast, simple 2D text renderer for wgpu

?? glyphon ?? Fast, simple 2D text rendering for wgpu What is this? This crate provides a simple way to render 2D text with wgpu by: rasterizing glyph

Josh Groves 60 Nov 5, 2022