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
  • 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 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 1
  • 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.15)
Owner
研究社交
A Umich student graduated from SJTU.
研究社交
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
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 10 Dec 28, 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 13 Dec 25, 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) 146 Dec 30, 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
A basic raytracer implementation in Rust based on the Ray Tracing in One Weekend book.

Raytracer A basic raytracer implementation in Rust based on the Ray Tracing in One Weekend book. Live Demo Result How to Run Standalone Binary $ cargo

Navin Mohan 19 Dec 13, 2022
A simple extension for `bevy-editor-pls` to support tilemap editing right inside the bevy app.

What is this This is a simple tilemap editor plugin, that hooks right into bevy_editor_pls to work with bevy_ecs_tilemap. It works completely within i

null 3 May 8, 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
Minecraft using Bevy and Bevy-Meshem

minecraft_bevy Minecraft_bevy was built to showcase bevy_meshem. After a week of developing it has: Chunk loading / unloading each chunk's mesh is bei

Adam 7 Oct 4, 2023
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
📺 An implementation of the retro bouncing DVD logo screensaver animation built with bevy and rust

?? Bevy bouncing DVD logo This project is a simple demonstration of using the Bevy game engine and the Rust programming language to create a bouncing

Victor Aremu 5 Jan 12, 2023
Minimalistic implementation of entity kinds for Bevy ECS.

Bevy ?? Kindly This crate is a minimalistic implementation of Kinded Entities for Bevy game engine. In summary, it allows the user to define, construc

null 10 Jan 26, 2023
Example implementation of a 3d hexagon tile-based map editor using bevy

bevy-hex-sandbox Example implementation of a 3d hexagon tile-based map editor using bevy v0.10. smol.mov This is not a maintained project. Instead, th

David M. Lary 4 Aug 5, 2023
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 85 Dec 23, 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 313 Dec 16, 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 517 Dec 31, 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 453 Jan 3, 2023