{"id":15131068,"url":"https://github.com/nvpro-samples/vk_mini_path_tracer","last_synced_at":"2025-05-16T02:02:20.288Z","repository":{"id":49062982,"uuid":"321495059","full_name":"nvpro-samples/vk_mini_path_tracer","owner":"nvpro-samples","description":"A beginner-friendly Vulkan path tracing tutorial in under 300 lines of C++.","archived":false,"fork":false,"pushed_at":"2024-10-15T07:01:21.000Z","size":27009,"stargazers_count":1173,"open_issues_count":0,"forks_count":62,"subscribers_count":39,"default_branch":"main","last_synced_at":"2025-04-13T17:46:45.427Z","etag":null,"topics":["raytracing","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-12-14T23:04:14.000Z","updated_at":"2025-04-11T06:38:04.000Z","dependencies_parsed_at":"2022-09-14T21:04:20.717Z","dependency_job_id":"c429869c-a121-4129-9140-e396a22ab99c","html_url":"https://github.com/nvpro-samples/vk_mini_path_tracer","commit_stats":{"total_commits":50,"total_committers":6,"mean_commits":8.333333333333334,"dds":0.52,"last_synced_commit":"9d6a0e4242790ddac52a0d8ee02eb7670bf10965"},"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_mini_path_tracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_mini_path_tracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_mini_path_tracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_mini_path_tracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvpro-samples","download_url":"https://codeload.github.com/nvpro-samples/vk_mini_path_tracer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254453646,"owners_count":22073616,"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","vulkan"],"created_at":"2024-09-26T03:22:35.830Z","updated_at":"2025-05-16T02:02:20.240Z","avatar_url":"https://github.com/nvpro-samples.png","language":"C++","funding_links":[],"categories":["APIs"],"sub_categories":["Vulkan"],"readme":"![logo](http://nvidianews.nvidia.com/_ir/219/20157/NV_Designworks_logo_horizontal_greenblack.png)\n\n# vk_mini_path_tracer\n\nA relatively small, beginner-friendly path tracing tutorial.\n\n:arrow_forward: **[Load the tutorial!](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html)** :arrow_backward:\n\nThis tutorial is a beginner-friendly introduction to writing your own fast,\nphotorealistic path tracer in less than 300 lines of C++ code and 250 lines of\nGLSL shader code using Vulkan. Here's an example of what you'll render at the\nend of this tutorial!\n\n![](docs/images/12-vk_mini_path_tracer.png)\n\nVulkan is a low-level API for programming GPUs – fast, highly parallel processors.\nIt works on a wide variety of platforms – everything from workstations, to\ngaming consoles, to tablets and mobile phones, to edge devices.\n\nVulkan is usually known as a complex API, but I believe that when presented in\nthe right way, it's possible to make learning Vulkan accessible to people of all\nskill levels, whether they're never programmed graphics before or whether\nthey're a seasoned rendering engineer. Perhaps surprisingly, one of the best\nways to introduce Vulkan may be with GPU path tracing, because the API involved\nis relatively small.\n\nWe'll show how to write a small path tracer, using the NVVK helpers, included in\nthe nvpro-samples framework, to help with some Vulkan calls when needed.\nFor advanced readers, we'll also optionally talk about performance tips and some\nof the implementation details inside the helpers and Vulkan itself.\n\nThe final program uses less than 300 lines of C++ and less than 250 lines of GLSL shader code, including comments. You can find it [here](https://github.com/nvpro-samples/vk_mini_path_tracer/blob/main/vk_mini_path_tracer).\n\nHere are all the Vulkan functions, and NVVK functions and objects, that we'll use in the main tutorial:\n\n| **Vulkan Functions**     |                          |                          |\n| ------------------------ | ------------------------ | ------------------------ |\n| vkAllocateCommandBuffers | vkBeginCommandBuffer     | vkCmdBindDescriptorSets  |\n| vkCmdBindPipeline        | vkCmdDispatch            | vkCmdFillBuffer          |\n| vkCmdPipelineBarrier     | vkCreateCommandPool      | vkCreateComputePipelines |\n| vkDestroyCommandPool     | vkDestroyPipeline        | vkDestroyShaderModule    |\n| vkFreeCommandBuffers     | vkGetBufferDeviceAddress | vkQueueSubmit            |\n| vkQueueWaitIdle          | vkUpdateDescriptorSets   |                          |\n\n| **NVVK Functions and Objects** |                                  |                              |\n| ------------------------------ | -------------------------------- | ---------------------------- |\n| nvvk::Buffer                   | NVVK_CHECK                       | nvvk::Context                |\n| nvvk::ContextCreateInfo        | nvvk::createShaderModule         | nvvk::DescriptorSetContainer |\n| nvvk::RayTracingBuilderKHR     | nvvk::ResourceAllocatorDedicated |                              |\n\n-------\n\n## Chapters\n\n| **Chapter**                                                  |                                                              |                                                              |                                                              |\n| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |\n| ![small](docs/images/1-thumbnail.png)\u003cbr/\u003e[Hello, Vulkan!](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#hello,vulkan!) | ![small](docs/images/2-thumbnail.png)\u003cbr/\u003e[Device Extensions and Vulkan Objects](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#deviceextensionsandvulkanobjects) | ![small](docs/images/3-thumbnail.png)\u003cbr/\u003e[Memory and Commands](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#memory) | ![small](docs/images/4-gray.png)\u003cbr/\u003e[Writing an Image](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#writinganimage) |\n| ![small](docs/images/5-thumbnail.png)\u003cbr/\u003e[Compute Shaders](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#computeshaders) | ![small](docs/images/6-descriptors.png)\u003cbr/\u003e[Descriptors](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#descriptors) | ![small](docs/images/7-depthMap.png)\u003cbr/\u003e[Acceleration Structures and Ray Tracing](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#accelerationstructuresandraytracing) | ![small](docs/images/8-barycentricCoordinates.png)\u003cbr/\u003e[Four Uses of Intersection Data](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#fourusesofintersectiondata) |\n| ![small](docs/images/9-normals.png)\u003cbr/\u003e[Accessing Mesh Data](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#accessingmeshdata) | ![small](docs/images/10-reflectionPt3.png)\u003cbr/\u003e[Perfectly Specular Reflections](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#perfectlyspecularreflections) | ![small](docs/images/11-randomNoise.png)\u003cbr/\u003e[Antialiasing and Pseudorandom Number Generation](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#antialiasingandpseudorandomnumbergeneration) | ![small](docs/images/12-vk_mini_path_tracer.png)\u003cbr/\u003e[Diffuse Reflection](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#diffusereflection) |\n\n## Extra Chapters\n\nThese are optional, extra tutorials that show how to polish and add new features to the main tutorial's path tracer. Make sure to check out the [list of further Vulkan and ray tracing resources](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#pnext:goingfurther/furtherreading) at the end of the main tutorial as well!\n\n| **Extra Chapter**                                            |                                                              |                                                              |                                                              |\n| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |\n| ![](docs/images/e1-gaussianBlur.png)\u003cbr/\u003e [Gaussian Filter Antialiasing](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#gaussianfilterantialiasing) | ![](docs/images/e2-zoomRange.png)\u003cbr/\u003e[Measuring Performance](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#measuringperformance) | ![](docs/images/e3-thumbnail.png)\u003cbr/\u003e[Compaction](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#compaction) | ![](docs/images/e4-thumbnail.png)\u003cbr/\u003e[Including Files and Matching Values Between C++ And GLSL](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#includingfilesandmatchingvaluesbetweenc++andglsl) |\n| ![](docs/images/e5-1024-600.png)\u003cbr/\u003e [Push Constants](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#pushconstants) | ![](docs/images/e6-output.png)\u003cbr/\u003e[More Samples](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#moresamples) | ![](docs/images/e7-sparse.png)\u003cbr/\u003e[Images](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#images) | ![](docs/images/e8-thumbnail.png)\u003cbr/\u003e[Debug Names](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#debugnames) |\n| ![](docs/images/e9-result.png)\u003cbr/\u003e[Instances and Transformation Matrices](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#instancesandtransformationmatrices) | ![](docs/images/e10-closeup.png)\u003cbr/\u003e[Multiple Materials](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#multiplematerials) | ![](docs/images/e11-output-3.png)\u003cbr/\u003e[Ray Tracing Pipelines](https://nvpro-samples.github.io/vk_mini_path_tracer/extras.html#raytracingpipelines) |                                                              |\n\n## Building and Running\n\nPlease see the instructions [here](https://nvpro-samples.github.io/vk_mini_path_tracer/index.html#hello,vulkan!/settingupyourdevelopmentenvironment).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fvk_mini_path_tracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvpro-samples%2Fvk_mini_path_tracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fvk_mini_path_tracer/lists"}