Skip to content

Commit

Permalink
v1.3.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
acmarrs-nvidia committed Dec 8, 2022
1 parent cc39ddd commit 421746e
Show file tree
Hide file tree
Showing 93 changed files with 41,937 additions and 4,092 deletions.
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[submodule "thirdparty/tinygltf"]
path = thirdparty/tinygltf
url = https://github.com/syoyo/tinygltf.git
branch = master
[submodule "thirdparty/imgui"]
path = thirdparty/imgui
url = https://github.com/ocornut/imgui.git
Expand Down
34 changes: 34 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# RTXGI SDK Change Log

## 1.3.5

### SDK
- **Improvements**
- Adds the new **Probe Variability** feature to the ```DDGIVolume```
- This is an optional feature that tracks the [coefficient of variation](https://en.wikipedia.org/wiki/Coefficient_of_variation) of a ```DDGIVolume```
- This can be used to estimate of how converged the probes of the volume are. When the coefficient settles around a small value, it is likely the probes contain representative irradiance values and ray tracing and probe updates can be disabled until an event occurs that invalidates the light field
- See [Probe Variability](docs/DDGIVolume.md#probe-variability) in the documentation for more details
- Adds changes to ```DDGIVolume``` D3D12 resource transitions based on feedback from GitHub Issue #68 (thanks!)
- ```UpdateDDGIVolumes()``` can now be safely used on direct *and* compute command lists
- Irradiance, Distance, and Probe Data resources are now expected to be in the ```D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE``` state by default
- These resources can be transitioned to the required states for each workload using the new ```DDGIVolume::TransitionResources(...)``` function where appropriate (also see ```EDDGIExecutionStage```)

### Test Harness
- **Improvements**
- Adds support for the SDK's new [Probe Variability](docs/DDGIVolume.md#probe-variability) feature, including buffer visualization, UI toggles, and checks to disable/enable probe traces based on volume variability
- Adds support for Shader Execution Reordering in DDGI probe ray tracing and the reference Path Tracer (D3D12 only). Requires an RTX 4000 series (Ada) GPU.
- Adds NVAPI as a new dependency (Test Harness only)
- Improves acceleration structure organization
- Reorganizes how BLAS are created from GLTF2 Mesh and MeshPrimitives
- MeshPrimitives are now geometries of the same BLAS (instead of individual BLAS)
- This prevents bad traversal characteristics when MeshPrimitives create substantially overlapping BLAS and increases trace performance up to 2x
- Adds the GeometryData and MeshOffsets indirection buffers for looking up MeshPrimitive information
- Updates RGS and Hit Shaders to look up MeshPrimitive information using DXR 1.1 GeometryIndex() and the new indirection buffers
- Updates Closest Hit shaders to conform with the [GLTF 2.0 specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#metallic-roughness-material) for how albedo values sampled from texture should be combined with ```baseColorFactor```. Fixes GitHub Issue #67.
- Updates scene cache serialization/deserialization
- Stores new information and now stores a scene cache file for .glb scenes too
- **Bug Fixes**
- Updates DXC binaries to v1.7.2207 (on Windows) to fix a shader compilation issue
- Fixes issues with ```DDGIVolume``` name strings not being handled properly
- Fixes D3D12 resource state problems caught by the debug layer
- Fixes a handful of other minor issues


## 1.3.0

### SDK
Expand Down
81 changes: 76 additions & 5 deletions docs/DDGIVolume.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ struct DDGIVolumeResourceIndices
uint probeDistanceSRVIndex;
uint probeDataUAVIndex;
uint probeDataSRVIndex;
uint probeVariabilityUAVIndex;
uint probeVariabilitySRVIndex;
uint probeVariabilityAverageUAVIndex;
uint probeVariabilityAverageSRVIndex;
};
```

Expand Down Expand Up @@ -222,6 +226,7 @@ The main workloads executed by a ```DDGIVolume``` are implemented in three shade
* ProbeBlendingCS.hlsl
* ProbeRelocationCS.hlsl
* ProbeClassificationCS.hlsl
* ReductionCS.hlsl

To make it possible to directly use the SDK's shader files in your codebase (with or without the RTXGI SDK), shader functionality is configured through shader compiler defines. All shaders support both traditionally bound and bindless resource access methods.

Expand Down Expand Up @@ -334,6 +339,10 @@ The following defines provide SDK shaders with the information necessary to unde
* *D3D12:* the UAV shader register ```X``` and space ```Y``` of the DDGIVolume probe data texture array.
* *Vulkan:* the binding slot ```X``` and descriptor set index ```Y``` of the DDGIVolume probe data texture array.

```PROBE_VARIABILITY_REGISTER [uX|X]``` <br> ```PROBE_VARIABILITY_SPACE [spaceY|Y]```
* *D3D12:* the UAV shader register ```X``` and space ```Y``` of the DDGIVolume probe variability texture array.
* *Vulkan:* the binding slot ```X``` and descriptor set index ```Y``` of the DDGIVolume probe variability texture array.

---

### [```ProbeBlendingCS.hlsl```](../rtxgi-sdk/shaders/ddgi/ProbeBlendingCS.hlsl)
Expand Down Expand Up @@ -438,14 +447,40 @@ struct ProbeRelocationBytecode

---

### [```ReductionCS.hlsl```](../rtxgi-sdk/shaders/ddgi/ReductionCS.hlsl)

This file contains compute shader code that reduces the probe variability texture down to a single value. See [Probe Variability](#probe-variability) for more information.

This shader is used by the ```rtxgi::[d3d12|vulkan]::CalculateDDGIVolumeVariability(...)``` function.

**Compilation Instructions**

This shader file provides two entry points:
- ```DDGIReductionCS()``` - performs initial reduction pass on per-probe-texel variability data.
- ```DDGIExtraReductionCS()``` - if the probe variability texture is too large to reduce down to one value in a single pass, this shader will perform additional reductions and can be run repeatedly until the output reaches a single value.

Pass compiled shader bytecode or pipeline state objects to the `ProbeVariabilityBytecode` or `ProbeVariability[PSO|Pipeline]` structs that corresponds to the entry points in the shader file (see below).

```C++
struct ProbeVariabilityBytecode
{
ShaderBytecode reductionCS; // DDGIReductionCS() entry point
ShaderBytecode extraReductionCS; // DDGIExtraReductionCS() entry point
};
```

---

## Texture Layout

The ```DDGIVolume``` uses four texture arrays to store its data:
The ```DDGIVolume``` uses six texture arrays to store its data:

1. Probe Ray Data
2. Probe Irradiance
3. Probe Distance
4. Probe Data
5. Probe Variability
6. Probe Variability Average

### Probe Ray Data

Expand Down Expand Up @@ -514,6 +549,32 @@ Within a texel:
<figcaption><b>Figure 7: A visualization of the Probe Data texture (zoomed) for the Crytek Sponza scene</b></figcaption>
</figure>

### Probe Variability

This texture array stores the [coefficient of variation](https://en.wikipedia.org/wiki/Coefficient_of_variation) for all probe irradiance texels in a volume used by [Probe Variability](#probe-variability). The texture dimensions and layout are the same as the irradiance texture array ***with probe border texels omitted***. This texture array has a single channel that stores the scalar coefficient of variation value.

Below is a visualization of the texture array. The visualization defines a threshold value, then marks inactive probes in blue, below-threshold values in red, and above-threshold values in green.

<figure>
<img src="images/ddgivolume-textures-probevariability.jpg" width=800px></img>
<figcaption><b>Figure 8: A visualization of the Probe Variability texture array for the Cornell Box scene</b></figcaption>
</figure>

### Probe Variability Average

[Probe Variability](#probe-variability) averages the coefficient of variation of all probes in a volume to generate a single variability value. This texture array stores the intermediate values used in the averaging process. The final average variability value is stored in texel (0, 0) when the reduction passes complete.

This texture array has two channels:
- The averaged coefficient of variation is stored in the R channel
- A weight the reduction shader uses to average contributions from all probes is stored in the G channel

Below is a visualization of the texture array. The visualization defines a threshold value, then marks inactive probes in blue, below-threshold values in red, and above-threshold values in green.

<figure>
<img src="images/ddgivolume-textures-probevariability-avg.jpg" width=400px></img>
<figcaption><b>Figure 9: A visualization of the Probe Variability Average texture for the Cornell Box scene</b></figcaption>
</figure>

### Probe Count Limits

In addition to the available memory of the physical device, the number of probes a volume can contain is bounded by the graphics API's limits on texture (array) resources.
Expand Down Expand Up @@ -636,7 +697,7 @@ Critically, instead of adjusting the position of all probes when the active area

<figure>
<img src="images/ddgivolume-movement-isv.gif" width="700px"></img>
<figcaption><b>Figure 8: Infinite Scrolling Volume Movement</b></figcaption>
<figcaption><b>Figure 10: Infinite Scrolling Volume Movement</b></figcaption>
</figure>

ISVs are also useful when dynamic indirect lighting is desired around the camera view or a player character. Anchor the infinite scrolling volume to the camera view or a player character and use the camera or player's movement to drive the volume's scrolling of the active area.
Expand All @@ -661,7 +722,7 @@ Any regular grid of sampling points will struggle to robustly handle all content
<figure>
<img src="images/ddgivolume-relocation-off.jpg" width=49%></img>
<img src="images/ddgivolume-relocation-on.jpg" width=49%></img>
<figcaption><b>Figure 9: (Left) Probes falling inside wall geometry without probe relocation. (Right) Probes adjusted to a more useful locations with probe relocation enabled.</b></figcaption>
<figcaption><b>Figure 11: (Left) Probes falling inside wall geometry without probe relocation. (Right) Probes adjusted to a more useful locations with probe relocation enabled.</b></figcaption>
</figure>

To use Probe Relocation:
Expand Down Expand Up @@ -692,7 +753,7 @@ Classification is executed in two phases:
<figure>
<img src="images/ddgivolume-classification-01.jpg" width=49%></img>
<img src="images/ddgivolume-classification-02.jpg" width=49%></img>
<figcaption><b>Figure 10: Disabled probes are highlighted with red outlines. Probes inside of geometry or with no surrounding geometry are disabled.</b></figcaption>
<figcaption><b>Figure 12: Disabled probes are highlighted with red outlines. Probes inside of geometry or with no surrounding geometry are disabled.</b></figcaption>
</figure>


Expand All @@ -707,9 +768,19 @@ The number of fixed rays is specified by the ```RTXGI_DDGI_NUM_FIXED_RAYS``` def

<figure>
<img src="images/ddgivolume-fixedRays.gif"></img>
<figcaption><b>Figure 11: The default fixed rays distribution used in probe relocation and classification.</b></figcaption>
<figcaption><b>Figure 13: The default fixed rays distribution used in probe relocation and classification.</b></figcaption>
</figure>

# Probe Variability

It is often the case that the irradiance estimates stored in ```DDGIVolume``` probes contain a non-zero level of variance (per octahedral texel), even after a substantial quantity of samples have been accumulated. In fact, it is possible that **some (or even all) texels of a given probe may never fully converge**. This results in a continuous amount of low frequency noise in indirect lighting estimates computed from a ```DDGIVolume```. While this is not a problem (visually) in a single frame (i.e. the estimate is still reasonable), the low frequency noise *changes randomly* each frame. This produces objectionable temporal artifacts.

To address this problem, ```DDGIVolume``` are now able to track probe variability. Probe Variability measures an average [coefficient of variation](https://en.wikipedia.org/wiki/Coefficient_of_variation) across the volume's probes. This serves as an estimate of how voliatile the volume's estimate of the light field is from one update to the next. As more samples are blended in and probe irradiance estimates improve, the measured variability will decrease towards zero.

Importantly, the **variability value may not ever reach zero**. Instead, probe irradiance estimates eventually settle in a state where the variability stays within a given range. At this point, probes are converged 'enough' and the objectionable low frequency noise can be avoided by pausing probe ray tracing and blending updates for the ```DDGIVolume```. When an event that triggers a change to the volume's light field occurs (e.g. a light or object moves, an explosion occurs, weather changes, etc) ray tracing and blending updates should be re-enabled until the variability measure settles again.

The range and stability of probe variability values depends on several factors including: the extent of the ```DDGIVolume```, the distribution of probes, the number of rays traced per probe, and the light transport characteristics of the scene. As a result, the SDK exposes the measured variability and expects the application to make decisions to handle variability ranges and updates.

# Rules of Thumb

Below are rules of thumb related to ```DDGIVolume``` configuration and how a volume's settings affect the lighting results and content creation.
Expand Down
4 changes: 3 additions & 1 deletion docs/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ At Render-Time
- *Tip:* use the SDK's ```RelocateDDGIVolumeProbes()``` function
5. [**Classify Probes (optional)**](DDGIVolume.md#probe-classification) within relevant, active ```DDGIVolume```s to deactivate tracing and blending operations for probes that do not contribute to the final result
- *Tip:* use the SDK's ```ClassifyDDGIVolumeProbes()``` function
6. [**Query Irradiance**](#querying-irradiance-with-a-ddgivolume) from relevant, active ```DDGIVolume```s to gather indirect lighting in screen-space
6. [**Calculate Variability (optional)**](DDGIVolume.md#probe-variability) within relevant, active ```DDGIVolume```s to generate variability measurements for the current update, then use these values to determine if the volume should remain active or not
- *Tip:* use the SDK's ```CalculateDDGIVolumeVariability()``` and ```ReadbackDDGIVolumeVariability()``` functions
7. [**Query Irradiance**](#querying-irradiance-with-a-ddgivolume) from relevant, active ```DDGIVolume```s to gather indirect lighting in screen-space

### Implementation Details

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 421746e

Please sign in to comment.