Cornell box done in glTF format, with caustics.
Large-format screenshots may require a TDR time extension, if your framerate dips below 1 FPS, like on my 3060:
KeyPath : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue : TdrDelay
ValueType : REG_DWORD (32bit)
ValueData : Number of seconds to delay. 2 seconds is the default value.
Based off of Sascha Willems' raytracingreflections code.
Model by Rob Rau.
To obtain and compile the demo code:
Obtain the files
-
Download the base code from: https://github.com/SaschaWillems/Vulkan
-
Extract Vulkan-master directory to your hard drive (e.g. C:/dev/Vulkan-master/)
-
Open command prompt, change directory to C:/dev/Vulkan-master/
-
Type: cmake -G "Visual Studio 17 2022" -A x64
-
Download the assets (models and textures) from: https://github.com/SaschaWillems/Vulkan-Assets
-
Extract the model and textures subdirectories and the assorted files to C:/dev/Vulkan-master/assets/
-
Download the OLD GLM library from: https://github.com/g-truc/glm/tree/1ad55c5016339b83b7eec98c31007e0aee57d2bf
-
Extract the contents of glm-1ad55c5016339b83b7eec98c31007e0aee57d2bf/glm subdirectory to C:/dev/Vulkan-master/external/glm
Building the executables
-
Open the solution file C:/dev/Vulkan-master/vulkanExamples.sln
-
Change build setting to Release mode, x64
-
Select the Build -> Build Solution menu item (be patient, this takes a long time the first time)
-
Run an example (e.g. C:/dev/Vulkan-master/bin/Release/raytracingreflections.exe)
Replacing the source files
-
Copy VulkanglTFModel.cpp and VulkanglTFModel.h to C:/dev/Vulkan-master/base
-
Copy closesthit.rchit, miss.rmiss, raygen.rgen and shadow.rmiss to C:/dev/Vulkan-master/shaders/glsl/raytracingreflections
-
Copy raytracingreflections.cpp to C:/dev/Vulkan-master/examples/raytracingreflections
-
Make directory C:/temp/rob_rau_cornell/gltf/
-
Copy cornell.bin, cornell.gltf, ColorMapWithOpacityAlpha512.png and GlowMapWithReflectionAlpha512.png to C:/temp/rob_rau_cornell/gltf/
-
Delete all projects from the solution, except for ALL_BUILD, base, raytracingreflections and ZERO_CHECK.
-
Rebuild solution
-
Make a batch file rtreflect.bat in C:/dev/Vulkan-master/bin/Release/ with the following contents:
glslc.exe "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\closesthit.rchit" --target-env=vulkan1.2 -o "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\closesthit.rchit.spv"
glslc.exe "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\miss.rmiss" --target-env=vulkan1.2 -o "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\miss.rmiss.spv"
glslc.exe "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\raygen.rgen" --target-env=vulkan1.2 -o "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\raygen.rgen.spv"
glslc.exe "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\shadow.rmiss" --target-env=vulkan1.2 -o "C:\dev\Vulkan-master\shaders\glsl\raytracingreflections\shadow.rmiss.spv"
raytracingreflections.exe