Skip to content

Commit

Permalink
v1.2.04 updates
Browse files Browse the repository at this point in the history
- Fixed regressions related to distance values sampled from probe distance textures
- Relative paths defined in configuration .ini files are now interpreted as relative to the ```.ini``` file, instead of the Visual Studio working directory. This should be easier to use than the previous behavior.
- CMake: the nvidia.jpg copy operations now use CMAKE_BINARY_DIR
- Bumped SDK revision number and version string
- Added version number and version string assert checks during DDGI initialization
- Updated documentation with DDGIVolume Rules of Thumb
  • Loading branch information
acmarrs-nvidia committed Jan 11, 2022
1 parent 6757615 commit 8b6e70d
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 27 deletions.
24 changes: 24 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# RTXGI SDK Change Log

## 1.2.04

### SDK

Features and Improvements:
- Bumped SDK revision number and version string
- Updated copyright dates

Bug Fixes:
- Fixed regression related to distance values sampled from probe distance textures

### Test Harness

Features and Improvements:
- Relative paths defined in configuration ```.ini``` files are now interpreted as relative to the ```.ini``` file, instead of the Visual Studio working directory
- This should be easier to use than the previous behavior
- CMake: the ```nvidia.jpg``` copy operations now use ```CMAKE_BINARY_DIR```
- Added version number and version string assert checks during DDGI initialization
- Updated documentation with DDGIVolume Rules of Thumb
- Updated copyright dates

Bug Fixes:
- Fixed regression related to distance values sampled from probe distance textures

## 1.2.0

### SDK
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ The RTXGI SDK and sample application(s) require the following hardware and softw

### Hardware
* Any DXR capable GPU. NVIDIA DXR enabled GPUs are:
* RTX 3090, 3080 Ti, 3080, 3070 Ti, 3070, 3060 Ti, 3060
* RTX 3090 Ti, 3090, 3080 Ti, 3080, 3070 Ti, 3070, 3060 Ti, 3060, 3050
* Titan RTX
* RTX 2080 Ti, 2080 SUPER, 2080, 2070 SUPER, 2070, 2060 SUPER, 2060
* GTX 1660 Ti, 1660 SUPER, 1660
* GTX 1080 Ti, 1080, 1070, 1060 6GB (or higher)
* Titan Xp
* GTX 1080 Ti, 1080, 1070 Ti, 1070, 1060 Ti, 1060 6GB (or higher)

### Software (Windows)
* Windows 10 v1809 or higher
Expand Down
29 changes: 28 additions & 1 deletion docs/DDGIVolume.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ The following sections cover how to use the ```DDGIVolume``` and detail how its
**Step 1:** to create a new ```DDGIVolume```, start by filling out a ```rtxgi::DDGIVolumeDesc``` structure.

- All properties of the descriptor struct are explained in [DDGIVolume.h](../rtxgi-sdk/include/rtxgi/ddgi/DDGIVolume.h#L51-124).

- Example usage is shown in ```GetDDGIVolumeDesc()``` of [DDGI_D3D12.cpp](../samples/test-harness/src/graphics/DDGI_D3D12.cpp) and [DDGI_VK.cpp](../samples/test-harness/src/graphics/DDGI_VK.cpp).

**Probe Irradiance Gamma**
Expand Down Expand Up @@ -489,3 +488,31 @@ The number of fixed rays is specified by the ```RTXGI_DDGI_NUM_FIXED_RAYS``` def
<img src="images/ddgivolume-fixedRays.gif"></img>
<figcaption><b>Figure 10: The default fixed rays distribution used in probe relocation and classification.</b></figcaption>
</figure>

## 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.

### Geometry Configuration

- To achieve proper occlusion results from DDGI, **avoid representing walls with zero thickness planes**.
- Walls should have a "thickness" that is proportional to the probe density of the containing ```DDGIVolume```.
- If walls are too thin relative to the volume's probe density, you will observe **light leaking**.
- The planes that walls consist of should be **single-sided**.
- The probe relocation and probe classification features track backfaces in order to make decisions.

### Probe Density and Counts

- High probe counts within a volume are usually not necessary (with properly configured wall geometry).
- **We recommend a probe every 2-3 meters for typical use cases.**
- Sparse probe grids can often produce better visual results than dense probe grids, since dense probes grids localize the effect of each probe and can (at times) reveal the structure of the probe grid.
- When in doubt, use the minimum number of probes necessary to get the desired result.

### View Bias

- If light leaking occurs - and zero thickness planes are not used for walls - the volume's ```probeViewBias``` value probably needs to be adjusted.
- **Reminder:** ```probeViewBias``` is a world-space offset along the camera view ray applied to the shaded surface point to avoid numerical instabilities when determining visibility.
- Increasing the ```probeViewBias``` value pushes the shaded point away from the surface and further into the probe's voxel, where the variance of the probe's mean distance values is lower.
- Since ```probeViewBias``` is a world-space value, scene scale matters! As a result, **the SDK's default value likely won't be what your content requires**.


6 changes: 3 additions & 3 deletions rtxgi-sdk/include/rtxgi/Common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand All @@ -20,11 +20,11 @@ namespace rtxgi
{
static const int major = 1;
static const int minor = 2;
static const int revision = 0;
static const int revision = 4;

inline static const char* getVersionString()
{
return "1.2.00";
return "1.2.04";
}
};

Expand Down
4 changes: 2 additions & 2 deletions rtxgi-sdk/shaders/ddgi/Irradiance.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -138,7 +138,7 @@ float3 DDGIGetVolumeIrradiance(
float2 probeTextureUV = DDGIGetProbeUV(adjacentProbeIndex, octantCoords, volume.probeNumDistanceTexels, volume);

// Sample the probe's distance texture to get the mean distance to nearby surfaces
float2 filteredDistance = resources.probeDistance.SampleLevel(resources.bilinearSampler, probeTextureUV, 0).rg;
float2 filteredDistance = 2.f * resources.probeDistance.SampleLevel(resources.bilinearSampler, probeTextureUV, 0).rg;

// Find the variance of the mean distance
float variance = abs((filteredDistance.x * filteredDistance.x) - filteredDistance.y);
Expand Down
10 changes: 5 additions & 5 deletions rtxgi-sdk/shaders/ddgi/ProbeBlendingCS.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -550,10 +550,6 @@ void DDGIProbeBlendingCS(uint3 DispatchThreadID : SV_DispatchThreadID, uint Grou
#endif // RTXGI_DDGI_BLEND_RADIANCE
}

// Normalize the blended irradiance (or filtered distance), if the combined weight is not close to zero.
// To match the Monte Carlo Estimator for Irradiance, we should divide by N. Instead, we are dividing by
// N * sum(cos(theta)) (the sum of the weights) to reduce variance.
// To account for this, we must mulitply in a factor of 1/2.
float epsilon = float(volume.probeNumRays);
if (volume.probeRelocationEnabled || volume.probeClassificationEnabled)
{
Expand All @@ -562,6 +558,10 @@ void DDGIProbeBlendingCS(uint3 DispatchThreadID : SV_DispatchThreadID, uint Grou
}
epsilon *= 1e-9f;

// Normalize the blended irradiance (or filtered distance), if the combined weight is not close to zero.
// To match the Monte Carlo Estimator, we should divide by N. Instead, we are dividing by
// N * sum(cos(theta)) (the sum of the weights) to reduce variance.
// To account for this, we must multiply in a factor of 1/2.
result.rgb *= 1.f / (2.f * max(result.a, epsilon));

float hysteresis = volume.probeHysteresis;
Expand Down
10 changes: 5 additions & 5 deletions samples/test-harness/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -496,7 +496,7 @@ if(WIN32 AND RTXGI_API_D3D12_ENABLE)
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RTXGI_API_D3D12_DXIL_PATH}/dxil.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/d3d12/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/dxc/bin/dxcompiler.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/d3d12/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/d3d12/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${ROOT_DIR}/build/samples/test-harness/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_BINARY_DIR}/samples/test-harness/
)
endif()

Expand All @@ -505,7 +505,7 @@ if(WIN32 AND RTXGI_API_VULKAN_ENABLE)
add_custom_command( TARGET TestHarness-VK POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/dxc/bin/dxcompiler.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/vulkan/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/vulkan/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${ROOT_DIR}/build/samples/test-harness/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_BINARY_DIR}/samples/test-harness/
)
endif()

Expand All @@ -516,14 +516,14 @@ if(UNIX AND RTXGI_API_VULKAN_ENABLE)
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/dxc/lib/libdxcompiler.so ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/vulkan/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/dxc/lib/libdxcompiler.so ${CMAKE_SOURCE_DIR}/build/samples/test-harness
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/vulkan/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${ROOT_DIR}/build/samples/test-harness
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_BINARY_DIR}/samples/test-harness
)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
add_custom_command( TARGET TestHarness-VK POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/dxc/lib/libdxcompiler.so ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/vulkan/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/dxc/lib/libdxcompiler.so ${CMAKE_SOURCE_DIR}/build/samples/test-harness
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/vulkan/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${ROOT_DIR}/build/samples/test-harness
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ROOT_DIR}/docs/nvidia.jpg ${CMAKE_BINARY_DIR}/samples/test-harness
)
endif()
endif()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -69,7 +69,7 @@ float3 GetProbeData(uint volumeIndex, int probeIndex, int3 probeCoords, float3 w
float2 uv = DDGIGetProbeUV(probeIndex, octantCoords, volume.probeNumDistanceTexels, volume);

// Sample the distance texture and reconstruct the depth
float distance = ProbeDistance.SampleLevel(BilinearWrapSampler, uv, 0).r;
float distance = 2.f * ProbeDistance.SampleLevel(BilinearWrapSampler, uv, 0).r;

// Normalize the distance for visualization
float value = saturate(distance / GetGlobalConst(ddgivis, distanceDivisor));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -103,7 +103,7 @@ void CS(uint3 DispatchThreadID : SV_DispatchThreadID)

// Sample the distance texture
coords = float2(DispatchThreadID.x, (DispatchThreadID.y - ymin)) / distanceRect.xy;
color.r = (ProbeDistance.SampleLevel(PointClampSampler, coords, 0).r) / GetGlobalConst(ddgivis, distanceTextureScale);
color.r = (2.f * ProbeDistance.SampleLevel(PointClampSampler, coords, 0).r) / GetGlobalConst(ddgivis, distanceTextureScale);

// Normalize for display
color.r = saturate(color.r / GetGlobalConst(ddgivis, distanceDivisor));
Expand Down
21 changes: 18 additions & 3 deletions samples/test-harness/src/Configs.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand All @@ -12,6 +12,7 @@

#include <sstream>
#include <stdlib.h>
#include <filesystem>

#define PARSE_CHECK(statement, lineNumber, log) { if(!statement) { log << "\nFailed to parse config file at line " << lineNumber; return false; } }

Expand Down Expand Up @@ -438,8 +439,22 @@ namespace Configs
if (tokens[1].compare("vsync") == 0) { Store(data, config.app.vsync); return true; }
if (tokens[1].compare("fullscreen") == 0) { Store(data, config.app.fullscreen); return true; }
if (tokens[1].compare("showUI") == 0) { Store(data, config.app.showUI); return true; }
if (tokens[1].compare("root") == 0) { config.app.root = data; return true; }
if (tokens[1].compare("rtxgiSDK") == 0) { config.app.rtxgi = data; return true; }
if (tokens[1].compare("root") == 0)
{
std::filesystem::path configFilePath(config.app.filepath);
std::filesystem::path appRootRelativeToConfig(data);
std::filesystem::path appRootRelativeToRunDirectory = configFilePath.parent_path() / appRootRelativeToConfig;
config.app.root = appRootRelativeToRunDirectory.lexically_normal().string();
return true;
}
if (tokens[1].compare("rtxgiSDK") == 0)
{
std::filesystem::path configFilePath(config.app.filepath);
std::filesystem::path sdkRootRelativeToConfig(data);
std::filesystem::path sdkRootrelativeToRunDirectory = configFilePath.parent_path() / sdkRootRelativeToConfig;
config.app.rtxgi = sdkRootrelativeToRunDirectory.lexically_normal().string();
return true;
}
if (tokens[1].compare("title") == 0) { config.app.title = data; return true; }

if (tokens[1].compare("renderMode") == 0) {
Expand Down
8 changes: 7 additions & 1 deletion samples/test-harness/src/graphics/DDGI_D3D12.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -937,6 +937,12 @@ namespace Graphics
*/
bool Initialize(Globals& d3d, GlobalResources& d3dResources, Resources& resources, const Configs::Config& config, Instrumentation::Performance& perf, std::ofstream& log)
{
// Validate the SDK version
assert(RTXGI_VERSION::major == 1);
assert(RTXGI_VERSION::minor == 2);
assert(RTXGI_VERSION::revision == 4);
assert(std::strcmp(RTXGI_VERSION::getVersionString(), "1.2.04") == 0);

UINT numVolumes = static_cast<UINT>(config.ddgi.volumes.size());

if (!CreateTextures(d3d, d3dResources, resources, log)) return false;
Expand Down
8 changes: 7 additions & 1 deletion samples/test-harness/src/graphics/DDGI_VK.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -1364,6 +1364,12 @@ namespace Graphics
*/
bool Initialize(Globals& vk, GlobalResources& vkResources, Resources& resources, const Configs::Config& config, Instrumentation::Performance& perf, std::ofstream& log)
{
// Validate the SDK version
assert(RTXGI_VERSION::major == 1);
assert(RTXGI_VERSION::minor == 2);
assert(RTXGI_VERSION::revision == 4);
assert(std::strcmp(RTXGI_VERSION::getVersionString(), "1.2.04") == 0);

// Reset the command list before initialization
CHECK(ResetCmdList(vk), "reset command list!", log);

Expand Down

0 comments on commit 8b6e70d

Please sign in to comment.