From a467d941599a2cef5bd0eff696999bca8d75ee23 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Tue, 28 Nov 2023 20:01:12 +0100 Subject: [PATCH] Code comments --- examples/raytracinggltf/raytracinggltf.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/raytracinggltf/raytracinggltf.cpp b/examples/raytracinggltf/raytracinggltf.cpp index 2edd9be69..a1a9d257e 100644 --- a/examples/raytracinggltf/raytracinggltf.cpp +++ b/examples/raytracinggltf/raytracinggltf.cpp @@ -1,5 +1,5 @@ /* - * Vulkan Example - Rendering a glTF model using hardware accelerated ray tracing example /for proper transparency, this sample does frame accumulation) + * Vulkan Example - Rendering a glTF model using hardware accelerated ray tracing example (for proper transparency, this sample does frame accumulation) * * Copyright (C) 2023 by Sascha Willems - www.saschawillems.de * @@ -705,6 +705,10 @@ class VulkanExample : public VulkanRaytracingSample { uniformData.projInverse = glm::inverse(camera.matrices.perspective); uniformData.viewInverse = glm::inverse(camera.matrices.view); + // This value is used to accumulate multiple frames into the finale picture + // It's required as ray tracing needs to do multiple passes for transparency + // In this sample we use noise offset by this frame index to shoot rays for transparency into different directions + // Once enough frames with random ray directions have been accumulated, it looks like proper transparency uniformData.frame++; memcpy(ubo.mapped, &uniformData, sizeof(uniformData)); }