vk_raytrace icon indicating copy to clipboard operation
vk_raytrace copied to clipboard

Ray tracing glTF scene with Vulkan

VK_RAYTRACE

vk_raytrace

This project is a glTF 2.0 sample viewer using Vulkan ray tracing. It follows the ray tracing tutorial and combines all chapters into a single example.

The lighting equation is based on:

The rendering pipeline can be switched from:

  • RTX: RayGen, Closest-Hit, Miss, Any-Hit model
  • Compute: using Ray Query

Features

  • [x] Load glTF 2.0 files ascii and binary using tiny glTF
  • [x] Support for full node hierarchy
  • [x] Full implementation of metallic-roughness and specular-glossiness
  • [x] IBL lighting using importance light sampling
  • [x] Alpha blend and cut-out
  • [x] Texture transforms and samplers

Attributes

  • [x] Normal : create geometric normal when not present
  • [x] Texture coords : only set 0, project cube map when text coords are missing.
  • [x] Tangents : generate tangents and bitangent when missing.
  • [x] Color : default (1,1,1,1)

Extensions

Usage

Controls

Action Description
LMB Rotate around the target
RMB Dolly in/out
MMB Pan along view plane
LMB + Shift Dolly in/out
LMB + Ctrl Pan
LMB + Alt Look around
Mouse wheel Dolly in/out
Mouse wheel + Shift Zoom in/out (FOV)
Space Set interest point on the surface under the mouse cursor.
F10 Toggle UI pane.

Change glTF model

  • Drag and drop glTF files (.gltf or .glb) into viewer

Change HDR lighting

  • Drag and drop HDR files (.hdr) into viewer

Setup

git clone --recursive --shallow-submodules https://github.com/nvpro-samples/nvpro_core.git
git clone https://github.com/nvpro-samples/vk_raytrace.git

Other

Tags:

  • raytracing, GLTF, HDR, tonemapper, picking, BLAS, TLAS, PBR material

Extensions:

  • VK_KHR_RAY_QUERY_EXTENSION_NAME
  • VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME
  • VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME
  • VK_KHR_SHADER_CLOCK_EXTENSION_NAME
  • VK_KHR_MAINTENANCE3_EXTENSION_NAME
  • VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME
  • VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME
  • VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME
  • VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME
  • VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME
  • VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME
  • VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME
  • VK_KHR_SWAPCHAIN_EXTENSION_NAME
  • VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME
  • VK_EXT_DEBUG_UTILS_EXTENSION_NAME
  • VK_KHR_SURFACE_EXTENSION_NAME

Links


Test Scenes

Model Link
2 Cylinder Engine
Alpha Blending
Anisotropy
Antique Camera
Boom Box
Carbon Fiber
Clear Coat
Corset
Damaged Helmet
Flight Helmet
Metal Rough Spheres
Punctual Light
SciFi
SpecGlossVsMetalRough
Unlit
Transmission
Box Vertex Color