bevy-hikari is an implementation of voxel cone tracing global illumination with anisotropic mip-mapping in Bevy

Overview

Bevy Voxel Cone Tracing

crates.io docs.rs

bevy-hikari is an implementation of voxel cone tracing global illumination with anisotropic mip-mapping in Bevy.

Bevy Version Support

bevy bevy-hikari
0.6 0.1

Limitations and Todo

The implementation is very basic and have, but not limited to, the following limitations:

  • Only directional light is supported
  • Only support 256x256x256 voxel grid

Todo:

  • Fix flickering
  • Voxel HDR support
  • Use memory-efficient voxel structures
  • Correct glossy reflection

Examples

Two examples are included: one minimal example, one in which can move around and adjust light directions.

You can download and test the compiled examples here.

Effects

No GI:

Has GI:

License

Just like Bevy, all code in this repository is dual-licensed under either:

at your option.

Comments
  • Bevy 0.7

    Bevy 0.7

    Updated to Bevy 0.7. Here are PRs which I used as a reference for update:

    • https://github.com/bevyengine/bevy/pull/3959
    • https://github.com/bevyengine/bevy/pull/3979
    • https://github.com/bevyengine/bevy/pull/4181
    • https://github.com/bevyengine/bevy/pull/3989

    But it's a draft since I faced the upstream issue: https://github.com/bevyengine/bevy/issues/4507 To make it work I need MaterialPipelineKey to have public fields as it was before (before it was a simple tuple). Should be fixed with https://github.com/bevyengine/bevy/pull/4508

    opened by Shatur 4
  • Function 'retreive_surface' is invalid

    Function 'retreive_surface' is invalid

    Windows 10 64bit, nVidia GTX 3080Ti, Vulkan

    Running the city example results in:

    2022-10-25T23:52:46.783547Z ERROR bevy_render::render_resource::pipeline_cache: failed to process shader: 
    error: Function [57] 'retreive_surface' is invalid
         ┌─ wgsl:1172:2
         │  
    1172 │   }
         │ ╭─^
    1173 │ │ 
    1174 │ │ fn retreive_surface(material_index: u32, uv: vec2<f32>) -> Surface {
    1175 │ │     var surface: Surface;
         · │
    1181 │ │         surface.base_color *= textureSampleLevel(textures[id], samplers[id], uv, 0.0);
         │ │                                                  ^^^^^^^^^^^^ naga::Expression [64]
         · │
    1205 │ │     return surface;
    1206 │ │ }
         │ ╰─^ naga::Function [57]
         │  
         = Expression [64] is invalid
         = Shader requires capability SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING
    

    Full console output: full.log

    None of the examples work, I guess because of the above.

    opened by viktor-ferenczi 2
  • Option to suppress temporal restir accumulation

    Option to suppress temporal restir accumulation

    Now with

    suppress_temporal_accum: true,
    spatial_reuse: false,
    direct_spatial_denoise: false,
    indirect_spatial_denoise: false,
    temporal_anti_aliasing: false,
    

    we see pure path tracing results

    opened by trsh 2
  • glam version conflict

    glam version conflict

    In Cargo.toml you need:

    bvh = "0.7.1"
    

    because of cargo tree:

    ├── bvh v0.7.0
    │   ├── approx v0.5.1 (*)
    │   ├── glam v0.21.3
    

    Two different glam versions (0.21 and 0.22) broke the compilation.

    opened by viktor-ferenczi 1
  • Very early support for FSR1 upscale

    Very early support for FSR1 upscale

    Sources & implementation details used from: https://github.com/GPUOpen-Effects/FidelityFX-FSR2

    Its only active when setting in config upscale_ratio other than 1.0, for example 2 or 1.5.

    The results are not good. Very blurry. At this moment I am not sure, if FSR1 just doesn't work well with path tracing or there are some issues with my implementation. fakeTextureGather could be the problem.

    I will continue to improve this and maybe others can help.

    opened by trsh 1
  • Reduce Bevy dependencies and update bevy_atmosphere

    Reduce Bevy dependencies and update bevy_atmosphere

    Previously used render feature is a group that contains unneeded stuff, like bevy_ui or bevy_text. Specified features in this PR is the required minimum. You can read more about in in this issue: https://github.com/bevyengine/bevy/issues/4202

    Also bevy_atmosphere has bumped its version, so now it contains your PR.

    opened by Shatur 1
  • Make use of max reservoir lifetime

    Make use of max reservoir lifetime

    Any time reservoir is reused, its lifetime increases. Reaching the max lifetime, its replace by new one. The max lifetime if a configuration parameter and can be adjusted by needs.

    opened by trsh 0
  • 30s startup delay

    30s startup delay

    Run any of the examples, like simple.rs.

    In the console log there will be a huge, about 30s long delay during startup. It happens while the window is already visible, but still blank.

    Console log:

    2022-11-28T22:08:41.604666Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3080 Ti", vendor: 4318, device: 8712, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "526.98", backend: Vulkan }
    2022-11-28T22:08:45.744495Z  INFO bevy_hikari::mesh_material::mesh: Loaded mesh 0
    2022-11-28T22:08:45.744551Z  INFO bevy_hikari::mesh_material::mesh: Loaded mesh 1
    2022-11-28T22:08:45.744694Z  INFO bevy_hikari::mesh_material::mesh: Loaded mesh 2
    

    Freeze is here.

    2022-11-28T22:09:16.117321Z  INFO naga::back::spv::writer: Skip function Some("load_previous_reservoir")    
    2022-11-28T22:09:16.117416Z  INFO naga::back::spv::writer: Skip function Some("store_reservoir")    
    2022-11-28T22:09:16.117518Z  INFO naga::back::spv::writer: Skip function Some("store_previous_spatial_reservoir")  
    

    This delay slows down development considerably.

    I run the sample inside CLion with the Rust plugin installed on Windows 10. It is just plain "Run", not a "Debug" run.

    opened by viktor-ferenczi 0
  • Provide an option to disable building of accelerating structures

    Provide an option to disable building of accelerating structures

    Currently we can toggle bevy-hikari using camera_render_graph. But the plugin continues to load the system very heavily due to the the building of accelerating structures. It would be great to have an option in config to disable it. This will allow to use debug mode with this plugin disabled for prototyping gameplay. Currently I experiencing low FPS in debug mode when this plugin is disabled only via camera_render_graph.

    opened by Shatur 0
  • Running `simple` example on M1:

    Running `simple` example on M1: "metal requires all arrays be constant sized" (naga 0.9 error)

    (May be related to #11? Not sure)

    thread 'main' panicked at 'internal error: entered unreachable code: metal requires all arrays be constant sized', /Users/ivan/.cargo/registry/src/github.com-1ecc6299db9ec823/naga-0.9.0/src/back/msl/writer.rs:235:21
    
      15:        0x1033378d8 - core::panicking::unreachable_display::h9fe587038728a68b
      16:        0x103338938 - <naga::back::msl::writer::TypeContext as core::fmt::Display>::fmt::h830f7fce5b7d1939
      18:        0x103338db0 - naga::back::msl::writer::TypedGlobalVariable::try_fmt::he6647d568d76e87b
      19:        0x103346afc - naga::back::msl::writer::Writer<W>::write_functions::hb2fcf614440db836
      20:        0x103344b40 - naga::back::msl::writer::Writer<W>::write::hbf0c1c30c083a2be
      21:        0x1033dae84 - naga::back::msl::write_string::h48019c2e606a918a
      22:        0x103308f60 - wgpu_hal::metal::device::<impl wgpu_hal::metal::Device>::load_shader::h06204f483b121b6c
      23:        0x10330cdcc - wgpu_hal::metal::device::<impl wgpu_hal::Device<wgpu_hal::metal::Api> for wgpu_hal::metal::Device>::create_compute_pipeline::hd744e8db82390d76
      24:        0x1032ca094 - wgpu_core::device::Device<A>::create_compute_pipeline::h0e0b9a7aa36ce61b
      25:        0x1032558c0 - wgpu_core::device::<impl wgpu_core::hub::Global<G>>::device_create_compute_pipeline::h1eecbb8c46938a60
      26:        0x1032dda20 - <wgpu::backend::direct::Context as wgpu::Context>::device_create_compute_pipeline::hd73131fee9b7c4cf
      27:        0x1032a1b7c - wgpu::Device::create_compute_pipeline::hdde1293e61f9ab4b
      28:        0x10315330c - bevy_render::render_resource::pipeline_cache::PipelineCache::process_queue::h2895d4c6fa89eb85
      29:        0x103125e00 - 
    
    opened by aldanor 1
  • Integration with Rapier debug rendering

    Integration with Rapier debug rendering

    Currently when Rapier is enabled I have constantly printed warning Encounter an error when loading mesh: MissingAttributeNormal and no debug rendering is present. Could we have an integration with Rapier via an optional feature or at least do not have such warning? Minimal example project to show how this debug rendering looks (hikari is commented out): rapier.zip

    opened by Shatur 0
  • WGPU Validation Error: Excessive bindings of type SampleTextures during COMPUTE stage on Mac M1

    WGPU Validation Error: Excessive bindings of type SampleTextures during COMPUTE stage on Mac M1

    Device: 13in 2020 Mac M1 16GB Source: Version 0.2.8 - Built from Source Code

    Problem: Running 'cargo run' command on the M1 Mac devices produces a 'main' thread panic exit of type 'wgpu validation error'. The error produced was:

    Caused by:
    In Device::create_bind_group_layout
    too many bindings of type SampledTextures in stage COMPUTE, limit is 16, count was 64
    
    Screen Shot 2022-10-13 at 8 37 58 PM
    opened by mcthaydt 4
Releases(v0.3.1)
Owner
研究社交
A Umich student graduated from SJTU.
研究社交
Parallax mapping shaders (relief and POM) for the bevy game engine

Bevy parallax mapping parallax mapping is a graphical effect adding the impression of depth to simple 2d textures by moving the texture's pixel around

Nicola Papale 7 Oct 8, 2022
An adventure survival voxel game written using Bevy and Rust.

An adventure survival voxel game written using Bevy and Rust.

Rigidity 3 Jun 4, 2022
Dwarf Fortress inspired frontend to Veloren, the multiplayer RPG voxel game written in Rust

velobracket ('veloren' + 'bracket-lib') velobracket is Dwarf Fortress inspired frontend to Veloren, the multiplayer RPG voxel game written in Rust. Us

Rodion Martynov 11 Feb 10, 2022
A sandbox library for making FAST voxel games

voxelize WIP A well-optimized web-based voxel engine. Development Before starting, make sure to install the following: rust node.js cargo-watch # clon

Ian Huang (Shaoru) 144 Nov 28, 2022
Integration layer between Bevy, puffin and tracing libraries

bevy_puffin This crate integrates the puffin library into Bevy. It provides PuffinTracePlugin to use as a replacement for the Bevy's default LogPlugin

Vladyslav Batyrenko 12 Jul 15, 2022
Implementation of the great book Ray Tracing in One Weekend in Rust.

Ray Tracing in One Weekend (Rust) Implementation of the great book Ray Tracing in One Weekend in Rust. Fun easy way to pick up and learn Rust (was rou

Stanley Su 6 Dec 29, 2021
An implementation of the Jump Flooding Algorithm for the Bevy engine.

bevy_jfa The Jump Flooding Algorithm (JFA) for Bevy. Features This crate provides an OutlinePlugin that can be used to add outlines to Bevy meshes. Se

null 20 Aug 19, 2022
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

Katharos Technology 23 Jul 4, 2022
Basic first-person fly camera for the Bevy game engine

bevy_flycam A basic first-person fly camera for Bevy 0.4 Controls WASD to move horizontally SPACE to ascend LSHIFT to descend ESC to grab/release curs

Spencer Burris 80 Dec 2, 2022
An ergonomic physics API for bevy games.

Heron An ergonomic physics API for 2d and 3d bevy games. (powered by rapier) How it looks like fn main() { App::build() .add_plugins(DefaultPlug

Jonathan Cornaz 315 Nov 29, 2022
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

Jakob Hellermann 475 Nov 27, 2022
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

Vladyslav Batyrenko 426 Nov 24, 2022
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

null 79 Nov 2, 2022
A 4X style camera for bevy.

A 4X style camera for bevy. Demo Default Key Bindings: W / A / S / D / Arrow Keys / Mouse Left - Move along the horizontal plane Q / E / Mouse Right -

null 28 Sep 12, 2022
Game physics in one weekend with bevy

Game Physics in a Weekend (in Rust) This project is an implementation of the Game Physics in a Weekend book using the Rust programming language and th

Cameron Hart 26 Jun 28, 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 164 Nov 21, 2022
Concise Reference Book for the Bevy Game Engine

Unofficial Bevy Cheat Book Click here to read the book! Concise reference to programming in the Bevy game engine. Covers useful syntax, features, prog

null 896 Dec 1, 2022
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

Michael Palmos 88 Nov 25, 2022
Template for a Bevy game

A Bevy game template Template for a Game using the awesome Bevy engine featuring (almost) out of the box builds for Windows, Linux and MacOS. What doe

Niklas Eicker 327 Nov 30, 2022