Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRD update to v4.14 #31

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion External/DLSS
Submodule DLSS updated 57 files
+3 −0 .gitmodules
+96 −397 LICENSE.txt
+1 −0 NVIDIAImageScaling
+13 −1 README.md
+ doc/DLSS-RR Integration Guide API.pdf
+ doc/DLSS_Programming_Guide_Release.pdf
+ doc/RTX Developer Localization Strings - 073021.zip
+ doc/RTX Developer Localization Strings - 111324.zip
+ doc/RTX UI Developer Guidelines Chinese Version.pdf
+ doc/RTX UI Developer Guidelines.pdf
+88 −24 include/nvsdk_ngx.h
+247 −52 include/nvsdk_ngx_defs.h
+157 −0 include/nvsdk_ngx_defs_dlssd.h
+18 −20 include/nvsdk_ngx_helpers.h
+695 −0 include/nvsdk_ngx_helpers_dlssd.h
+362 −0 include/nvsdk_ngx_helpers_dlssd_vk.h
+15 −23 include/nvsdk_ngx_helpers_vk.h
+17 −18 include/nvsdk_ngx_params.h
+36 −0 include/nvsdk_ngx_params_dlssd.h
+122 −31 include/nvsdk_ngx_vk.h
+ lib/Linux_x86_64/dev/libnvidia-ngx-dlss.so.2.3.1
+ lib/Linux_x86_64/dev/libnvidia-ngx-dlss.so.310.1.0
+ lib/Linux_x86_64/dev/libnvidia-ngx-dlssd.so.310.1.0
+ lib/Linux_x86_64/libnvsdk_ngx.a
+ lib/Linux_x86_64/rel/libnvidia-ngx-dlss.so.2.3.1
+ lib/Linux_x86_64/rel/libnvidia-ngx-dlss.so.310.1.0
+ lib/Linux_x86_64/rel/libnvidia-ngx-dlssd.so.310.1.0
+ lib/Windows_x86_64/dev/nvngx_dlss.dll
+ lib/Windows_x86_64/dev/nvngx_dlssd.dll
+ lib/Windows_x86_64/rel/nvngx_dlss.dll
+ lib/Windows_x86_64/rel/nvngx_dlssd.dll
+ lib/Windows_x86_64/vs2012/nvsdk_ngx_d.lib
+ lib/Windows_x86_64/vs2012/nvsdk_ngx_d_dbg.lib
+ lib/Windows_x86_64/vs2012/nvsdk_ngx_s.lib
+ lib/Windows_x86_64/vs2012/nvsdk_ngx_s_dbg.lib
+ lib/Windows_x86_64/vs2012/x64/nvsdk_ngx_d.lib
+ lib/Windows_x86_64/vs2012/x64/nvsdk_ngx_d_dbg.lib
+ lib/Windows_x86_64/vs2012/x64/nvsdk_ngx_s.lib
+ lib/Windows_x86_64/vs2012/x64/nvsdk_ngx_s_dbg.lib
+ lib/Windows_x86_64/vs2013/nvsdk_ngx_d.lib
+ lib/Windows_x86_64/vs2013/nvsdk_ngx_d_dbg.lib
+ lib/Windows_x86_64/vs2013/nvsdk_ngx_s.lib
+ lib/Windows_x86_64/vs2013/nvsdk_ngx_s_dbg.lib
+ lib/Windows_x86_64/vs2013/x64/nvsdk_ngx_d.lib
+ lib/Windows_x86_64/vs2013/x64/nvsdk_ngx_d_dbg.lib
+ lib/Windows_x86_64/vs2013/x64/nvsdk_ngx_s.lib
+ lib/Windows_x86_64/vs2013/x64/nvsdk_ngx_s_dbg.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_d.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_d_dbg.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_d_dbg_iterator0.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_d_dbg_iterator1.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_d_iterator1.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_s.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_s_dbg.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_s_dbg_iterator0.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_s_dbg_iterator1.lib
+ lib/Windows_x86_64/x64/nvsdk_ngx_s_iterator1.lib
6 changes: 3 additions & 3 deletions External/DLSS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if (WIN32)
set(dlss_lib_debug "nvsdk_ngx_s_dbg.lib")

set_target_properties(DLSS PROPERTIES
IMPORTED_IMPLIB "${dlss_sdk}/lib/${dlss_platform}/x86_64/${dlss_lib_release}"
IMPORTED_IMPLIB_DEBUG "${dlss_sdk}/lib/${dlss_platform}/x86_64/${dlss_lib_debug}"
IMPORTED_IMPLIB "${dlss_sdk}/lib/${dlss_platform}/x64/${dlss_lib_release}"
IMPORTED_IMPLIB_DEBUG "${dlss_sdk}/lib/${dlss_platform}/x64/${dlss_lib_debug}"
IMPORTED_LOCATION "${dlss_sdk}/lib/${dlss_platform}/rel/nvngx_dlss.dll"
IMPORTED_LOCATION_DEBUG "${dlss_sdk}/lib/${dlss_platform}/dev/nvngx_dlss.dll"
)
Expand All @@ -21,7 +21,7 @@ elseif (UNIX AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
add_library(DLSS STATIC IMPORTED)

set(dlss_platform "Linux_x86_64")
set(dlss_lib "libnvidia-ngx-dlss.so.2.3.1")
set(dlss_lib "libnvidia-ngx-dlss.so.310.1.0")

set_target_properties(DLSS PROPERTIES
IMPORTED_LOCATION "${dlss_sdk}/lib/${dlss_platform}/libnvsdk_ngx.a"
Expand Down
2 changes: 1 addition & 1 deletion External/NRD
Submodule NRD updated 359 files
3 changes: 0 additions & 3 deletions External/NRD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/NRD/CMakeLists.txt")
option(NRD_STATIC_LIBRARY "" ON)

add_subdirectory(external/NRD)

set_target_properties(NRD PROPERTIES FOLDER NRD)
set_target_properties(NRD_Shaders PROPERTIES FOLDER NRD)
endif()
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,43 @@ Version 2.3.0.

**RTX** **D**ynamic **I**llumination is a framework that originally facilitated implementation of efficient direct light sampling in real-time renderers. It is based on the **ReSTIR** algorithm published in the paper called "Spatiotemporal reservoir resampling for real-time ray tracing with dynamic direct lighting" by B. Bitterli et al.

Starting with version 2.0, RTXDI also includes **ReSTIR GI** functionality, which allows applications to apply importance resampling to indirect illumination rendered using path tracing. For more information about the indirect illumination algorithm, see the paper called "ReSTIR GI: Path Resampling for Real-Time Path Tracing" by Y. Ouyang et al. The feature is described in more detail in [this document](doc/RestirGI.md).
Starting with version 2.0, RTXDI also includes **ReSTIR GI** functionality, which allows applications to apply importance resampling to indirect illumination rendered using path tracing. For more information about the indirect illumination algorithm, see the paper called "ReSTIR GI: Path Resampling for Real-Time Path Tracing" by Y. Ouyang et al. The feature is described in more detail in [this document](Doc/RestirGI.md).

For more information about RTXDI, see the [NVIDIA Developer Page](https://developer.nvidia.com/rtxdi).

## Package Contents

[`Libraries/Rtxdi`](https://github.com/NVIDIAGameWorks/rtxdi-runtime) is a submodule that contains the integrable runtime sources that are meant to be included in the application build:
[`Libraries/Rtxdi`](https://github.com/NVIDIA-RTX/RTXDI-Library) is a submodule that contains the integrable runtime sources that are meant to be included in the application build:

- [`Rtxdi/Include/Rtxdi`](https://github.com/NVIDIAGameWorks/rtxdi-runtime/tree/main/include/rtxdi) has the include files, both for host code and for shaders.
- [`Rtxdi/Include/Rtxdi/DI/`](https://github.com/NVIDIAGameWorks/rtxdi-runtime/tree/main/Include/Rtxdi/DI/) and [`Rtxdi/Include/Rtxdi/GI/`](https://github.com/NVIDIAGameWorks/rtxdi-runtime/tree/main/Include/Rtxdi/GI/) are the main shader include folders that contain the resampling implementations for their respective algorithms.
- [`Rtxdi/Source`](https://github.com/NVIDIAGameWorks/rtxdi-runtime/tree/main/Source) has the host code with various utility functions for setting up the parameters and resources for resampling.
- [`Rtxdi/Include/Rtxdi`](https://github.com/NVIDIA-RTX/RTXDI-Library/tree/main/Include/Rtxdi) has the include files, both for host code and for shaders.
- [`Rtxdi/Include/Rtxdi/DI/`](https://github.com/NVIDIA-RTX/RTXDI-Library/tree/main/Include/Rtxdi/DI) and [`Rtxdi/Include/Rtxdi/GI/`](https://github.com/NVIDIA-RTX/RTXDI-Library/tree/main/Include/Rtxdi/GI) are the main shader include folders that contain the resampling implementations for their respective algorithms.
- [`Rtxdi/Source`](https://github.com/NVIDIA-RTX/RTXDI-Library/tree/main/Source) has the host code with various utility functions for setting up the parameters and resources for resampling.

[`Samples`](Samples) contains two sample projects, [`MinimalSample`](Samples/MinimalSample) and [`FullSample`](Samples/FullSample). The [`MinimalSample/Source`](Samples/MinimalSample/Source) project implements ReSTIR DI in a single combined pass to show a minimum viable implementation. The [`FullSample/Source`](Samples/FullSample/Source) project implements ReSTIR DI in several passes integrated into a broader rendering pipeline to show a more standard implementation. The shaders for each project live in their respective [`MinimalSample/Shaders`](Samples/MinimalSample/Shaders) and [`FullSample/Shaders`](Samples/FullSample/Shaders) folders.

[`External`](External) contains project dependencies both from Nvidia and third parties:

- [`External/donut`](External/donut) is a Git submodule structure with the ["Donut" rendering framework](https://github.com/NVIDIAGameWorks/donut) used to build the sample apps.
- `External/donut` is a Git submodule structure with the ["Donut" rendering framework](https://github.com/NVIDIA-RTX/Donut) used to build the sample apps.

- [`External/NRD`](External/NRD) is a Git submodule with the ["NRD" denoiser library](https://github.com/NVIDIAGameWorks/RayTracingDenoiser).
- `External/NRD` is a Git submodule with the ["NRD" denoiser library](https://github.com/NVIDIA-RTX/NRD).

- [`External/DLSS`](External/DLSS) is a Git submodule with the [Deep Learning Super-Sampling SDK](https://github.com/NVIDIA/DLSS).
- `External/DLSS` is a Git submodule with the [Deep Learning Super-Sampling SDK](https://github.com/NVIDIA/DLSS).

- `External/dxc` is a recent version of DirectX Shader Compiler. However, unlike the other dependencies, it is not a Git submodule but is instead fetched by CMake at project configuration time.

[`Assets/Media`](https://github.com/NVIDIAGameWorks/rtxdi-assets) is a Git submodule containing the [RTXDI SDK Sample Assets](https://github.com/NVIDIAGameWorks/rtxdi-assets).
`Assets/Media` is a Git submodule containing the [RTXDI SDK Sample Assets](https://github.com/NVIDIA-RTX/RTXDI-Assets).


## Building and Running the Sample Apps

**Note** that because the [`rtxdi-assets`](https://github.com/NVIDIAGameWorks/rtxdi-assets) submodule that is cloned into `Assets/Media` uses LFS, cloning it without [LFS](https://git-lfs.com) installed will result in files containing LFS pointers instead of the actual assets.
**Note** that because the [`rtxdi-assets`](https://github.com/NVIDIA-RTX/RTXDI-Assets) submodule that is cloned into `Assets/Media` uses LFS, cloning it without [LFS](https://git-lfs.com) installed will result in files containing LFS pointers instead of the actual assets.

### Windows

1. Install LFS support by following the instructions on [git-lfs.com](https://git-lfs.com)

2. Clone the repository with all submodules:
- `git clone --recursive https://github.com/NVIDIAGameWorks/RTXDI.git`
- `git clone --recursive https://github.com/NVIDIA-RTX/RTXDI.git`

If the clone was made non-recursively and the submodules are missing, clone them separately:

Expand Down Expand Up @@ -74,7 +74,7 @@ For more information about RTXDI, see the [NVIDIA Developer Page](https://develo
- `sudo apt install git-lfs`

3. Clone the repository with all submodules:
- `git clone --recursive https://github.com/NVIDIAGameWorks/RTXDI.git`
- `git clone --recursive https://github.com/NVIDIA-RTX/RTXDI.git`

If the clone was made non-recursively and the submodules are missing, clone them separately:

Expand All @@ -94,12 +94,12 @@ For more information about RTXDI, see the [NVIDIA Developer Page](https://develo

### Vulkan support

The RTXDI sample applications can run using D3D12 or Vulkan, which is achieved through the [NVRHI](https://github.com/NVIDIAGameWorks/nvrhi) rendering API abstraction layer and HLSL shader compilation to SPIR-V through DXC (DirectX Shader Compiler). We deliver a compatible version of DXC through packman. If you wish to use a different (e.g. newer) version of DXC, it can be obtained from [Microsoft/DirectXShaderCompiler](https://github.com/Microsoft/DirectXShaderCompiler) on GitHub. The path to a custom version of DXC can be configured using the `DXC_PATH` and `DXC_SPIRV_PATH` CMake variables.
The RTXDI sample applications can run using D3D12 or Vulkan, which is achieved through the [NVRHI](https://github.com/NVIDIA-RTX/NVRHI) rendering API abstraction layer and HLSL shader compilation to SPIR-V through DXC (DirectX Shader Compiler). We deliver a compatible version of DXC through packman. If you wish to use a different (e.g. newer) version of DXC, it can be obtained from [Microsoft/DirectXShaderCompiler](https://github.com/Microsoft/DirectXShaderCompiler) on GitHub. The path to a custom version of DXC can be configured using the `DXC_PATH` and `DXC_SPIRV_PATH` CMake variables.

By default, the sample apps will run using D3D12 on Windows. To start them in Vulkan mode, add `--vk` to the command line. To compile the sample apps without Vulkan support, set the CMake variable `DONUT_WITH_VULKAN` to `OFF` and re-generate the project.

To enable SPIV-V compileation tests, set the `GLSLANG_PATH` variable in CMake to the path to glslangValidator.exe in your Vulkan installation.

## Integration

See the [Integration Guide](doc/Integration.md).
See the [Integration Guide](Doc/Integration.md).
6 changes: 3 additions & 3 deletions Samples/FullSample/Shaders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ add_custom_target(${shaders_target}
SOURCES ${shaders} Shaders.cfg)

if(TARGET NRD)
set(NRD_OPTIONS -I "${CMAKE_CURRENT_SOURCE_DIR}/../../../external/NRD/Shaders/Include" -D WITH_NRD -D NRD_USE_OCT_NORMAL_ENCODING=0 -D NRD_USE_MATERIAL_ID=0)
set(NRD_OPTIONS -I "${CMAKE_CURRENT_SOURCE_DIR}/../../../external/NRD/Shaders/Include" -D WITH_NRD)
else()
set(NRD_OPTIONS --relaxedInclude NRD.hlsli)
endif()
Expand All @@ -87,7 +87,7 @@ set (OUTPUT_PATH_BASE "${CMAKE_BINARY_DIR}/bin/shaders/full-sample")
endif()

if (DONUT_WITH_DX12)
set(DX12_COMPILER_OPTIONS
set(DX12_COMPILER_OPTIONS
--platform DXIL
--shaderModel 6_5
--binaryBlob
Expand Down Expand Up @@ -130,4 +130,4 @@ if (DONUT_WITH_VULKAN)
endif()

set_target_properties(${shaders_target} PROPERTIES FOLDER ${folder})
set_source_files_properties(${shaders} PROPERTIES VS_TOOL_OVERRIDE "None")
set_source_files_properties(${shaders} PROPERTIES VS_TOOL_OVERRIDE "None")
5 changes: 2 additions & 3 deletions Samples/FullSample/Shaders/CompositingPass.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "GBufferHelpers.hlsli"

#ifdef WITH_NRD
#define NRD_HEADER_ONLY
#include <NRDEncoding.hlsli>
#include <NRD.hlsli>
#endif
Expand Down Expand Up @@ -71,7 +70,7 @@ void main(uint2 globalIdx : SV_DispatchThreadID)
{
denoised_diffuse = REBLUR_BackEnd_UnpackRadianceAndNormHitDist(denoised_diffuse);
denoised_specular = REBLUR_BackEnd_UnpackRadianceAndNormHitDist(denoised_specular);

diffuse_illumination = REBLUR_BackEnd_UnpackRadianceAndNormHitDist(diffuse_illumination);
specular_illumination = REBLUR_BackEnd_UnpackRadianceAndNormHitDist(specular_illumination);
}
Expand All @@ -97,7 +96,7 @@ void main(uint2 globalIdx : SV_DispatchThreadID)
compositedColor += emissive.rgb;
}
else
{
{
RayDesc primaryRay = setupPrimaryRay(globalIdx, g_Const.view);

if (g_Const.enableEnvironmentMap)
Expand Down
12 changes: 5 additions & 7 deletions Samples/FullSample/Shaders/DenoisingPasses/ComputeGradients.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

#include "Rtxdi/DI/Reservoir.hlsli"

#ifdef WITH_NRD
#undef WITH_NRD
#endif

#include "../LightingPasses/ShadingHelpers.hlsli"

Expand All @@ -42,7 +40,7 @@ void RayGen()
int2 selectedPixelPos = -1;
int2 selectedPrevPixelPos = -1;
float2 selectedDiffSpecLum = 0;

// Iterate over all the pixels in the stratum, find one that is likely to produce
// the brightest gradient. That means the pixel that has the brightest color coming
// purely from light sampling in either the current or the previous frame.
Expand All @@ -64,10 +62,10 @@ void RayGen()
// Load the previous frame sampled lighting luminance.
// For invalid gradients, temporalPixelPos is negative, and prevLuminance will be 0
float2 prevLuminance = t_PrevRestirLuminance[temporalReservoirPos];

// Load the current frame sampled lighting luminance.
float2 currLuminance = u_RestirLuminance[srcReservoirPos];

float currMaxLuminance = max(currLuminance.x, currLuminance.y);
float prevMaxLuminance = max(prevLuminance.x, prevLuminance.y);
float selectedMaxLuminance = max(selectedDiffSpecLum.x, selectedDiffSpecLum.y);
Expand Down Expand Up @@ -107,7 +105,7 @@ void RayGen()

// Map the reservoir's light index into the other frame (previous or current)
int selectedMappedLightIndex = RAB_TranslateLightIndex(RTXDI_GetDIReservoirLightIndex(selectedReservoir), !usePrevSample);

if (selectedMappedLightIndex >= 0)
{
// If the mapping was successful, compare the lighting.
Expand Down Expand Up @@ -154,7 +152,7 @@ void RayGen()
// Calculate the sampled lighting luminance for the other surface
float2 newDiffSpecLum = float2(calcLuminance(diffuse * surface.material.diffuseAlbedo), calcLuminance(specular));

// Convert to FP16 and back to avoid false-positive gradients due to precision loss in the
// Convert to FP16 and back to avoid false-positive gradients due to precision loss in the
// u_RestirLuminance and t_PrevRestirLuminance textures where selectedDiffSpecLum comes from.
newDiffSpecLum = f16tof32(f32tof16(newDiffSpecLum));

Expand Down
24 changes: 9 additions & 15 deletions Samples/FullSample/Shaders/LightingPasses/BrdfRayTracing.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@

#include <Rtxdi/DI/Reservoir.hlsli>

#ifdef WITH_NRD
#define NRD_HEADER_ONLY
#include <NRDEncoding.hlsli>
#include <NRD.hlsli>
#endif

#include "ShadingHelpers.hlsli"

static const float c_MaxIndirectRadiance = 10;
Expand All @@ -43,7 +37,7 @@ void RayGen()
return;

RAB_RandomSamplerState rng = RAB_InitRandomSampler(GlobalIndex, 5);

float3 tangent, bitangent;
branchlessONB(surface.normal, tangent, bitangent);

Expand Down Expand Up @@ -122,13 +116,13 @@ void RayGen()
ray.Origin = surface.worldPos;

float3 radiance = 0;

RayPayload payload = (RayPayload)0;
payload.instanceID = ~0u;
payload.throughput = 1.0;

uint instanceMask = INSTANCE_MASK_OPAQUE;

if (g_Const.sceneConstants.enableAlphaTestedGeometry)
instanceMask |= INSTANCE_MASK_ALPHA_TESTED;

Expand All @@ -137,7 +131,7 @@ void RayGen()

#if USE_RAY_QUERY
RayQuery<RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES> rayQuery;

rayQuery.TraceRayInline(SceneBVH, RAY_FLAG_NONE, instanceMask, ray);

while (rayQuery.Proceed())
Expand Down Expand Up @@ -174,8 +168,8 @@ void RayGen()
}

uint gbufferIndex = RTXDI_ReservoirPositionToPointer(g_Const.restirGI.reservoirBufferParams, GlobalIndex, 0);
struct

struct
{
float3 position;
float3 normal;
Expand Down Expand Up @@ -204,7 +198,7 @@ void RayGen()
payload.barycentrics,
GeomAttr_Normal | GeomAttr_TexCoord | GeomAttr_Position,
t_InstanceData, t_GeometryData, t_MaterialConstants);

MaterialSample ms = sampleGeometryMaterial(gs, 0, 0, 0,
MatAttr_BaseColor | MatAttr_Emissive | MatAttr_MetalRough, s_MaterialSampler);

Expand Down Expand Up @@ -273,10 +267,10 @@ void RayGen()
// GI reservoir sample in ShadeSecondarySurface.hlsl. It need to be stored separately.
secondaryGBufferData.emission = radiance;
radiance = 0;

secondaryGBufferData.pdf = overall_PDF;
}

uint flags = 0;
if (isSpecularRay) flags |= kSecondaryGBuffer_IsSpecularRay;
if (isDeltaSurface) flags |= kSecondaryGBuffer_IsDeltaSurface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
#include "Rtxdi/ReGIR/ReGIRSampling.hlsli"
#endif

#ifdef WITH_NRD
#define NRD_HEADER_ONLY
#include <NRDEncoding.hlsli>
#include <NRD.hlsli>
#endif

#include "../ShadingHelpers.hlsli"

#if USE_RAY_QUERY
Expand Down Expand Up @@ -132,7 +126,7 @@ void RayGen()
/* previousFrameTLAS = */ false, /* enableVisibilityReuse = */ true, diffuse, specular, lightDistance);

currLuminance = float2(calcLuminance(diffuse * surface.material.diffuseAlbedo), calcLuminance(specular));

specular = DemodulateSpecular(surface.material.specularF0, specular);
}

Expand All @@ -149,6 +143,6 @@ void RayGen()
}
#endif

StoreShadingOutput(GlobalIndex, pixelPosition,
StoreShadingOutput(GlobalIndex, pixelPosition,
surface.viewDepth, surface.material.roughness, diffuse, specular, lightDistance, true, g_Const.restirDI.shadingParams.enableDenoiserInputPacking);
}
14 changes: 4 additions & 10 deletions Samples/FullSample/Shaders/LightingPasses/DI/ShadeSamples.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
#include "Rtxdi/ReGIR/ReGIRSampling.hlsli"
#endif

#ifdef WITH_NRD
#define NRD_HEADER_ONLY
#include <NRDEncoding.hlsli>
#include <NRD.hlsli>
#endif

#include "../ShadingHelpers.hlsli"

#if USE_RAY_QUERY
Expand Down Expand Up @@ -60,9 +54,9 @@ void RayGen()

bool needToStore = ShadeSurfaceWithLightSample(reservoir, surface, lightSample,
/* previousFrameTLAS = */ false, /* enableVisibilityReuse = */ true, diffuse, specular, lightDistance);

currLuminance = float2(calcLuminance(diffuse * surface.material.diffuseAlbedo), calcLuminance(specular));

specular = DemodulateSpecular(surface.material.specularF0, specular);

if (needToStore)
Expand All @@ -74,14 +68,14 @@ void RayGen()
// Store the sampled lighting luminance for the gradient pass.
// Discard the pixels where the visibility was reused, as gradients need actual visibility.
u_RestirLuminance[GlobalIndex] = currLuminance * (reservoir.age > 0 ? 0 : 1);

#if RTXDI_REGIR_MODE != RTXDI_REGIR_DISABLED
if (g_Const.visualizeRegirCells)
{
diffuse *= RTXDI_VisualizeReGIRCells(g_Const.regir, RAB_GetSurfaceWorldPos(surface));
}
#endif

StoreShadingOutput(GlobalIndex, pixelPosition,
StoreShadingOutput(GlobalIndex, pixelPosition,
surface.viewDepth, surface.material.roughness, diffuse, specular, lightDistance, true, g_Const.restirDI.shadingParams.enableDenoiserInputPacking);
}
Loading