Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Vulkan Ray Tracing Update Japan Virtual Open House Feb 2021

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Chargement dans…3
×

Consultez-les par la suite

1 sur 11 Publicité

Plus De Contenu Connexe

Diaporamas pour vous (20)

Similaire à Vulkan Ray Tracing Update Japan Virtual Open House Feb 2021 (20)

Publicité

Plus par The Khronos Group Inc. (20)

Publicité

Vulkan Ray Tracing Update Japan Virtual Open House Feb 2021

  1. 1. © The Khronos® Group Inc. 2020 - Page 1 This work is licensed under a Creative Commons Attribution 4.0 International License Vulkan Ray Tracing January 2021 Daniel Koch, NVIDIA Vulkan Ray Tracing Chair © Khronos® Group 2020
  2. 2. © The Khronos® Group Inc. 2020 - Page 2 This work is licensed under a Creative Commons Attribution 4.0 International License Vulkan Ray Tracing Development Timeline March 2020 Provisional Extension Specifications January 2018 Vulkan Ray Tracing Subgroup Created Review and Integration of IHV and Developer Feedback Streamline layering of DXR over Vulkan Ray Tracing Multiple Usability Tweaks November 2020 Final Extension Specifications Conformance Test Development Multiple Implementations Added support for Provisional Spec to DXC HLSL compiler December 2020 Vulkan SDK with Ray Tracing Updated Samples
  3. 3. © The Khronos® Group Inc. 2020 - Page 3 This work is licensed under a Creative Commons Attribution 4.0 International License Vulkan Ray Tracing Design • The industry’s first open, cross-vendor, cross- platform standard for ray tracing acceleration - Coherent ray tracing framework with flexible merging of rasterization and ray tracing - Set of extensions to Vulkan, SPIR-V, and GLSL - seamlessly integrates ray tracing into Vulkan 1.X - Familiar to users of existing proprietary ray tracing APIs but also introduces new implementation flexibility - Hardware agnostic – can be accelerated on existing GPU compute and dedicated ray tracing cores - Primary focus on meeting desktop market demand for both real-time and offline rendering today – but designed to encourage mobile ray tracing too
  4. 4. © The Khronos® Group Inc. 2020 - Page 4 This work is licensed under a Creative Commons Attribution 4.0 International License Step 1: Create Efficient Scene Geometry • Ray tracing may use a huge numbers of rays - Specialized data structures for interrogating scene geometry are necessary for efficient acceleration • Acceleration Structures - Contains low-level 3D geometry to be ray traced and high-level references into the geometry - Opaque internal organization details Each vendor can optimize for processing for their hardware - E.g., Bounding Volume Hierarchy (BVH) for rapidly determining if there is any geometry in the path of a ray • Build Acceleration Structure - Vulkan driver integrates supplied geometry into its two-level Acceleration Structure Using a BVH data structure to enable efficient ray tracing through a 3D scene
  5. 5. © The Khronos® Group Inc. 2020 - Page 5 This work is licensed under a Creative Commons Attribution 4.0 International License VK_KHR_acceleration_structure • Create, build, and manage acceleration structures (AS) • Opaque, implementation-defined data structures, placed on a buffer • Two-level acceleration structure - Bottom-level contains triangles or AABBs - Top-level refers to bottom-level • Reference to bottom-level AS includes transform and shading properties • Top-level AS is accessed from the shader either as a descriptor binding or by device address Bottom Level AS Bottom Level AS Vertex & Index Buffers Top Level Acceleration Structure (AS) Transform & Properties … … Instance Buffer Acceleration Structure Hierarchy
  6. 6. © The Khronos® Group Inc. 2020 - Page 6 This work is licensed under a Creative Commons Attribution 4.0 International License Step 2: Scene Traversal • Ray tracing pipelines - Application compiles a set of shaders into the pipeline to provide desired ray and material processing - Application launches grid of rays into scene - Implicit management of ray intersections • Ray Queries - Any type of shader can launch a ray at any time - Shader can process intersection data however it wishes - Shader controls how traversal proceeds Bottom Level AS Bottom Level AS Shader Binding Table (SBT) Buffers Shading Info … … Graphics, Compute or Ray Tracing Pipeline RayQuery Acc. Structure Traversal Confirm Hit, Generate Details, or Terminate Proceed? Handle Result Explicit Ray Management within Single Shader Vertex & Index Buffers Top Level Acceleration Structure (AS) Transform & Properties … … Instance Buffer Acceleration Structure Hierarchy Intersection Any Hit Recursion Ray Tracing Pipeline RayGen Shader Acc. Structure Traversal Miss Closest Hit Hit? Implicit Ray and Shader Execution Management
  7. 7. © The Khronos® Group Inc. 2020 - Page 7 This work is licensed under a Creative Commons Attribution 4.0 International License VK_KHR_ray_tracing_pipeline • Provides ray tracing shaders and pipelines - SPV_KHR_ray_tracing / GLSL_EXT_ray_tracing - Support for ray tracing shader stages, builtins, storage classes, and instructions • vkCmdTraceRaysKHR launches ray generation shader with launch grid and shader addresses - traceRayEXT(...) from a shader starts acceleration structure traversal • Traversal invokes intersection and any hit shaders as needed to control traversal - Upon completion, traversal invokes a miss or closest hit shader - Hit attributes store hit information between intersection and hit shaders - Ray payloads store control and result information • Shader binding table provides shading info - Shader group handle for each type of shader - Optional shader buffer record for instance-specific data (e.g., buffer device addresses or descriptor indices) Shader Binding Table (SBT) Buffers Shading Info … … Intersection Any Hit Recursion Ray Tracing Pipeline RayGen Shader Acc. Structure Traversal Miss Closest Hit Hit? Implicit Ray and Shader Execution Management
  8. 8. © The Khronos® Group Inc. 2020 - Page 8 This work is licensed under a Creative Commons Attribution 4.0 International License VK_KHR_ray_query • Enables ray query intrinsics for all shader stages (graphics, compute, ray tracing) - SPV_KHR_ray_query / GLSL_EXT_ray_query - Ray query shader instructions • Execute ray traversal in any shader • rayQueryInitializeEXT(...) from a shader initializes a query with an AS and specific traversal properties • Call rayQueryProceedEXT(..) to start or continue traversal • Shader must explicitly examine potential intersections (type, geometry, location), and specify how it should be handled (generate intersection details, confirm hit, terminate ray) Graphics, Compute or Ray Tracing Pipeline RayQuery Acc. Structure Traversal Confirm Hit, Generate Details, or Terminate Proceed? Handle Result Explicit Ray Management within Single Shader
  9. 9. © The Khronos® Group Inc. 2020 - Page 9 This work is licensed under a Creative Commons Attribution 4.0 International License VK_KHR_pipeline_library • Ray tracing pipelines can use many shaders - Potentially orders of magnitude more shaders (1000s) than traditional applications to handle diverse tracing techniques and material types • Compilation bottleneck - Compiling many shaders in a ray tracing pipeline can be computationally intensive and cause application bottlenecks and stuttering • Pipeline library - Enables a library of SPIR-V shaders to be incrementally compiled into an existing Ray Tracing Pipeline saving significant processing load Primary Ray + Ambient Light Reflection + Direct Local light / Shadow Indirect Bounce Indirect Sun Light / Shadow Multiple shaders used to build complex lighting in a Quake 2 scene
  10. 10. © The Khronos® Group Inc. 2020 - Page 10 This work is licensed under a Creative Commons Attribution 4.0 International License Host Offload of Setup Operations • Ray tracing setup workloads can be compute intensive - AS builds and compiling ray tracing pipelines - Two mechanisms to offload and control setup workloads on the host CPU(s) for smoother, faster rendering • Build Acceleration Structure on Host - Use the host to build AS in host memory and then copy to the GPU - rather than build directly on the GPU - Final size of AS is known before copying to the GPU - enabling optimized GPU memory allocation • VK_KHR_deferred_host_operations - Driver returns deferred work handle to application for later execution - Application controls work execution and can chose to distribute onto multiple cores and background threads - Can asynchronously use multiple CPU cores to build Acceleration Structures on the host Using Deferred Host Operations to build a complex Acceleration Structure using multiple CPU cores to offload the work from the GPU for faster, smoother framerates HOST HOST GPU GPU
  11. 11. © The Khronos® Group Inc. 2020 - Page 11 This work is licensed under a Creative Commons Attribution 4.0 International License Developer Vulkan Ray Tracing Resources Production Vulkan Drivers with Vulkan Ray Tracing are shipping AMD Radeon Adrenalin 20.11.3 drivers for Radeon RX 6000 Series NVIDIA R460 drivers for All RTX GPUs GeForce GTX 1660 with 6GB+ of memory GeForce GTX 1060+ with 6GB+ of memory Intel Xe-HPG GPUs, available in 2021 Vulkan Ray Tracing Samples Vulkan Ray Tracing Guide How to use the Vulkan Ray Tracing extensions Exploring deeper technical details of the Vulkan Ray Tracing specifications Best practices for blending Vulkan rasterization and ray tracing techniques Khronos Member Materials Deep dive Vulkan Ray Tracing Tutorial How to use Vulkan Ray Tracing to Create a complete mini-path tracer A Vulkan-based glTF ray tracing viewer with open source on GitHub New textbook, and here, on principles and history of ray tracing by Jon Peddie Khronos welcomes developer feedback on Vulkan GitHub issues tracker

Notes de l'éditeur

  • Well, speaking of doing amazing things with Vulkan, I'm here to talk to you about Ray Tracing in Vulkan.
     
    1. Hi everyone – I am Daniel Koch and I work on graphics drivers at NVIDIA and am the chair of the Vulkan Ray Tracing Subgroup at Khronos.
  • 2. The Vulkan Ray Tracing Subgroup was formed in early 2018 and was tasked with bringing a ray tracing solution to Vulkan. In March 2020, the provisional ray tracing extensions were released to gather public feedback and input into the final design of these extensions. In November 2020, the final Vulkan ray tracing extensions were released and shortly after that in December, the Vulkan 1.2.162.0 SDK was released, incorporating support for these extensions and enabling developers to easily integrate Vulkan Ray Tracing into their applications.
  • 3. The Ray Tracing subgroup received a number of design contributions from hardware vendors; and examined requirements from both software and hardware vendors. Real-time techniques for ray tracing are still being actively researched and so the first version of Vulkan Ray Tracing has been designed to provide a framework, while setting an extensible stage for future developments.
     
    One overarching design goal was to provide a single, coherent cross-platform and multi-vendor framework for ray tracing acceleration that could be easily used together with existing Vulkan API functionality.
     
    Software vendors were also clear—we needed to enable content designed for contemporary proprietary APIs, such as NVIDIA’s OptiX™ or Microsoft’s DirectX Raytracing, to be easily portable to Vulkan. As such, we used a familiar overall architecture, including enabling the re-use of HLSL shaders, while also introducing new functionality and implementation flexibility.
     
    We’ve enabled selected parts of the framework to be optional for deployment flexibility in keeping with the Vulkan philosophy. For this first version, we are primarily aiming to expose the full functionality of modern desktop hardware, but in a way that is hardware agnostic and can be accelerated via existing GPU compute or dedicated ray tracing cores.
  • 4. So, how do you use Vulkan Ray Tracing? Like many other ray tracing APIs, the first step is to build the scene geometry into an efficient, two-level acceleration structure so searching for ray intersections can be optimized. The precise internal organization of the Vulkan acceleration structure is opaque to the application, so that the hardware vendor can optimize it to match their own architecture.
  • 5. The VK_KHR_acceleration_structure extension provides the ability to create and build acceleration structures on the GPU, or optionally on the host (more about that later). It also provides acceleration structure management commands, which enable compaction and serialization of acceleration structures.
     
    An acceleration structure is a highly-optimized, implementation-dependent data structure that is built from the application-provided scene geometry, and placed in a buffer. This opaque data structure is used to achieve high performance ray intersections in complex scenes.
     
    The acceleration structure is divided into a two-level hierarchy as shown. The bottom-level acceleration structure, contains the triangles or axis-aligned bounding boxes (AABBs) of custom geometry that make up the scene. Since each bottom level acceleration structure may correspond to what would be multiple draw calls in the rasterization pipeline, each bottom level acceleration structure can contain multiple sets of geometry of a given type. The top-level acceleration structure contains references to a set of bottom-level acceleration structures. Each reference includes shading and transform information for that reference. The bottom-level acceleration structure is only used by reference from the top-level acceleration structure. The top-level acceleration structure is accessed from the shader as a descriptor binding or by device address.
  • 6. Next, we need to launch rays into the scene to determine how those rays intersect and interact with scene geometry, materials, and light sources – and to process those intersections with programmable flexibility to enable a wide variety of visual effects. Vulkan provides two ways to traverse the scene.
     
    The first method (on the left) uses a new Ray Tracing Pipeline that enables the application to compile a set of shaders into a pipeline to handle any desired ray and material processing, and then launch a grid of rays into the scene with the Ray Tracing Pipeline invoking the appropriate shader when intersections occur, or a miss shader if no hits occur for that ray.
     
    The second technique to fire rays, called Ray Queries, (on the right) is much more explicit and enables any type of shader to launch a ray at any time and process the intersection data however it wishes. This is a very flexible technique as the shader also controls how the traversal proceeds through the scene, but it does place more burden onto the shader author.
  • 7. The VK_KHR_ray_tracing_pipeline extension adds the new ray tracing shader stages, pipelines, and associated commands. The corresponding SPV_KHR_ray_tracing and GLSL_EXT_ray_tracing extensions define the associated SPIR-V and GLSL constructs.
     
    Ray tracing pipeline work is launched using vkCmdTraceRaysKHR. This command invokes an application-defined set of ray generation threads, which can call traceRaysEXT() from the shader, starting traversal work on the specified acceleration structure. During traversal, if required by the trace and acceleration structure, application shader code in intersection and any hit shaders can control how traversal proceeds. After traversal completes, either a miss or closest hit shader is invoked.
     
    The different shaders can communicate parameters and results using ray payload structures between all traversal shaders and hit attribute structures from the traversal control shaders.
     
    To enable the traversal phase to know which shader to invoke after a given step of traversal to control or respond to the traversal, the implementation uses a shader binding table. Each shader entry in the table consists of a shader group handle plus an optional shader buffer record which the application may use for instance-specific data such as buffer device addresses or descriptor indices. The address for any given shader is computed by the traversal through a combination of parameters to the trace rays API call, parameters to the traceRayEXT shader call, and information stored in the acceleration structure.
  • 8. The VK_KHR_ray_query extension enables ray queries for all shader stages (including graphics, compute, and ray tracing shaders), and the corresponding SPV_KHR_ray_query and GLSL_EXT_ray_query extensions define the associated SPIR-V and GLSL constructs.
     
    Ray queries can be used to perform ray traversal and get a result back in any shader stage. Other than requiring acceleration structures, ray queries are performed using only the new shader instructions.
     
    Ray queries are initialized using rayQueryInitializeEXT which specifies an acceleration structure to traverse, and various properties of the ray being traced. Next, rayQueryProceedEXT is used to start the traversal. After an intersection candidate is found, the shader can examine properties of the potential intersection and of the ray itself using instructions which are accessible to shader during traversal and specify how the ray should be handled – either by generating intersection details, confirming a hit, or terminating the ray. If the traversal is not finished or the ray terminated, rayQueryProceedEXT can be called again to continue the acceleration structure traversal.
  • 9. A ray tracing application can use 100s or even 1000s of shaders to process the many types of visual effects in a scene. Compiling that many shaders into a Ray Tracing Pipeline can be intensive enough to cause application stuttering when new scenes are loaded, or when new scene effects are needed. It can be particularly aggravating to discover that a scene suddenly needs a new shader, and that triggers the entire set of shaders being recompiled and reloaded. To avoid that overhead, the VK_KHR_pipeline_library extension enables a library of SPIR-V shaders to be incrementally compiled into an existing ray tracing pipeline - saving the need to recompile everything from scratch.
     
    A pipeline library is a pipeline which includes the normal state and shaders along with an additional flag to indicate that it is not intended to be bound directly to the API but is intended to be used as a library that will be linked with a later pipeline. Pipeline libraries can also be included in multiple ray tracing pipelines, allowing shader compilation results to be reused across pipelines. Ray tracing pipeline creation may include both library pipelines as well as additional ray tracing shaders. All of the compilation state from each pipeline must match to successfully create the final linked pipeline.
  • 10. Pipeline Libraries can be helpful when dynamically managing the shaders in a scene, but there is still significant setup processing for any ray tracing application – not just compiling shaders but also loading geometry into Acceleration Structures. To help applications use all the available processors in a system for scene setup, we have provided the ability for the host CPU to build Acceleration Structures in host memory for subsequent download to the GPU, enabling the host CPU to perform setup in parallel with the GPU performing other work.
     
    The VK_KHR_deferred_host_operations extension provides a mechanism where the driver returns a deferred work handle to the application for later execution – enabling the application to control work execution and to distribute the work onto multiple cores and background threads. In a ray tracing application, deferred host operations can be used to asynchronously leverage multiple CPU cores to build host Acceleration Structures. They can also be used to parallelize ray tracing shader compilation and pipeline generation.
  • 11. So this was just a quick overview of the Vulkan Ray Tracing extensions that are now available. Production ray tracing drivers for AMD and NVIDIA GPUs are now shipping and Intel drivers should be available later this year. For more information about Vulkan Ray Tracing, here are a number of links to blog posts, tutorials, and other resources.
     
    Welcome to the era of portable, cross-vendor, cross-platform ray tracing acceleration! We look forward to seeing how you will use it!

×