/HelloVulkan

πŸŒ‹πŸ––πŸ½ PBR, IBL, Clustered Forward Shading, Path Tracing, Shadow Mapping, and more!

Primary LanguageC++MIT LicenseMIT

πŸŒ‹Hello EngineπŸ––πŸ½

A real-time rendering engine built from scratch using Vulkan API and C++.

Features

  • Clustered Forward Shading, no more deferred!
  • Bindless Rendering.
  • Physically-Based Rendering (PBR) with Cook-Torrance BRDF.
  • Image-Based Lighting (IBL) with offscreen pipelines that generate:
    • A cubemap from an equirectangular HDR image.
    • Specular and diffuse cubemaps.
  • Compute shader to generate BRDF lookup table.
  • Shadow mapping.
  • Reinhard tonemap postprocessing.
  • glTF mesh/texture loading and rendering.
  • Multisample anti-aliasing (MSAA).
  • Automatic runtime compilation from GLSL to SPIR-V using glslang.
  • A a lightweight abstraction layer that encapsulates Vulkan API for rapid prototyping/development.
  • Minor features: Basic raytracing pipeline, skybox, instancing, ImGui, SSBOs, UBOs, and push constants.

Gallery

The image below shows a demo of PBR, IBL, and Shadow mapping.

vulkan_tachikoma_shadow_mapping

A realistic rendering of a helmet demonstrating PBR and IBL techniques.
vulkan_helmet.mp4

Clustered Forward Shading

The technique consists of two steps that are done in compute shaders. The first step is to subdivide the view frustum into AABB clusters. The next step is light culling, where it calculates lights that intersect the clusters. This step removes lights that are too far from a fragment, leading to reduced light iteration in the final fragment shader.

Preliminary testing using a 3070M graphics card shows the technique can render a PBR Sponza scene with over 1000 dynamic lights at 60-100 FPS. If too many lights end up inside the view frustum, especially when zooming out, there may be a drop in frame rate, but still much faster than a naive forward shading.

vulkan_cluster_forward.mp4

Link to some other cool results

Build

  • C++20
  • Vulkan SDK
  • Visual Studio 2022
  • Dependencies: glfw, ImGui, VMA, assimp, glm, stb, and volk.

Credit