Skip to content

Commit

Permalink
* Renamed files to use DI prefix to indicate ReSTIR DI algorithm and …
Browse files Browse the repository at this point in the history
…to match the GI and ReGIR prefixes.

* Moved ReGIR functions out of RTXDIHelpers.hlsli and into a new dedicated ReGIRSampling.hlsli file.
* Added and updated copyright headers
* Updated changelog
  • Loading branch information
SomeNvidiaGuy committed Aug 22, 2023
1 parent 10cca4e commit c4383f4
Show file tree
Hide file tree
Showing 114 changed files with 895 additions and 656 deletions.
25 changes: 25 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# RTXDI SDK Change Log


## 2.1.0

**Release highlights:**

- Major refactor of C++ API that separates the ReSTIR DI, ReGIR, and ReSTIR GI algorithms into distinct contexts.
- Shader functions and structs updated to reflect partition of algorithms.
- Added `ImportanceSamplingContext` class that collects all 3 algorithms into a central class to ensure shared state is properly managed.
- UI redone for the rtxdi-sample project's ReSTIR DI, ReGIR, and ReSTIR GI sections.

**Breaking changes:**

- C++ API changed completely. Algorithms are now organized by a single context each.
- ReSTIR DI reservoir struct renamed from RTXDI_Reservoir to RTXDI_DIReservoir, with corresponding changes to DI reservoir functions.

**Fixed issued:**

- SPIR-V compiler fixes
- UI reorganized to reflect algorithm/code path

**Misc improvements:**

- Decoupled boiling filter, bias correction, and several other settings in ReSTIR DI and ReSTIR GI.
- Broke down ReSTIR DI local light sampling code into smaller functions for easier reuse and expansion.

## 2.0.0

**Release highlights:**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For more information about RTXDI, see the [NVIDIA Developer Page](https://develo
[`rtxdi-sdk`](rtxdi-sdk) contains the SDK source code files that are meant to be included into the application build:

- [`rtxdi-sdk/include`](rtxdi-sdk/include) has the include files, both for host code and for shaders
- [`rtxdi-sdk/include/rtxdi/ResamplingFunctions.hlsli`](rtxdi-sdk/include/rtxdi/ResamplingFunctions.hlsli) is the main shader include file that contains the resampling implementation
- [`rtxdi-sdk/include/rtxdi/DIResamplingFunctions.hlsli`](rtxdi-sdk/include/rtxdi/DIResamplingFunctions.hlsli) is the main shader include file that contains the resampling implementation
- [`rtxdi-sdk/shaders`](rtxdi-sdk/shaders) has the shader files that are supposed to be compiled through whatever means the application normally uses
- [`rtxdi-sdk/src`](rtxdi-sdk/src) has the host code with various utility functions for setting up the parameters and resources for resampling

Expand Down
4 changes: 2 additions & 2 deletions doc/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The algorithms in the RTXDI SDK require a deep integration into the renderer. Th

To avoid making overcomplicated abstractions or restrictive requirements, the RTXDI SDK follows an approach where the application is responsible for all of the above functionality, and RTXDI only provides the light sampling and resampling math that ties into pieces of that functionality through shader callback functions. This makes the integration process fairly involved, but the developers have complete control over the lighting system of their engines and do not have to ship any extra closed-source libraries with it.

The functionality provided by RTXDI can be separated into shader-side and host-side. Shader-side functionality for ReSTIR DI is provided through the [`ResamplingFunctions.hlsli`](../rtxdi-sdk/include/rtxdi/ResamplingFunctions.hlsli) include file and documented in [Shader API Reference](ShaderAPI.md). Host-side functionality is provided through the [`ReSTIRDI.h`](../rtxdi-sdk/include/rtxdi/ReSTIRDI.h) include file and the [`ReSTIRDI.cpp`](../rtxdi-sdk/src/ReSTIRDI.cpp) source file, which together form the `ReSTIRDIContext` class. ReGIR's context lives in [`ReGIR.h`](../rtxdi-sdk/include/rtxdi/ReGIR.h), and ReSTIR GI's context lives in [`ReSTIRGI.h`](../rtxdi-sdk/include/rtxdi/ReSTIRGI.h) Functionality that is shared between these algorithms is located in [`RtxdiUtils.h`](../rtxdi-sdk/include/rtxdi/RtxdiUtils.h).
The functionality provided by RTXDI can be separated into shader-side and host-side. Shader-side functionality for ReSTIR DI is provided through the [`DIResamplingFunctions.hlsli`](../rtxdi-sdk/include/rtxdi/DIResamplingFunctions.hlsli) include file and documented in [Shader API Reference](ShaderAPI.md). Host-side functionality is provided through the [`ReSTIRDI.h`](../rtxdi-sdk/include/rtxdi/ReSTIRDI.h) include file and the [`ReSTIRDI.cpp`](../rtxdi-sdk/src/ReSTIRDI.cpp) source file, which together form the `ReSTIRDIContext` class. ReGIR's context lives in [`ReGIR.h`](../rtxdi-sdk/include/rtxdi/ReGIR.h), and ReSTIR GI's context lives in [`ReSTIRGI.h`](../rtxdi-sdk/include/rtxdi/ReSTIRGI.h) Functionality that is shared between these algorithms is located in [`RtxdiUtils.h`](../rtxdi-sdk/include/rtxdi/RtxdiUtils.h).

The application also needs to provide shader-side and host-side functionality for RTXDI to work. Most importantly, it needs to provide the bridge structures functions, or callbacks, that are used by the RTXDI resampling functions. Those functions' and structures' names start with `RAB_` (for "**R**TXDI-**A**pplication **B**ridge"). For the complete list of functions and structures that need to be implemented, see the [Bridge Reference](RtxdiApplicationBridge.md). Then the application needs to assemble the resampling functions into complete shaders to build the desired pipeline and compile those shaders. Finally, at run time, the application needs to collect the light information, create the necessary buffers, and execute the compiled shaders.

Expand All @@ -51,7 +51,7 @@ The following resources are used by RTXDI sampling and resampling functions, eit
- *PDF (Probability Density Function) textures*: these textures store the probability for each light or each environment map pixel being sampled. See the [PDF texture section](#pdf-textures) for more information.
- *RIS (Resampled Importance Sampling) buffer*: stores results of pre-sampling passes. Each element of the RIS buffer is a `uint2` where the `.x` component stores the light index, and the `.y` component stores the inverse of its selection PDF.
- *RIS light data buffer*: stores information about the lights in each element of the RIS buffer. This buffer is optional and its only purpose is to improve performance by making memory accesses more local in the initial sampling pass.
- *Reservoir buffer*: contains several screen-sized arrays storing one `RTXDI_PackedReservoir` structure per pixel each. The number of these arrays is determined by the complexity of the application's resampling pipeline, and the number of final samples per pixel. For a simple use case when the application is doing spatiotemporal resampling with one spatial pass and one sample per pixel, two arrays are sufficient. To compute the array size, use the `rtxdi::ReSTIRDIContext::getReservoirBufferParameters().reservoirArrayPitch` field and not just the product of screen width and height, because the pixels are stored in the buffer in a block-linear layout.
- *Reservoir buffer*: contains several screen-sized arrays storing one `RTXDI_PackedDIReservoir` structure per pixel each. The number of these arrays is determined by the complexity of the application's resampling pipeline, and the number of final samples per pixel. For a simple use case when the application is doing spatiotemporal resampling with one spatial pass and one sample per pixel, two arrays are sufficient. To compute the array size, use the `rtxdi::ReSTIRDIContext::getReservoirBufferParameters().reservoirArrayPitch` field and not just the product of screen width and height, because the pixels are stored in the buffer in a block-linear layout.

These buffers are created by the sample application but are not used by RTXDI, they are only necessary to prepare the light buffer:

Expand Down
2 changes: 1 addition & 1 deletion doc/RtxdiApplicationBridge.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# RTXDI Application Bridge

The application must implement a number of structures and functions on the shader side that are necessary for the RTXDI resampling functions to operate. These structures and functions must be declared before including the main RTXDI header file, [`ResamplingFunctions.hlsli`](../rtxdi-sdk/include/rtxdi/ResamplingFunctions.hlsli).
The application must implement a number of structures and functions on the shader side that are necessary for the RTXDI resampling functions to operate. These structures and functions must be declared before including the main RTXDI header file, [`DIResamplingFunctions.hlsli`](../rtxdi-sdk/include/rtxdi/DIResamplingFunctions.hlsli).

A reference implementation of the bridge functions and structures with support for multiple light types and fractional visibility (translucency) can be found in [`RtxdiApplicationBridge.hlsli`](../shaders/LightingPasses/RtxdiApplicationBridge.hlsli). This implementation uses some functionality defined in other header files, most notably, polymorphic lights are implemented in [`PolymorphicLight.hlsli`](../shaders/PolymorphicLight.hlsli).

Expand Down
Loading

0 comments on commit c4383f4

Please sign in to comment.