Fixing many links issues.

Corrected shaders
This commit is contained in:
mklefrancois 2020-03-31 18:35:37 +02:00
parent b6402f0c09
commit 95912b873b
32 changed files with 135 additions and 123 deletions

View file

@ -4,7 +4,7 @@
The focus of this project and the provided code is to showcase a basic integration of The focus of this project and the provided code is to showcase a basic integration of
ray tracing within an existing Vulkan sample, using the ray tracing within an existing Vulkan sample, using the
[`VK_NV_ray_tracing`](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VK_NV_ray_tracing) extension. [`VK_KHR_ray_tracing`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_ray_tracing) extension.
The following tutorials starts from a the end of the previous ray tracing tutorial and provides step-by-step instructions to modify and add methods and functions. The following tutorials starts from a the end of the previous ray tracing tutorial and provides step-by-step instructions to modify and add methods and functions.
The sections are organized by components, with subsections identifying the modified functions. The sections are organized by components, with subsections identifying the modified functions.
@ -16,7 +16,7 @@ Instead of having examples fully functional, those tutorial starts from a progra
The first tutorial is starting from a Vulkan code example, which can load multiple OBJ and render them using the rasterizer, and adds step-by-step what is require to do ray tracing. The first tutorial is starting from a Vulkan code example, which can load multiple OBJ and render them using the rasterizer, and adds step-by-step what is require to do ray tracing.
### [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial/) ### [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/)
![resultRaytraceShadowMedieval](docs/Images/resultRaytraceShadowMedieval.png) ![resultRaytraceShadowMedieval](docs/Images/resultRaytraceShadowMedieval.png)
@ -24,4 +24,4 @@ The first tutorial is starting from a Vulkan code example, which can load multip
From this point on, you can continue creating your own ray types and shaders, and experiment with more advanced ray tracing based algorithms. From this point on, you can continue creating your own ray types and shaders, and experiment with more advanced ray tracing based algorithms.
### [**All Extra Tutorials**](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_further.md.html) ### [**All Extra Tutorials**](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_further.md.html)

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before After
Before After

View file

@ -1,2 +1,2 @@
 
# Start [Ray Tracing Tutorial](https://nvpro-samples.github.io/vk_raytracing_tutorial/) # Start [Ray Tracing Tutorial](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/)

View file

@ -2,8 +2,8 @@
# Environment Setup # Environment Setup
To get support for `VK_NV_ray_tracing`, please install an [NVIDIA driver](http://www.nvidia.com/Download/index.aspx?lang=en-us) To get support for `VK_KHR_ray_tracing`, please install an [Vulkan NVIDIA driver](https://developer.nvidia.com/vulkan-driver)
with version 440.97 or later, and the [Vulkan SDK](http://vulkan.lunarg.com/sdk/home) version 1.1.126.0 or later. with version 442.81 or later, and the [Vulkan SDK](http://vulkan.lunarg.com/sdk/home) version 1.2.136.0 or later.
This tutorial is a modification of [`ray_tracing__simple`](https://github.com/nvpro-samples/vk_raytracing_tutorial/tree/master/ray_tracing__simple), which is the result of the ray tracing tutorial. This tutorial is a modification of [`ray_tracing__simple`](https://github.com/nvpro-samples/vk_raytracing_tutorial/tree/master/ray_tracing__simple), which is the result of the ray tracing tutorial.
All following instructions are based on the modification of this project. All following instructions are based on the modification of this project.
@ -33,9 +33,21 @@ The directory structure should be looking like:
********************************************************** **********************************************************
!!! Warning !!! Warning
**Run CMake** in vk_raytracing_tutorial. **Run CMake** in vk_raytracing_tutorial.
## Beta Installation
If you are in the Beta period
* Latest driver: https://developer.nvidia.com/vulkan-driver
* Latest Vulkan headers: https://github.com/KhronosGroup/Vulkan-Headers
* When running CMake, modify VULKAN > VULKAN_HEADERS_OVERRIDE_INCLUDE_DIR to the path to beta vulkan headers.
Ex. under C:\Vulkan\Beta, copy the folder vulkan\ which contains all headers.
VULKAN_HEADERS_OVERRIDE_INCLUDE_DIR should point to C:\Vulkan\Beta
<!-- Markdeep: --> <!-- Markdeep: -->
<link rel="stylesheet" href="vkrt_tutorial.css?"> <link rel="stylesheet" href="vkrt_tutorial.css?">
<script> window.markdeepOptions = { tocStyle: "medium" };</script> <script> window.markdeepOptions = { tocStyle: "medium" };</script>

View file

@ -31,7 +31,7 @@ Create a new shader file `raytrace.rahit` and rerun CMake to have it added to th
This shader starts like `raytrace.chit`, but uses less information. This shader starts like `raytrace.chit`, but uses less information.
~~~~ C++ ~~~~ C++
#version 460 #version 460
#extension GL_NV_ray_tracing : require #extension GL_EXT_ray_tracing : require
#extension GL_EXT_nonuniform_qualifier : enable #extension GL_EXT_nonuniform_qualifier : enable
#extension GL_EXT_scalar_block_layout : enable #extension GL_EXT_scalar_block_layout : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
@ -41,7 +41,7 @@ This shader starts like `raytrace.chit`, but uses less information.
#include "wavefront.glsl" #include "wavefront.glsl"
// clang-format off // clang-format off
layout(location = 0) rayPayloadInNV hitPayload prd; layout(location = 0) rayPayloadInEXT hitPayload prd;
layout(binding = 2, set = 1, scalar) buffer ScnDesc { sceneDesc i[]; } scnDesc; layout(binding = 2, set = 1, scalar) buffer ScnDesc { sceneDesc i[]; } scnDesc;
layout(binding = 4, set = 1) buffer MatIndexColorBuffer { int i[]; } matIndex[]; layout(binding = 4, set = 1) buffer MatIndexColorBuffer { int i[]; } matIndex[];
@ -80,9 +80,9 @@ Now we will apply transparency:
~~~~ C++ ~~~~ C++
if (mat.dissolve == 0.0) if (mat.dissolve == 0.0)
ignoreIntersectionNV(); ignoreIntersectionEXT();
else if(rnd(prd.seed) > mat.dissolve) else if(rnd(prd.seed) > mat.dissolve)
ignoreIntersectionNV(); ignoreIntersectionEXT();
} }
~~~~ ~~~~
@ -183,23 +183,23 @@ First, `seed` will need to be available in the any hit shader, which is the reas
Change the local `seed` to `prd.seed` everywhere. Change the local `seed` to `prd.seed` everywhere.
~~~~ C++ ~~~~ C++
prd.seed = tea(gl_LaunchIDNV.y * gl_LaunchSizeNV.x + gl_LaunchIDNV.x, pushC.frame); prd.seed = tea(gl_LaunchIDEXT.y * gl_LaunchSizeEXT.x + gl_LaunchIDEXT.x, pushC.frame);
~~~~ ~~~~
For optimization, the `TraceNV` call was using the `gl_RayFlagsOpaqueNV` flag. But For optimization, the `TraceRayEXT` call was using the `gl_RayFlagsOpaqueEXT` flag. But
this will skip the any hit shader, so change it to this will skip the any hit shader, so change it to
~~~~ C++ ~~~~ C++
uint rayFlags = gl_RayFlagsNoneNV; uint rayFlags = gl_RayFlagsNoneEXT;
~~~~ ~~~~
## `raytrace.rchit` ## `raytrace.rchit`
Similarly, in the closest hit shader, change the flag to `gl_RayFlagsSkipClosestHitShaderNV`, as we want to enable the any hit and miss shaders, but we still don't care Similarly, in the closest hit shader, change the flag to `gl_RayFlagsSkipClosestHitShaderEXT`, as we want to enable the any hit and miss shaders, but we still don't care
about the closest hit shader for shadow rays. This will enable transparent shadows. about the closest hit shader for shadow rays. This will enable transparent shadows.
~~~~ C++ ~~~~ C++
uint flags = gl_RayFlagsSkipClosestHitShaderNV; uint flags = gl_RayFlagsSkipClosestHitShaderEXT;
~~~~ ~~~~
# Scene and Model # Scene and Model

View file

@ -20,10 +20,10 @@ It is similar to an indirect function call, whitout having to link those shaders
Data can only access data passed in to the callable from parent stage. There will be only one structure pass at a time and should be declared like for payload. Data can only access data passed in to the callable from parent stage. There will be only one structure pass at a time and should be declared like for payload.
In the parent stage, using the `callableDataNV` storage qualifier, it could be declared like: In the parent stage, using the `callableDataEXT` storage qualifier, it could be declared like:
~~~~ C++ ~~~~ C++
layout(location = 0) callableDataNV rayLight cLight; layout(location = 0) callableDataEXT rayLight cLight;
~~~~ ~~~~
where `rayLight` struct is defined in a shared file. where `rayLight` struct is defined in a shared file.
@ -38,22 +38,22 @@ struct rayLight
}; };
~~~~ ~~~~
And in the incoming callable shader, you must use the `callableDataInNV` storage qualifier. And in the incoming callable shader, you must use the `callableDataInEXT` storage qualifier.
~~~~ C++ ~~~~ C++
layout(location = 0) callableDataInNV rayLight cLight; layout(location = 0) callableDataInEXT rayLight cLight;
~~~~ ~~~~
# Execution # Execution
To execute one of the callable shader, the parent stage need to call `executeCallableNV`. To execute one of the callable shader, the parent stage need to call `executeCallableEXT`.
The first parameter is the SBT record index, the second one correspond to the 'location' index. The first parameter is the SBT record index, the second one correspond to the 'location' index.
Example of how it is called. Example of how it is called.
~~~~ C++ ~~~~ C++
executeCallableNV(pushC.lightType, 0); executeCallableEXT(pushC.lightType, 0);
~~~~ ~~~~
@ -181,7 +181,7 @@ cLight.inHitPosition = worldPos;
cLight.outLightDistance = 10000000; cLight.outLightDistance = 10000000;
} }
#else #else
executeCallableNV(pushC.lightType, 0); executeCallableEXT(pushC.lightType, 0);
#endif #endif
~~~~ ~~~~

View file

@ -35,7 +35,7 @@ information to discard hits over time.
Reflections can be implemented by shooting new rays from the closest hit shader, or by iteratively shooting them from 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. the raygen shader. This example shows the limitations and differences of these implementations.
* Calling traceNV() from the closest hit shader (recursive) * Calling traceRayEXT() from the closest hit shader (recursive)
* Adding more data to the ray payload to continue the ray from the raygen shader. * Adding more data to the ray payload to continue the ray from the raygen shader.
![Hundread of Reflections](Images/reflections.png height= "300px") ![Hundread of Reflections](Images/reflections.png height= "300px")
@ -82,7 +82,7 @@ explains what is needed to get procedural hit group working.
Replacing if/else by callable shaders. The code to execute the lighting is done in separate callable shaders instead of been part of the code. Replacing if/else by callable shaders. The code to execute the lighting is done in separate callable shaders instead of been part of the code.
* Adding multiple callable shaders * Adding multiple callable shaders
* Calling ExecuteCallableNV from the closest hit shader * Calling ExecuteCallableEXT from the closest hit shader
![Infinite | Spot | Point from callable shaders](Images/callable.png height= "300px") ![Infinite | Spot | Point from callable shaders](Images/callable.png height= "300px")

View file

@ -62,7 +62,7 @@ All the information will need to be hold in buffers, which will be available to
nvvkBuffer m_spheresMatIndexBuffer; // Define which sphere uses which material nvvkBuffer m_spheresMatIndexBuffer; // Define which sphere uses which material
~~~~ ~~~~
Finally, there are two functions, one to create the spheres, and one that will create the `VkGeometryNV` for the BLAS. Finally, there are two functions, one to create the spheres, and one that will create the intermediate structure for the BLAS.
~~~~ C++ ~~~~ C++
void createSpheres(); void createSpheres();
@ -382,7 +382,7 @@ We first declare the extensions and include common files.
~~~~ C++ ~~~~ C++
#version 460 #version 460
#extension GL_NV_ray_tracing : require #extension GL_EXT_ray_tracing : require
#extension GL_EXT_nonuniform_qualifier : enable #extension GL_EXT_nonuniform_qualifier : enable
#extension GL_EXT_scalar_block_layout : enable #extension GL_EXT_scalar_block_layout : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
@ -393,7 +393,7 @@ We first declare the extensions and include common files.
Then we **must** add the following, otherwise the intersection shader will not report any hit. Then we **must** add the following, otherwise the intersection shader will not report any hit.
~~~~ C++ ~~~~ C++
hitAttributeNV vec3 HitAttribute; hitAttributeEXT vec3 HitAttribute;
~~~~ ~~~~
The following is the topology of all spheres, which we will be able to retrieve using `gl_PrimitiveID`. The following is the topology of all spheres, which we will be able to retrieve using `gl_PrimitiveID`.
@ -464,8 +464,8 @@ Retrieving the ray is straight forward
void main() void main()
{ {
Ray ray; Ray ray;
ray.origin = gl_WorldRayOriginNV; ray.origin = gl_WorldRayOriginEXT;
ray.direction = gl_WorldRayDirectionNV; ray.direction = gl_WorldRayDirectionEXT;
~~~~ ~~~~
And getting the information about the geometry enclosed in the Aabb can be done like this. And getting the information about the geometry enclosed in the Aabb can be done like this.
@ -495,13 +495,13 @@ Now we just need to know if we will hit a sphere or a cube.
} }
~~~~ ~~~~
Intersection information is reported using `reportIntersectionNV`, with a distance from the origin and a second argument (hitKind) that can be used to differentiate the primitive type. Intersection information is reported using `reportIntersectionEXT`, with a distance from the origin and a second argument (hitKind) that can be used to differentiate the primitive type.
~~~~ C++ ~~~~ C++
// Report hit point // Report hit point
if(tHit > 0) if(tHit > 0)
reportIntersectionNV(tHit, hitKind); reportIntersectionEXT(tHit, hitKind);
} }
~~~~ ~~~~
@ -513,10 +513,10 @@ The new closest hit can be found [here](shaders/raytrace2.rchit)
This shader is almost identical to original `raytrace.rchit`, but since the primitive is implicit, we will only need to compute the normal for the primitive that was hit. This shader is almost identical to original `raytrace.rchit`, but since the primitive is implicit, we will only need to compute the normal for the primitive that was hit.
We retrieve the world position from the ray and the `gl_HitTNV` which was set in the intersection shader. We retrieve the world position from the ray and the `gl_HitTEXT` which was set in the intersection shader.
~~~~ C++ ~~~~ C++
vec3 worldPos = gl_WorldRayOriginNV + gl_WorldRayDirectionNV * gl_HitTNV; vec3 worldPos = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT;
~~~~ ~~~~
The sphere information is retrieved the same way as in the `raytrace.rint` shader. The sphere information is retrieved the same way as in the `raytrace.rint` shader.
@ -532,13 +532,13 @@ Then we compute the normal, as for a sphere.
vec3 normal = normalize(worldPos - instance.center); vec3 normal = normalize(worldPos - instance.center);
~~~~ ~~~~
To know if we have intersect a cube rather than a sphere, we are using `gl_HitKindNV`, which was set in the second argument of `reportIntersectionNV`. To know if we have intersect a cube rather than a sphere, we are using `gl_HitKindEXT`, which was set in the second argument of `reportIntersectionEXT`.
So when this is a cube, we set the normal to the major axis. So when this is a cube, we set the normal to the major axis.
~~~~ C++ ~~~~ C++
// Computing the normal for a cube if the hit intersection was reported as 1 // Computing the normal for a cube if the hit intersection was reported as 1
if(gl_HitKindNV == KIND_CUBE) // Aabb if(gl_HitKindEXT == KIND_CUBE) // Aabb
{ {
vec3 absN = abs(normal); vec3 absN = abs(normal);
float maxC = max(max(absN.x, absN.y), absN.z); float maxC = max(max(absN.x, absN.y), absN.z);

View file

@ -96,7 +96,7 @@ In `raytrace.rgen`, at the beginning of `main()`, initialize the random seed:
~~~~ C++ ~~~~ C++
// Initialize the random number // Initialize the random number
uint seed = tea(gl_LaunchIDNV.y * gl_LaunchSizeNV.x + gl_LaunchIDNV.x, pushC.frame); uint seed = tea(gl_LaunchIDEXT.y * gl_LaunchSizeEXT.x + gl_LaunchIDEXT.x, pushC.frame);
~~~~ ~~~~
Then we need two random numbers to vary the X and Y inside the pixel, except for frame 0, where we always shoot Then we need two random numbers to vary the X and Y inside the pixel, except for frame 0, where we always shoot
@ -113,7 +113,7 @@ vec2 subpixel_jitter = pushC.frame == 0 ? vec2(0.5f, 0.5f) : vec2(r1, r2);
Now we only need to change how we compute the pixel center: Now we only need to change how we compute the pixel center:
~~~~ C++ ~~~~ C++
const vec2 pixelCenter = vec2(gl_LaunchIDNV.xy) + subpixel_jitter; const vec2 pixelCenter = vec2(gl_LaunchIDEXT.xy) + subpixel_jitter;
~~~~ ~~~~
## Storing or Updating ## Storing or Updating
@ -126,13 +126,13 @@ Otherwise, we combine the new image with the previous `frame` frames.
if(pushC.frame > 0) if(pushC.frame > 0)
{ {
float a = 1.0f / float(pushC.frame + 1); float a = 1.0f / float(pushC.frame + 1);
vec3 old_color = imageLoad(image, ivec2(gl_LaunchIDNV.xy)).xyz; vec3 old_color = imageLoad(image, ivec2(gl_LaunchIDEXT.xy)).xyz;
imageStore(image, ivec2(gl_LaunchIDNV.xy), vec4(mix(old_color, prd.hitValue, a), 1.f)); imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(mix(old_color, prd.hitValue, a), 1.f));
} }
else else
{ {
// First frame, replace the value in the buffer // First frame, replace the value in the buffer
imageStore(image, ivec2(gl_LaunchIDNV.xy), vec4(prd.hitValue, 1.f)); imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(prd.hitValue, 1.f));
} }
~~~~ ~~~~
@ -263,7 +263,7 @@ To do this, add a constant to `raytrace.rgen` (this could alternatively be added
const int NBSAMPLES = 10; const int NBSAMPLES = 10;
~~~~ ~~~~
In `main()`, after initializing the random number seed, create a loop that encloses the lines from the generation of `r1` and `r2` to the `traceNV` call, and accumulates the colors returned by `traceNV`. At the end of the loop, divide by the number of samples that were taken. In `main()`, after initializing the random number seed, create a loop that encloses the lines from the generation of `r1` and `r2` to the `traceRayEXT` call, and accumulates the colors returned by `traceRayEXT`. At the end of the loop, divide by the number of samples that were taken.
~~~~ C++ ~~~~ C++
vec3 hitValues = vec3(0); vec3 hitValues = vec3(0);
@ -273,7 +273,7 @@ In `main()`, after initializing the random number seed, create a loop that enclo
float r1 = rnd(seed); float r1 = rnd(seed);
float r2 = rnd(seed); float r2 = rnd(seed);
// ... // ...
// TraceNV( ... ); // TraceRayEXT( ... );
hitValues += prd.hitValue; hitValues += prd.hitValue;
} }
prd.hitValue = hitValues / NBSAMPLES; prd.hitValue = hitValues / NBSAMPLES;

View file

@ -41,12 +41,12 @@ As an example, create a new file called `raytrace2.rchit`, and add it to Visual
~~~~ C++ ~~~~ C++
#version 460 #version 460
#extension GL_NV_ray_tracing : require #extension GL_EXT_ray_tracing : require
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) rayPayloadInNV hitPayload prd; layout(location = 0) rayPayloadInEXT hitPayload prd;
void main() void main()
{ {
@ -75,7 +75,7 @@ Then add a new hit group group immediately after adding the first hit group:
## `raytrace.rgen` ## `raytrace.rgen`
As a test, you can try changing the `sbtRecordOffset` parameter of the `traceNV` call in `raytrace.rgen`. As a test, you can try changing the `sbtRecordOffset` parameter of the `traceRayEXT` call in `raytrace.rgen`.
If you set the offset to `1`, then all ray hits will use the new CHIT, and the raytraced output should look like the image below: If you set the offset to `1`, then all ray hits will use the new CHIT, and the raytraced output should look like the image below:
![](Images/manyhits2.png) ![](Images/manyhits2.png)
@ -170,10 +170,10 @@ In the HelloVulkan class, we will add a structure to hold the hit group data.
## `raytrace2.rchit` ## `raytrace2.rchit`
In the closest hit shader, we can retrieve the shader record using the `layout(shaderRecordNV)` descriptor In the closest hit shader, we can retrieve the shader record using the `layout(shaderRecordEXT)` descriptor
~~~~ C++ ~~~~ C++
layout(shaderRecordNV) buffer sr_ { vec4 c; } shaderRec; layout(shaderRecordEXT) buffer sr_ { vec4 c; } shaderRec;
~~~~ ~~~~
and use this information to return the color: and use this information to return the color:
@ -199,7 +199,7 @@ In `main`, after we set which hit group an instance will use, we can add the dat
Since we are no longer compacting all handles in a continuous buffer, we need to fill the SBT as described above. Since we are no longer compacting all handles in a continuous buffer, we need to fill the SBT as described above.
After retrieving the handles of all 5 groups (raygen, miss, miss shadow, hit0, and hit1) After retrieving the handles of all 5 groups (raygen, miss, miss shadow, hit0, and hit1)
using `getRayTracingShaderGroupHandlesNV`, store the pointers to easily retrieve them. using `getRayTracingShaderGroupHandlesKHR`, store the pointers to easily retrieve them.
~~~~ C++ ~~~~ C++
// Retrieve the handle pointers // Retrieve the handle pointers

View file

@ -42,7 +42,7 @@ Ks 0.95 0.95 0.95
# Recursive Reflections # Recursive Reflections
Vulkan ray tracing allows recursive calls to traceNV, up to a limit defined by `VkPhysicalDeviceRayTracingPropertiesKHR`. Vulkan ray tracing allows recursive calls to traceRayEXT, up to a limit defined by `VkPhysicalDeviceRayTracingPropertiesKHR`.
In `createRtPipeline()` in `hello_vulkan.cpp`, bring the maximum recursion depth up to 10, making sure not to exceed the physical device's maximum recursion limit: In `createRtPipeline()` in `hello_vulkan.cpp`, bring the maximum recursion depth up to 10, making sure not to exceed the physical device's maximum recursion limit:
@ -63,7 +63,7 @@ In the `hitPayload` struct in `raycommon.glsl`, add the following:
## `raytrace.rgen` ## `raytrace.rgen`
In the ray generation shader, we will initialize all payload values before calling `traceNV`. In the ray generation shader, we will initialize all payload values before calling `traceRayEXT`.
~~~~ C++ ~~~~ C++
prd.depth = 0; prd.depth = 0;
@ -80,12 +80,12 @@ At the end of the closest hit shader, before setting `prd.hitValue`, we need to
if(mat.illum == 3 && prd.depth < 10) if(mat.illum == 3 && prd.depth < 10)
{ {
vec3 origin = worldPos; vec3 origin = worldPos;
vec3 rayDir = reflect(gl_WorldRayDirectionNV, normal); vec3 rayDir = reflect(gl_WorldRayDirectionEXT, normal);
prd.attenuation *= mat.specular; prd.attenuation *= mat.specular;
prd.depth++; prd.depth++;
traceNV(topLevelAS, // acceleration structure traceRayEXT(topLevelAS, // acceleration structure
gl_RayFlagsNoneNV, // rayFlags gl_RayFlagsNoneEXT, // rayFlags
0xFF, // cullMask 0xFF, // cullMask
0, // sbtRecordOffset 0, // sbtRecordOffset
0, // sbtRecordStride 0, // sbtRecordStride
@ -143,7 +143,7 @@ Initialize the new members of the payload:
prd.rayDir = direction.xyz; prd.rayDir = direction.xyz;
~~~~ ~~~~
Instead of calling traceNV only once, we will call it in a loop until we are done. Instead of calling traceRayEXT only once, we will call it in a loop until we are done.
Wrap the trace call in `raytrace.rgen` like this: Wrap the trace call in `raytrace.rgen` like this:
@ -151,7 +151,7 @@ Wrap the trace call in `raytrace.rgen` like this:
vec3 hitValue = vec3(0); vec3 hitValue = vec3(0);
for(;;) for(;;)
{ {
traceNV( /*.. */); traceRayEXT( /*.. */);
hitValue += prd.hitValue * prd.attenuation; hitValue += prd.hitValue * prd.attenuation;
@ -168,7 +168,7 @@ Wrap the trace call in `raytrace.rgen` like this:
And make sure to write the correct value And make sure to write the correct value
~~~~ C++ ~~~~ C++
imageStore(image, ivec2(gl_LaunchIDNV.xy), vec4(hitValue, 1.0)); imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(hitValue, 1.0));
~~~~ ~~~~
## `raytrace.rchit` ## `raytrace.rchit`
@ -179,7 +179,7 @@ We no longer need to shoot rays from the closest hit shader, so we can replace t
if(mat.illum == 3) if(mat.illum == 3)
{ {
vec3 origin = worldPos; vec3 origin = worldPos;
vec3 rayDir = reflect(gl_WorldRayDirectionNV, normal); vec3 rayDir = reflect(gl_WorldRayDirectionEXT, normal);
prd.attenuation *= mat.specular; prd.attenuation *= mat.specular;
prd.done = 0; prd.done = 0;
prd.rayOrigin = origin; prd.rayOrigin = origin;

View file

@ -273,7 +273,7 @@ In the `HelloVulkan` class declaration, we can now add the `createBottomLevelAS(
void createBottomLevelAS(); void createBottomLevelAS();
```` ````
The implementation loops over all the loaded models and fills in an array of `vk::GeometryNV` before The implementation loops over all the loaded models and fills in an array of `nvvkpp::RaytracingBuilderKHR::Blas` before
triggering a build of all BLAS's in a batch. The resulting acceleration structures will be stored triggering a build of all BLAS's in a batch. The resulting acceleration structures will be stored
within the helper in the order of construction, so that they can be directly referenced by index later. within the helper in the order of construction, so that they can be directly referenced by index later.
@ -475,8 +475,8 @@ builds or better performance.
```` C ```` C
void buildTlas(const std::vector<Instance>& instances, void buildTlas(const std::vector<Instance>& instances,
vk::BuildAccelerationStructureFlagsNV flags = vk::BuildAccelerationStructureFlagsKHR flags =
vk::BuildAccelerationStructureFlagBitsNV::ePreferFastTrace) vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastTrace)
{ {
m_tlas.flags = flags; m_tlas.flags = flags;
@ -633,7 +633,7 @@ In the header, we declare the objects related to this additional descriptor set:
vk::DescriptorSet m_rtDescSet; vk::DescriptorSet m_rtDescSet;
```` ````
The acceleration structure will be accessible by the Ray Generation shader, as we want to call `TraceNV()` from this The acceleration structure will be accessible by the Ray Generation shader, as we want to call `TraceRayEXT()` from this
shader. Later in this document, we will also make it accessible from the Closest Hit shader, in order to send rays from shader. Later in this document, we will also make it accessible from the Closest Hit shader, in order to send rays from
there as well. The output image is the offscreen buffer used by the rasterization, and will be written only by the there as well. The output image is the offscreen buffer used by the rasterization, and will be written only by the
RayGen shader. RayGen shader.
@ -805,7 +805,7 @@ ray trace some geometry, the Vulkan ray tracing extension typically uses at leas
* The **ray generation** shader will be the starting point for ray tracing, and will be called for each pixel. It will * The **ray generation** shader will be the starting point for ray tracing, and will be called for each pixel. It will
typically initialize a ray starting at the location of the camera, in a direction given by evaluating the camera lens typically initialize a ray starting at the location of the camera, in a direction given by evaluating the camera lens
model at the pixel location. It will then invoke `traceNV()`, that will shoot the ray in the scene. Other shaders below model at the pixel location. It will then invoke `traceRayEXT()`, that will shoot the ray in the scene. Other shaders below
will process further events, and return their result to the ray generation shader through the ray payload. will process further events, and return their result to the ray generation shader through the ray payload.
* The **miss** shader is executed when a ray does not intersect any geometry. For instance, it might sample an * The **miss** shader is executed when a ray does not intersect any geometry. For instance, it might sample an
@ -839,7 +839,7 @@ Two more shader types can optionally be used:
* The **any hit** shader is executed on each potential intersection: when searching for the hit point closest to the ray * The **any hit** shader is executed on each potential intersection: when searching for the hit point closest to the ray
origin, several candidates may be found on the way. The any hit shader can frequently be used to efficiently implement origin, several candidates may be found on the way. The any hit shader can frequently be used to efficiently implement
alpha-testing. If the alpha test fails, the ray traversal can continue without having to call `traceNV()` again. The alpha-testing. If the alpha test fails, the ray traversal can continue without having to call `traceRayEXT()` again. The
built-in any hit shader is simply a pass-through returning the intersection to the traversal engine, which will built-in any hit shader is simply a pass-through returning the intersection to the traversal engine, which will
determine which ray intersection is the closest. determine which ray intersection is the closest.
@ -864,12 +864,12 @@ The `shaders` folder now contains 3 more files:
shader program simply writes a constant color into the output buffer. shader program simply writes a constant color into the output buffer.
* `raytrace.rmiss` defines the miss shader. This shader will be executed when no geometry is hit, and will write a * `raytrace.rmiss` defines the miss shader. This shader will be executed when no geometry is hit, and will write a
constant color into the ray payload `rayPayloadInNV`, which is provided automatically. Since our current ray generation constant color into the ray payload `rayPayloadInEXT`, which is provided automatically. Since our current ray generation
program does not trace any rays for now, this shader will not be called. program does not trace any rays for now, this shader will not be called.
* `raytrace.rchit` contains a very simple closest hit shader. It will be executed upon hitting the geometry (our * `raytrace.rchit` contains a very simple closest hit shader. It will be executed upon hitting the geometry (our
triangles). As the miss shader, it takes the ray payload `rayPayloadInNV`. It also has a second input defining the triangles). As the miss shader, it takes the ray payload `rayPayloadInEXT`. It also has a second input defining the
intersection attributes `hitAttributeNV` as provided by the intersection shader, i.e. the barycentric coordinates. This intersection attributes `hitAttributeEXT` as provided by the intersection shader, i.e. the barycentric coordinates. This
shader simply writes a constant color to the payload. shader simply writes a constant color to the payload.
In the header file, let's add the definition of the ray tracing pipeline building method, and the storage members of the In the header file, let's add the definition of the ray tracing pipeline building method, and the storage members of the
@ -1028,7 +1028,7 @@ itself, but hit groups can comprise up to 3 shaders (intersection, any hit, clos
The ray generation and closest hit shaders can trace rays, making the ray tracing a potentially recursive process. To The ray generation and closest hit shaders can trace rays, making the ray tracing a potentially recursive process. To
allow the underlying RTX layer to optimize the pipeline we indicate the maximum recursion depth used by our shaders. For allow the underlying RTX layer to optimize the pipeline we indicate the maximum recursion depth used by our shaders. For
the simplistic shaders we currently have, we set this depth to 1, meaning that even if the shaders would trigger the simplistic shaders we currently have, we set this depth to 1, meaning that even if the shaders would trigger
recursion (ie. a hit shader calling `TraceNV()`), this recursion would be prevented by setting the result of this trace recursion (ie. a hit shader calling `TraceRayEXT()`), this recursion would be prevented by setting the result of this trace
call as a miss. Note that it is preferable to keep the recursion level as low as possible, replacing it by a loop call as a miss. Note that it is preferable to keep the recursion level as low as possible, replacing it by a loop
formulation instead. formulation instead.
@ -1329,7 +1329,7 @@ cam;
`set = 1` comes from the fact that it is the second descriptor set in `raytrace()`. `set = 1` comes from the fact that it is the second descriptor set in `raytrace()`.
When tracing a ray, the hit or miss shaders need to be able to return some information to the shader program that When tracing a ray, the hit or miss shaders need to be able to return some information to the shader program that
invoked the ray tracing. This is done through the use of a payload, identified by the `rayPayloadNV` qualifier. invoked the ray tracing. This is done through the use of a payload, identified by the `rayPayloadEXT` qualifier.
Since the payload struct will be reused in several shaders, we create a new shader file `raycommon.glsl` and add it to Since the payload struct will be reused in several shaders, we create a new shader file `raycommon.glsl` and add it to
the Visual Studio folder. the Visual Studio folder.
@ -1351,25 +1351,25 @@ we also enable:
#include "raycommon.glsl" #include "raycommon.glsl"
~~~~ ~~~~
The payload, identified with `rayPayloadNV` is then our `hitPayload` structure. The payload, identified with `rayPayloadEXT` is then our `hitPayload` structure.
```` C ```` C
layout(location = 0) rayPayloadNV hitPayload prd; layout(location = 0) rayPayloadEXT hitPayload prd;
```` ````
### Note ### Note
> In incoming shaders, like miss and closest hit, the payload will be `rayPayloadInNV`. > In incoming shaders, like miss and closest hit, the payload will be `rayPayloadInEXT`.
The `main` function of the shader then starts by computing the floating-point pixel coordinates, normalized between 0 The `main` function of the shader then starts by computing the floating-point pixel coordinates, normalized between 0
and 1. The `gl_LaunchIDNV` contains the integer coordinates of the pixel being rendered, while `gl_LaunchSizeNV` and 1. The `gl_LaunchIDEXT` contains the integer coordinates of the pixel being rendered, while `gl_LaunchSizeEXT`
corresponds to the image size provided when calling `traceRaysNV`. corresponds to the image size provided when calling `traceRayEXT`.
```` C ```` C
void main() void main()
{ {
const vec2 pixelCenter = vec2(gl_LaunchIDNV.xy) + vec2(0.5); const vec2 pixelCenter = vec2(gl_LaunchIDEXT.xy) + vec2(0.5);
const vec2 inUV = pixelCenter/vec2(gl_LaunchSizeNV.xy); const vec2 inUV = pixelCenter/vec2(gl_LaunchSizeEXT.xy);
vec2 d = inUV * 2.0 - 1.0; vec2 d = inUV * 2.0 - 1.0;
```` ````
@ -1388,12 +1388,12 @@ potential intersections along the ray. Those distances can be useful to reduce t
before or after a given point do not matter. A typical use case is for computing ambient occlusion. before or after a given point do not matter. A typical use case is for computing ambient occlusion.
```` C ```` C
uint rayFlags = gl_RayFlagsOpaqueNV; uint rayFlags = gl_RayFlagsOpaqueEXT;
float tMin = 0.001; float tMin = 0.001;
float tMax = 10000.0; float tMax = 10000.0;
```` ````
We now trace the ray itself, by first providing `traceNV` with the top-level acceleration structure and the ray masks. We now trace the ray itself, by first providing `traceRayEXT` with the top-level acceleration structure and the ray masks.
The `cullMask` value is a mask that will be binary AND-ed with the mask of the geometry instances. Since all instances The `cullMask` value is a mask that will be binary AND-ed with the mask of the geometry instances. Since all instances
have a `0xFF` flag as well, they will all be visible. The next 3 parameters indicate which hit group would be called have a `0xFF` flag as well, they will all be visible. The next 3 parameters indicate which hit group would be called
when hitting a surface. For example, a single object may be associated to 2 hit groups representing the behavior when when hitting a surface. For example, a single object may be associated to 2 hit groups representing the behavior when
@ -1405,10 +1405,10 @@ groups for a single instance. This is particularly useful if the instance offset
in the acceleration structure. A stride of 0 indicates that all hit groups are packed together, and the instance offset in the acceleration structure. A stride of 0 indicates that all hit groups are packed together, and the instance offset
can be used directly to find them in the SBT. The index of the miss shader comes next, followed by the ray origin, can be used directly to find them in the SBT. The index of the miss shader comes next, followed by the ray origin,
direction and extents. The last parameter identifies the payload that will be carried by the ray, by giving its location direction and extents. The last parameter identifies the payload that will be carried by the ray, by giving its location
index. The last `0` corresponds to the location of our payload, `layout(location = 0) rayPayloadNV hitPayload prd;`. index. The last `0` corresponds to the location of our payload, `layout(location = 0) rayPayloadEXT hitPayload prd;`.
```` C ```` C
traceNV(topLevelAS, // acceleration structure traceRayEXT(topLevelAS, // acceleration structure
rayFlags, // rayFlags rayFlags, // rayFlags
0xFF, // cullMask 0xFF, // cullMask
0, // sbtRecordOffset 0, // sbtRecordOffset
@ -1425,7 +1425,7 @@ index. The last `0` corresponds to the location of our payload, `layout(location
Finally, we write the resulting payload into the output buffer. Finally, we write the resulting payload into the output buffer.
```` C ```` C
imageStore(image, ivec2(gl_LaunchIDNV.xy), vec4(prd.hitValue, 1.0)); imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(prd.hitValue, 1.0));
} }
```` ````
@ -1443,7 +1443,7 @@ fact that `clearColor` is the first member in the struct, and do not even declar
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) rayPayloadInNV hitPayload prd; layout(location = 0) rayPayloadInEXT hitPayload prd;
layout(push_constant) uniform Constants layout(push_constant) uniform Constants
{ {
@ -1486,7 +1486,7 @@ We first include the payload definition and the OBJ-Wavefront structures
Then we describe the resources according to the descriptor set layout Then we describe the resources according to the descriptor set layout
```` C ```` C
layout(location = 0) rayPayloadInNV hitPayload prd; layout(location = 0) rayPayloadInEXT hitPayload prd;
layout(binding = 2, set = 1, scalar) buffer ScnDesc { sceneDesc i[]; } scnDesc; layout(binding = 2, set = 1, scalar) buffer ScnDesc { sceneDesc i[]; } scnDesc;
layout(binding = 5, set = 1, scalar) buffer Vertices { Vertex v[]; } vertices[]; layout(binding = 5, set = 1, scalar) buffer Vertices { Vertex v[]; } vertices[];
@ -1539,7 +1539,7 @@ The world-space position could be calculated in two ways, the first one being to
shader. But this could have precision issues if the hit point is very far. shader. But this could have precision issues if the hit point is very far.
```` C ```` C
vec3 worldPos = gl_WorldRayOriginNV + gl_WorldRayDirectionNV * gl_HitTNV; vec3 worldPos = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT;
```` ````
Another solution, more precise, consists in computing the position by interpolation, as for the normal Another solution, more precise, consists in computing the position by interpolation, as for the normal
@ -1636,7 +1636,7 @@ supports textures to modulate the surface albedo.
} }
// Specular // Specular
vec3 specular = computeSpecular(mat, gl_WorldRayDirectionNV, L, normal); vec3 specular = computeSpecular(mat, gl_WorldRayDirectionEXT, L, normal);
```` ````
The final lighting is then computed as The final lighting is then computed as
@ -1764,7 +1764,7 @@ rays will be traced from the closest hit shader, we add `vkSS::eClosestHitKHR` t
The closest hit shader now needs to be aware of the acceleration structure to be able to shoot rays: The closest hit shader now needs to be aware of the acceleration structure to be able to shoot rays:
```` C ```` C
layout(binding = 0, set = 0) uniform accelerationStructureNV topLevelAS; layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS;
```` ````
Those rays will also carry a payload, which will need to be defined at a different location from the payload of the Those rays will also carry a payload, which will need to be defined at a different location from the payload of the
@ -1772,12 +1772,12 @@ current ray. In this case, the payload will be a simple Boolean value indicating
not: not:
```` C ```` C
layout(location = 1) rayPayloadNV bool isShadowed; layout(location = 1) rayPayloadEXT bool isShadowed;
```` ````
In the `main` function, instead of simply setting our payload to `prd.hitValue = c;`, we will initiate a new ray. Note that In the `main` function, instead of simply setting our payload to `prd.hitValue = c;`, we will initiate a new ray. Note that
the index of the miss shader is now 1, since the SBT has 2 miss shaders. The payload location is defined to match the index of the miss shader is now 1, since the SBT has 2 miss shaders. The payload location is defined to match
the declaration `layout(location = 1)` above. Note, when invoking `traceNV()` we are setting the declaration `layout(location = 1)` above. Note, when invoking `traceRayEXT()` we are setting
the flags with the flags with
* `gl_RayFlagsSkipClosestHitShaderKHR`: Will not invoke the hit shader, only the miss shader * `gl_RayFlagsSkipClosestHitShaderKHR`: Will not invoke the hit shader, only the miss shader
@ -1803,12 +1803,12 @@ the specular term will then look like this:
{ {
float tMin = 0.001; float tMin = 0.001;
float tMax = lightDistance; float tMax = lightDistance;
vec3 origin = gl_WorldRayOriginNV + gl_WorldRayDirectionNV * gl_HitTNV; vec3 origin = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT;
vec3 rayDir = L; vec3 rayDir = L;
uint flags = uint flags =
gl_RayFlagsTerminateOnFirstHitNV | gl_RayFlagsOpaqueNV | gl_RayFlagsSkipClosestHitShaderNV; gl_RayFlagsTerminateOnFirstHitEXT | gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT;
isShadowed = true; isShadowed = true;
traceNV(topLevelAS, // acceleration structure traceRayEXT(topLevelAS, // acceleration structure
flags, // rayFlags flags, // rayFlags
0xFF, // cullMask 0xFF, // cullMask
0, // sbtRecordOffset 0, // sbtRecordOffset
@ -1828,7 +1828,7 @@ the specular term will then look like this:
else else
{ {
// Specular // Specular
specular = computeSpecular(mat, gl_WorldRayDirectionNV, L, normal); specular = computeSpecular(mat, gl_WorldRayDirectionEXT, L, normal);
} }
} }
```` ````

View file

@ -2,6 +2,6 @@
This example is the combination of all tutorials. This example is the combination of all tutorials.
If you haven't done the tutorials, you can start [here](https://nvpro-samples.github.io/vk_raytracing_tutorial) If you haven't done the tutorials, you can start [here](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR)
![](../docs/Images/ray_tracing__advance.png) ![](../docs/Images/ray_tracing__advance.png)

View file

@ -1,9 +1,9 @@
#version 460 core #version 460 core
#extension GL_NV_ray_tracing : enable #extension GL_EXT_ray_tracing : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) callableDataInNV rayLight cLight; layout(location = 0) callableDataInEXT rayLight cLight;
layout(push_constant) uniform Constants layout(push_constant) uniform Constants
{ {

View file

@ -1,9 +1,9 @@
#version 460 core #version 460 core
#extension GL_NV_ray_tracing : enable #extension GL_EXT_ray_tracing : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) callableDataInNV rayLight cLight; layout(location = 0) callableDataInEXT rayLight cLight;
layout(push_constant) uniform Constants layout(push_constant) uniform Constants
{ {

View file

@ -1,9 +1,9 @@
#version 460 core #version 460 core
#extension GL_NV_ray_tracing : enable #extension GL_EXT_ray_tracing : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) callableDataInNV rayLight cLight; layout(location = 0) callableDataInEXT rayLight cLight;
layout(push_constant) uniform Constants layout(push_constant) uniform Constants
{ {

View file

@ -3,6 +3,6 @@
This example is a simple OBJ viewer in Vulkan, without any ray tracing functionality. This example is a simple OBJ viewer in Vulkan, without any ray tracing functionality.
It is the starting point of the ray tracing tutorial, the source of the application in which ray tracing will be added. It is the starting point of the ray tracing tutorial, the source of the application in which ray tracing will be added.
## [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial/) ## [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/)
![resultRaytraceShadowMedieval](../docs/Images/resultRasterCube.png) ![resultRaytraceShadowMedieval](../docs/Images/resultRasterCube.png)

View file

@ -3,7 +3,7 @@
This example is the result of the ray tracing tutorial. This example is the result of the ray tracing tutorial.
The tutorial is adding ray tracing capability to an OBJ rasterizer in Vulkan The tutorial is adding ray tracing capability to an OBJ rasterizer in Vulkan
If you haven't done it, [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial/). If you haven't done it, [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/).
![resultRaytraceShadowMedieval](../docs/Images/resultRaytraceShadowMedieval.png) ![resultRaytraceShadowMedieval](../docs/Images/resultRaytraceShadowMedieval.png)
@ -11,4 +11,4 @@ If you haven't done it, [**Start Ray Tracing Tutorial**](https://nvpro-samples.g
Once the tutorial completed and the basics of ray tracing are in place, other tuturials are going further from this code base. Once the tutorial completed and the basics of ray tracing are in place, other tuturials are going further from this code base.
See all other [additional ray tracing tutorials](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_further.md.html) See all other [additional ray tracing tutorials](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_further.md.html)

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_animation.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_animation.md.htm)
![](../docs/Images/animation2.gif) ![](../docs/Images/animation2.gif)

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_anyhit.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_anyhit.md.htm)
![](../docs/Images/anyhit.png) ![](../docs/Images/anyhit.png)

View file

@ -1,7 +1,7 @@
#version 460 #version 460
#extension GL_NV_ray_tracing : require #extension GL_EXT_ray_tracing : require
layout(location = 1) rayPayloadInNV bool isShadowed; layout(location = 1) rayPayloadInEXT bool isShadowed;
void main() void main()
{ {

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_callable.md.html) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_callable.md.html)
![](../docs/Images/callable.png) ![](../docs/Images/callable.png)

View file

@ -804,13 +804,13 @@ void HelloVulkan::createRtPipeline()
nvvkpp::util::createShaderModule(m_device, nvvkpp::util::createShaderModule(m_device,
nvh::loadFile("shaders/light_inf.rcall.spv", true, paths)); nvh::loadFile("shaders/light_inf.rcall.spv", true, paths));
stages.push_back({{}, vk::ShaderStageFlagBits::eCallableNV, call0, "main"}); stages.push_back({{}, vk::ShaderStageFlagBits::eCallableKHR, call0, "main"});
callGroup.setGeneralShader(static_cast<uint32_t>(stages.size() - 1)); callGroup.setGeneralShader(static_cast<uint32_t>(stages.size() - 1));
m_rtShaderGroups.push_back(callGroup); m_rtShaderGroups.push_back(callGroup);
stages.push_back({{}, vk::ShaderStageFlagBits::eCallableNV, call1, "main"}); stages.push_back({{}, vk::ShaderStageFlagBits::eCallableKHR, call1, "main"});
callGroup.setGeneralShader(static_cast<uint32_t>(stages.size() - 1)); callGroup.setGeneralShader(static_cast<uint32_t>(stages.size() - 1));
m_rtShaderGroups.push_back(callGroup); m_rtShaderGroups.push_back(callGroup);
stages.push_back({{}, vk::ShaderStageFlagBits::eCallableNV, call2, "main"}); stages.push_back({{}, vk::ShaderStageFlagBits::eCallableKHR, call2, "main"});
callGroup.setGeneralShader(static_cast<uint32_t>(stages.size() - 1)); callGroup.setGeneralShader(static_cast<uint32_t>(stages.size() - 1));
m_rtShaderGroups.push_back(callGroup); m_rtShaderGroups.push_back(callGroup);

View file

@ -1,9 +1,9 @@
#version 460 core #version 460 core
#extension GL_NV_ray_tracing : enable #extension GL_EXT_ray_tracing : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) callableDataInNV rayLight cLight; layout(location = 0) callableDataInEXT rayLight cLight;
layout(push_constant) uniform Constants layout(push_constant) uniform Constants
{ {

View file

@ -1,9 +1,9 @@
#version 460 core #version 460 core
#extension GL_NV_ray_tracing : enable #extension GL_EXT_ray_tracing : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) callableDataInNV rayLight cLight; layout(location = 0) callableDataInEXT rayLight cLight;
layout(push_constant) uniform Constants layout(push_constant) uniform Constants
{ {

View file

@ -1,9 +1,9 @@
#version 460 core #version 460 core
#extension GL_NV_ray_tracing : enable #extension GL_EXT_ray_tracing : enable
#extension GL_GOOGLE_include_directive : enable #extension GL_GOOGLE_include_directive : enable
#include "raycommon.glsl" #include "raycommon.glsl"
layout(location = 0) callableDataInNV rayLight cLight; layout(location = 0) callableDataInEXT rayLight cLight;
layout(push_constant) uniform Constants layout(push_constant) uniform Constants
{ {

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_instances.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_instances.md.htm)
![](../docs/Images/VkInstances.png) ![](../docs/Images/VkInstances.png)

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_intersection.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_intersection.md.htm)
![](../docs/Images/ray_tracing_intersection.png) ![](../docs/Images/ray_tracing_intersection.png)

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_antialiasing.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_antialiasing.md.htm)
![](../docs/Images/antialiasing.png) ![](../docs/Images/antialiasing.png)

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_manyhits.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_manyhits.md.htm)
![](../docs/Images/manyhits.png) ![](../docs/Images/manyhits.png)

View file

@ -1,8 +1,8 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
This example is part of the the ray tracing tutorial. This example is part of the the ray tracing tutorial.
If you haven't done it, [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial/). If you haven't done it, [**Start Ray Tracing Tutorial**](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/).
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_rayquery.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_rayquery.md.htm)
![rayquery](../docs/Images/rayquery.png) ![rayquery](../docs/Images/rayquery.png)

View file

@ -1,5 +1,5 @@
# NVIDIA Vulkan Ray Tracing Tutorial # NVIDIA Vulkan Ray Tracing Tutorial
[Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial/vkrt_tuto_reflection.md.htm) [Start the tutorial of this project](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tuto_reflection.md.htm)
![](../docs/Images/reflections.png) ![](../docs/Images/reflections.png)