adrien-ben / vulkan-examples-rs

Vulkan examples written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vulkan-examples-rs

Collection of Vulkan examples that I make to learn stuff in Rust using ash.

screenshot

Examples

You can run one of the following example.

  • rt_triangle: Ray-traced triangle.
  • rt_shadows: Ray-traced gltf model with simulated sunlight shadow. It has one BLAS with multiple geometries. Light and camera controls with imgui.
  • rt_reflections: Ray-traced iterative (not recursive) reflections.
  • triangle: Rasterized triangle.
  • gpu_particles: Particles simulated on the gpu using a compute shader.
  • mandelbrot: Render mandelbrot set on gpu with expensive setting. The goal is to be gpu bound with a simple setup for some tests.
  • hdr_skybox: Display a skybox from a environment HDRi image targetting an HDR surface.
  • wboit: Weighted, Blended Order-Independent Transparency.
# Powershell example (all scripts have a .sh version)

# Compile all glsl shaders to spir-v 1.4
.\scripts\compile_shaders.ps1

# Enable validation layers and set log level to debug
.\scripts\debug.ps1 <example>

# Compiles with --release and set log level to info
.\scripts\run.ps1 <example>

Controls

For examples with interactive camera you can move the camera with

  • WASD to move
  • Ctrl and space to go up or down
  • Right-click and move the mouse around to look

You can alse press R to cycle through the performance information.

Requirements

  • Rust 1.77

All examples use Vulkan 1.3 and the following features:

  • dynamic_rendering
  • synchronization2

Ray tracing examples use the following extensions and features:

  • VK_KHR_ray_tracing_pipeline
    • ray_tracing_pipeline
  • VK_KHR_acceleration_structure
    • acceleration_structure
  • VK_KHR_deferred_host_operations
  • Vulkan 1.2's features
    • runtime_descriptor_array
    • buffer_device_address

RT is only enabled on examples using it, so other examples can run on hardware that does not support it.

Useful links

About

Vulkan examples written in Rust

License:MIT License


Languages

Language:Rust 95.0%Language:GLSL 4.7%Language:PowerShell 0.2%Language:Shell 0.1%