A GPU-based progressive path tracer named flow , written in C++ using the new Vulkan graphics API.

The path tracing shader currently supports 3 basic material types: Lambertian (diffuse), metallic, and dielectric (glass). It can render basic implicit surfaces such as spheres, boxes, planes, and quads.

Additionally, flow supports explicit light sampling and Russian roulette path termination, both of which are optimizations to speed up convergence.

For the time being, flow uses a single render pass instance with two distinct subpasses. The first subpass involves two floating-point images in a "ping-pong" arrangement. This is how the light accumulates over the course of many frames, leading to a well-converged image. Whichever of the two images was used as a color attachment during this first subpass serves as an input attachment to the next (and final) subpass. Input attachments are unique to Vulkan and allow a render pass attachment to be read in a fragment shader stage during a subpass. Input attachments come with several restrictions and do not support random access like a typical sampler2D, for example.

The second subpass simply reads from this input attachment and writes to one of the swapchain images that are presented to the screen.

As such, there are two separate graphics pipelines - one that runs the main path tracing routine and another that normalizes the accumulated light (converts it from HDR to [0..1]) and writes to the corresponding swapchain image.

The code is available on my Github.