Skip to content
tylertmsPublic

About

Cross-platform hardware pathtracer in C using Vulkan.

Resources

Stars

65 stars

Watchers

0 watching

Forks

Repository files navigation

vkrt

A Vulkan path tracer in C with Slang shaders, for Windows and Linux. The renderer is available as the vkrt_core library with a C API.

image

Features

Renderer

  • Vulkan hardware-accelerated ray tracing and mesh instancing.
  • Progressive accumulation and stochastic anti-aliasing.
  • RGB, single-wavelength, and four-wavelength hero spectral path tracing.
  • RGB2Spec spectral reconstruction.
  • Next-event estimation (NEE) and multiple importance sampling (MIS).
  • Emissive mesh lights and HDR environment lighting.
  • Layered BSDFs with diffuse, metal, dielectric, transmission, clearcoat, sheen, and subsurface approximation lobes.
  • Multiscatter anisotropic GGX reflection and refraction with spherical-cap VNDF sampling.
  • Complex-IOR conductor Fresnel and dielectric Fresnel.
  • Total internal reflection and Abbe-number spectral dispersion.
  • Beer-Lambert volume absorption.
  • PBR textures and tangent-space normal mapping.
  • Alpha masking and stochastic transparency.
  • ACES filmic tone mapping and automatic exposure.
  • Open Image Denoise.

Editor

  • Interactive path-traced viewport with object selection.
  • Scene editing with full material and BSDF controls.
  • glTF/GLB import with mesh instances, PBR materials, and textures.
  • Render mode with EXR, PNG, and JPEG export.
  • JSON scene save/load.
  • Debug views and command-line rendering.

BSDFs

Lobe Model References
Lambertian diffuse Ideal diffuse reflection. PBRT diffuse reflection
Oren-Nayar diffuse Oren-Nayar rough diffuse reflection. Oren and Nayar 1994, PBRT implementation
Metal reflection Anisotropic GGX with multiscatter energy compensation, spherical-cap VNDF sampling, height-correlated Smith masking, and conductor (eta/k) or Schlick Fresnel. PBRT microfacets, PBRT Fresnel, Schlick 1994, VNDF, spherical caps, Turquin compensation, Cycles implementation
Dielectric reflection Anisotropic GGX with multiscatter energy compensation, spherical-cap VNDF sampling, height-correlated Smith masking, and dielectric or tinted Schlick Fresnel. PBRT dielectric BSDF, PBRT Fresnel, Disney 2012, VNDF, spherical caps, Turquin compensation, Cycles implementation
Dielectric transmission Anisotropic GGX refraction with multiscatter energy compensation, spherical-cap VNDF sampling, height-correlated Smith masking, total internal reflection, and wavelength-dependent IOR. Walter et al. 2007, PBRT dielectric BSDF, Disney 2015, VNDF, spherical caps, Turquin compensation, Cycles implementation
Clearcoat Disney GTR1 with Schlick Fresnel and fixed-roughness Smith masking. Disney 2012, reference implementation, PBRT microfacets
Sheen LTC fiber sheen. Zeltner, Burley, and Chiang 2022, Cycles implementation, lookup tables
Subsurface approximation Disney local diffuse approximation. Disney 2012, reference implementation, Disney 2015

Implementation references

Usage

Download a package from Releases. Extract it and run bin/vkrt.exe on Windows or bin/vkrt on Linux, or run the Linux AppImage. Linux packages require glibc 2.39 or newer (Ubuntu 24.04 or newer).

Open a scene with File > Open. Set the output size and sample count, then select Start Render. After the render completes, use File > Save Render to export the image. Example scenes are in assets/scenes.

Run vkrt --help for command-line options.

Build

Requirements

  • GPU with Vulkan ray tracing support and a current graphics driver.
  • Git and Python 3.12 or newer.
  • Vulkan SDK 1.4.357 or newer, with its environment configured and slangc on PATH.
  • Windows: Visual Studio Build Tools with the C++ desktop workload.

Get the source

git clone https://github.com/tylertms/vkrt
cd vkrt

Windows (x64 developer PowerShell)

python -m venv .venv
./.venv/Scripts/Activate.ps1
python -m pip install -r scripts/requirements-build.txt
meson setup build --buildtype=release -Db_vscrt=static_from_buildtype
meson compile -C build
./build/vkrt.exe

Linux (Ubuntu 24.04)

sudo apt-get update
sudo apt-get install build-essential pkg-config nasm python3-venv libvulkan1 libdbus-1-dev libwayland-dev libxkbcommon-dev wayland-protocols libx11-dev libxrandr-dev libxinerama-dev libxi-dev libxcursor-dev libxext-dev
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r scripts/requirements-build.txt
meson setup build --buildtype=release -Dfile_dialogs=enabled
meson compile -C build
./build/vkrt

Development

python -m pip install -r scripts/requirements-lint.txt
pre-commit install
pre-commit run --all-files

Dependencies

Library Version
GLFW 3.5.1
zlib 1.3.2
libspng 0.7.4
libjpeg-turbo 3.2.0
Open Image Denoise 2.5.1
Dear ImGui 1.92.9b-docking
Dear Bindings 0.21, for ImGui 1.92.9b-docking
cglm 0.9.6
cgltf 1.15
cJSON 1.7.19
TinyEXR 3.2.0
Native File Dialog Extended 1.4.0

About

Cross-platform hardware pathtracer in C using Vulkan.

Resources

Stars

65 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages