{"id":13831528,"url":"https://github.com/nvpro-samples/vk_raytracing_tutorial_KHR","last_synced_at":"2025-07-09T15:32:16.175Z","repository":{"id":38793474,"uuid":"251647550","full_name":"nvpro-samples/vk_raytracing_tutorial_KHR","owner":"nvpro-samples","description":"Ray tracing examples and tutorials using VK_KHR_ray_tracing","archived":false,"fork":false,"pushed_at":"2024-09-17T10:26:59.000Z","size":20258,"stargazers_count":1379,"open_issues_count":4,"forks_count":142,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-10-29T15:45:54.170Z","etag":null,"topics":["raytracing","tutorial","vulkan"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvpro-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-31T15:32:39.000Z","updated_at":"2024-10-24T06:34:53.000Z","dependencies_parsed_at":"2023-02-06T05:31:57.947Z","dependency_job_id":"4c0c398c-1fbe-4359-a374-9038dfb91a1f","html_url":"https://github.com/nvpro-samples/vk_raytracing_tutorial_KHR","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_raytracing_tutorial_KHR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_raytracing_tutorial_KHR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_raytracing_tutorial_KHR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_raytracing_tutorial_KHR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvpro-samples","download_url":"https://codeload.github.com/nvpro-samples/vk_raytracing_tutorial_KHR/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225565827,"owners_count":17489272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["raytracing","tutorial","vulkan"],"created_at":"2024-08-04T10:01:30.254Z","updated_at":"2024-11-20T13:30:51.854Z","avatar_url":"https://github.com/nvpro-samples.png","language":"C++","readme":"![logo](http://nvidianews.nvidia.com/_ir/219/20157/NV_Designworks_logo_horizontal_greenblack.png)\n\n# NVIDIA Vulkan Ray Tracing Tutorials\n\n![resultRaytraceShadowMedieval](docs/Images/resultRaytraceShadowMedieval.png)\n\n\nThe focus of this repository and the provided code is to showcase a basic integration of\n[`ray tracing`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#ray-tracing) and [`ray traversal`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#ray-traversal) within an existing Vulkan sample, using the\n[`VK_KHR_acceleration_structure`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_acceleration_structure), [`VK_KHR_ray_tracing_pipeline`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_ray_tracing_pipeline) and [`VK_KHR_ray_query`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_ray_query) extensions.\n\n## Setup\n\nTo be able to compile and run those examples, please follow the [setup](docs/setup.md) instructions. Find more over nvpro-samples setup at: https://github.com/nvpro-samples/build_all.\n\n## Tutorials \n\nThe [first tutorial](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tutorial.md.html) starts from a very simple Vulkan application. It loads a OBJ file and uses the rasterizer to render it. The tutorial then adds, **step-by-step**, all that is needed to be able to ray trace the scene.\n\n-------\n### Ray Tracing Tutorial: :arrow_forward: **[Start Here](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tutorial.md.html)** :arrow_backward:\n\n-------\n\n\n## Extra Tutorials\n\nAll other tutorials start from the end of the _first_ ray tracing tutorial and also provide step-by-step instructions to modify and add methods and functions for that extra section.\n\n\n\nTutorial | Details\n---------|--------\n![small](ray_tracing_anyhit/images/anyhit.png) | [Any Hit Shader](ray_tracing_anyhit)\u003cbr\u003eImplements transparent materials by adding a new shader to the Hit group and using the material information to discard hits over time. Adds an anyhit (.ahit) shader to the ray tracing pipeline. Creates simple transparency by randomly letting the ray hit or not.\n![small](ray_tracing_jitter_cam/images/antialiasing.png) | [Jitter Camera](ray_tracing_jitter_cam)\u003cbr\u003e  Anti-aliases the image by accumulating small variations of rays over time. Generates random ray directions. Read/write/accumulates the final image.\n![img](ray_tracing_instances/images/instances.png) | [Thousands of Objects](ray_tracing_instances) \u003cbr\u003e The current example allocates memory for each object, each of which has several buffers. This shows how to get around Vulkan's limits on the total number of memory allocations by using a memory allocator. Extends the limit of 4096 memory allocations. Uses these memory allocators: DMA, VMA.\n![img](ray_tracing_reflections/images/reflections.png) | [Reflections](ray_tracing_reflections) \u003cbr\u003e Reflections can be implemented by shooting new rays from the closest hit shader, or by iteratively shooting them from the raygen shader. This example shows the limitations and differences of these implementations. Calls traceRayEXT() from the closest hit shader (recursive). Adds more data to the ray payload to continue the ray from the raygen shader.\n![img](ray_tracing_manyhits/images/manyhits.png) | [Multiple Closest Hits Shader and Shader Records](ray_tracing_manyhits) \u003cbr\u003e Explains how to add more closest hit shaders, choose which instance uses which shader, add data per SBT that can be retrieved in the shader, and more. One closest hit shader per object. Sharing closest hit shaders for some objects. Passing a shader record to the closest hit shader.\n![img](ray_tracing_animation/images/animation2.gif) | [Animation](ray_tracing_animation) \u003cbr\u003e This tutorial shows how animating the transformation matrices of the instances (TLAS) and animating the vertices of an object (BLAS) in a compute shader could be done. Refitting top level acceleration structures. Refitting bottom level acceleration structures.\n![img](ray_tracing_intersection/images/intersection.png) | [Intersection Shader](ray_tracing_intersection) \u003cbr\u003e Adds thousands of implicit primitives and uses an intersection shader to render spheres and cubes. Explains what is needed to get procedural hit group working. Intersection Shaders. Sphere intersection. Axis aligned bounding box intersection.\n![img](ray_tracing_callable/images/callable.png) | [Callable Shader](ray_tracing_callable) \u003cbr\u003e Replacing if/else by callable shaders. The code to execute the lighting is done in separate callable shaders instead of being part of the main code. Adding multiple callable shaders. Calling ExecuteCallableEXT from the closest hit shader.\n![img](ray_tracing_rayquery/images/rayquery.png) | [Ray Query](ray_tracing_rayquery) \u003cbr\u003e Invokes ray intersection queries directly from the fragment shader to cast shadow rays. Ray tracing directly from the fragment shader.\n![img](ray_tracing_gltf/images/vk_ray_tracing_gltf_KHR_2.png) | [glTF Scene](ray_tracing_gltf) \u003cbr\u003e Instead of loading separate OBJ objects, the example was modified to load glTF scene files containing multiple objects. This example is not about shading, but using more complex data than OBJ. However, it also shows a basic path tracer implementation.\n![img](ray_tracing__advance/images/ray_tracing__advance.png) | [Advance](ray_tracing__advance) \u003cbr\u003e An example combining most of the above samples in a single application.\n![img](docs/Images/indirect_scissor/intro.png) | [Trace Rays Indirect](ray_tracing_indirect_scissor) \u003cbr\u003e Teaches the use of `vkCmdTraceRaysIndirectKHR`, which sources width/height/depth from a buffer. As a use case, we add lanterns to the scene and use a compute shader to calculate scissor rectangles for each of them.\n![img](ray_tracing_ao/images/ray_tracing_ao.png) | [AO Raytracing](ray_tracing_ao) \u003cbr\u003e This extension to the tutorial is showing how G-Buffers from the fragment shader, can be used in a compute shader to cast ambient occlusion rays using ray queries ([GLSL_EXT_ray_query](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_ray_query.txt)).\n![img](ray_tracing_specialization/images/specialization.png) | [Specialization Constants](ray_tracing_specialization) \u003cbr\u003e Showing how to use specialization constant and using interactively different specialization.\n![img](ray_tracing_advanced_compilation/images/high_level_advanced_compilation.png) | [Advanced Compilation](ray_tracing_advanced_compilation) \u003cbr\u003e Shows how to create reusable pipeline libraries and compile pipelines on multiple threads.\n![img](ray_tracing_motionblur/images/motionblur.png) | [Motion Blur](ray_tracing_motionblur) \u003cbr\u003e Using vertex motion and instance motion: matrix and SRT.","funding_links":[],"categories":["C++","API's"],"sub_categories":["Vulkan Ray Tracing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fvk_raytracing_tutorial_KHR","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvpro-samples%2Fvk_raytracing_tutorial_KHR","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fvk_raytracing_tutorial_KHR/lists"}