xbdev - software development
Friday September 22, 2023
home | about | contact | Donations


Introduction to Computer Graphics and the Vulkan API

From Principles to Practice


Ray-Tracing & Vulkan (Acceleration Structures)

This page provides support tutorials for the Vulkan Ray-Tracing code examples (MWE - Minimal Working Examples). Simplified programs that give you somethign 'running' that you can elaborate and develop.

To be clear - the emphasis of the examples is to present minimal (basic) implementations from which the you can extend and build upon (i.e., not to build upon a framework with lots of wrapper classes - in essence, a raw taste of the core principles).
Most of the examples have tried to use no dependencies (external libraries (just Vulkan) - also a single file 'main.cpp' (which has been challenging - but gives you something to work with and as you rewrite and develop your own framework you'll know deep down what is happening - bottom up perspective).

Once you're up and running, there's a massive number of websites and resources online with additional material and information to enable you to go above and beyond with Graphics and Vulkan

The code examples use the Introduction to Vulkan 'Minimal Working Skeleton Code' as a springboard. If you're new to Vulkan and Graphics you may want to start there before jumping into hardware accelerated ray-tracing ;)

The aims of these `minimal working demos' is:
*. have fun learning ray-tracing with Vulkan
*. ray-tracing pipeline and acceleration structures (specific hardware support and enabled extensions) *. review and learn the underpinning concepts
*. help simplify complicated ideas
*. minimal working code (stripped and cut-back to the bone)
*. help make the topic interesting (real-time ray-tracing)
*. small self-contained demos

`Not' the aim:
*. develop a framework or engine
*. build an entire game or library
*. compare and develop cross platform libraries


Introduction to Accelrated Real-Time Ray-Tracing using Vulkan API (Samples C/C++/Visual Studio/Windows)

The VK_KHR_ray_tracing_pipeline extension is a real game changer for computer graphics, as it introduces ray-tracing pipelines. A new form of rendering pipeline is independent of the traditional rasterization (opens the door to a new generation of real-time graphics).

  01basic-settingup-project 346900 bytes Source Code
  02basic-rasterized-triangle 367201 bytes Source Code
  03basic-raytracer-triangle 703639 bytes Source Code
  04basic-raytracer-cube 703725 bytes Source Code
  05basic-cube-subsampling 705647 bytes Source Code
  06basic-texture (triangle/cube) 695876 bytes Source Code
  07basic-texture (sphere) 965876 bytes Source Code
  08basic-shadows (cubes) 995876 bytes Source Code
  09basic-reflection (cubes) 955876 bytes Source Code
  10basic-ambient-occlusion (cubes) 955876 bytes Source Code
  10basic-ambient-occlusion (B) (cubes) 965376 bytes Source Code
Other Ray-Tracing Examples/Tests

Random ray-tracing test/rewrites of existing projects - shared here for educational/information. Most of the examples are writing in a single file using Lambda expressions. Lambdas help a lot with encapsulation and readability when learning code/algorithms, while keeping the code sequential and together (learning tool).

Ray-Spheres - hpp/single file/lambdas (Source Code)

Single Triangle - hpp/single file/lambdas (Source Code)

Single Triangle Rotating - hpp/single file/lambdas (Source Code)

Rasterized Vulkan Triangle 228 Lines - hpp/single file/lambdas (Source Code)

Vulkan Ray-Tracing 'Steps' (Hardware Extensions)

Vulkan Version Source Code
Extensions Source Code
Ray-Tracing Features/Properties Source Code
Enable Device/Extension Source Code
Allocator Source Code
BLAS (Bottom Level Acceleration Structure) Source Code
TLAS (Top Level Acceleration Structure) Source Code
Descriptors Source Code
Shaders and Pipeline (Inline Shaders) Source Code
Shaders and Pipeline (External Files) Source Code
Binding Table Source Code
Ray-Tracing Output (Screen) (Inline Shaders) Source Code
Ray-Tracing Output (Screen) Source Code
Ray-Tracing TinyObjLoader Source Code

Ray-Tracing 'Hard-Way' with Vulkan and the Pixel-Shader

01-vulkan-rasterized-quad Source Code
02-vulkan-rasterized-ray-sphere Source Code
03-vulkan-rasterized-mandelbulb Source Code
03-vulkan-rasterized-sdf-rabbit Source Code












Copyright (c) 2002-2023 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.