Skip to content

Commit e342942

Browse files
committed
NRD updated to v3.6.0:
- introduced test importance colorization - improved NRD SDK generation script - added clearing of sky pixels - user experience improvements
1 parent 3347152 commit e342942

File tree

7 files changed

+75
-37
lines changed

7 files changed

+75
-37
lines changed

4-Prepare NRD SDK.bat

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ set "no_copy_integration="
1212
:PARSE
1313
if "%~1"=="" goto :MAIN
1414

15-
if /i "%~1"=="-h" goto :HELP
16-
if /i "%~1"=="--help" goto :HELP
17-
18-
if /i "%~1"=="--no-pause" set "use_pause="
15+
if /i "%~1"=="-h" goto :HELP
16+
if /i "%~1"=="--help" goto :HELP
1917

20-
if /i "%~1"=="--copy-shaders" set "copy_shaders=y"
21-
if /i "%~1"=="--no-copy-shaders" set "no_copy_shaders=y"
18+
if /i "%~1"=="--no-pause" set "use_pause="
2219

23-
if /i "%~1"=="--integration" set "copy_integration=y"
24-
if /i "%~1"=="--no-integration" set "no_copy_integration=y"
20+
if /i "%~1"=="--shaders" set "copy_shaders=y"
21+
if /i "%~1"=="--no-shaders" set "no_copy_shaders=y"
22+
23+
if /i "%~1"=="--integration" set "copy_integration=y"
24+
if /i "%~1"=="--no-integration" set "no_copy_integration=y"
2525

2626
shift
2727
goto :PARSE
@@ -31,42 +31,49 @@ goto :PARSE
3131
rd /q /s "_NRD_SDK"
3232

3333
mkdir "_NRD_SDK\Include"
34-
mkdir "_NRD_SDK\Integration"
3534
mkdir "_NRD_SDK\Lib\Debug"
3635
mkdir "_NRD_SDK\Lib\Release"
36+
mkdir "_NRD_SDK\Shaders"
37+
mkdir "_NRD_SDK\Shaders\Include"
3738

3839
cd "_NRD_SDK"
3940

40-
copy "..\%NRD_DIR%\Integration\*" "Integration"
4141
copy "..\%NRD_DIR%\Include\*" "Include"
4242
copy "..\_Build\Debug\NRD.dll" "Lib\Debug"
4343
copy "..\_Build\Debug\NRD.lib" "Lib\Debug"
4444
copy "..\_Build\Debug\NRD.pdb" "Lib\Debug"
4545
copy "..\_Build\Release\NRD.dll" "Lib\Release"
4646
copy "..\_Build\Release\NRD.lib" "Lib\Release"
47+
copy "..\%NRD_DIR%\Shaders\Include\NRD.hlsli" "Shaders\Include"
4748
copy "..\%NRD_DIR%\LICENSE.txt" "."
4849
copy "..\%NRD_DIR%\README.md" "."
4950

5051
echo.
5152
if defined copy_shaders goto :SHADERS
52-
if defined no_copy_shaders goto :NRI
53+
if defined no_copy_shaders goto :PRE_INTEGRATION
5354
set /P M=Do you need the shader source code for a white-box integration? [y/n]
54-
if /I "%M%" neq "y" goto :NRI
55+
if /I "%M%" neq "y" goto :PRE_INTEGRATION
5556

5657
:SHADERS
58+
5759
mkdir "Shaders"
5860

59-
xcopy "..\%NRD_DIR%\Shaders\" "Shaders" /s
61+
xcopy "..\%NRD_DIR%\Shaders\" "Shaders" /s /y
6062
copy "..\%NRD_DIR%\External\MathLib\*.hlsli" "Shaders\Source"
6163

64+
:PRE_INTEGRATION
6265

6366
echo.
64-
if defined copy_integration goto :NRI
67+
if defined copy_integration goto :INTEGRATION
6568
if defined no_copy_integration goto :END
66-
set /P M=Do you need NRI required for NRDIntegration? [y/n]
69+
set /P M=Do you need NRD integration layer? [y/n]
6770
if /I "%M%" neq "y" goto :END
6871

69-
:NRI
72+
:INTEGRATION
73+
74+
mkdir "Integration"
75+
copy "..\%NRD_DIR%\Integration\*" "Integration"
76+
7077
cd ..
7178

7279
rd /q /s "_NRI_SDK"
@@ -95,9 +102,12 @@ if defined use_pause pause
95102
exit /b %errorlevel%
96103

97104
:HELP
105+
98106
echo. -h, --help show help message
99-
echo. --no-pause skip pause in the end of script
100-
echo. -s, --copy-shaders copy shadres for a white-box integration
101-
echo. -i, --integration copy NRDIntegration
102-
exit
107+
echo. --no-pause skip pause at the end of the script
108+
echo. --shaders copy shaders for a white-box integration
109+
echo. --no-shaders do not copy shaders for a white-box integration
110+
echo. --integration copy NRD integration layer
111+
echo. --no-integration do not copy NRD integration layer
103112

113+
exit

4-Prepare NRD SDK.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ NRI_DIR=External/NRIFramework/External/NRI
66
rm -rf "_NRD_SDK"
77

88
mkdir -p "_NRD_SDK/Include"
9-
mkdir -p "_NRD_SDK/Integration"
109
mkdir -p "_NRD_SDK/Lib/Debug"
1110
mkdir -p "_NRD_SDK/Lib/Release"
11+
mkdir -p "_NRD_SDK/Shaders"
12+
mkdir -p "_NRD_SDK/Shaders/Include"
1213

1314
cd "_NRD_SDK"
1415

15-
cp -r ../$NRD_DIR/Integration/ "Integration"
1616
cp -r ../$NRD_DIR/Include/ "Include"
1717
cp -H ../_Build/Debug/libNRD.so "Lib/Debug"
1818
cp -H ../_Build/Release/libNRD.so "Lib/Release"
19+
cp ../$NRD_DIR/Shaders/Include/NRD.hlsli "Shaders/Include"
1920
cp ../$NRD_DIR/LICENSE.txt "."
2021
cp ../$NRD_DIR/README.md "."
2122

@@ -31,19 +32,23 @@ fi
3132

3233
cd ..
3334

34-
read -p "Do you need NRI required for NRDIntegration? [y/n]" -n 1 -r
35+
read -p "Do you need NRD integration layer? [y/n]" -n 1 -r
3536
echo
3637
if [[ $REPLY =~ ^[Yy]$ ]]
3738
then
39+
mkdir -p "_NRD_SDK/Integration"
40+
cp -r $NRD_DIR/Integration/ "_NRD_SDK/Integration"
41+
3842
rm -rf "_NRI_SDK"
3943

40-
mkdir -p "_NRI_SDK/Include"
44+
mkdir -p "_NRI_SDK/Include/Extensions"
4145
mkdir -p "_NRI_SDK/Lib/Debug"
4246
mkdir -p "_NRI_SDK/Lib/Release"
4347

4448
cd "_NRI_SDK"
4549

4650
cp -r ../$NRI_DIR/Include/ "Include"
51+
cp -r ../$NRI_DIR/Include/Extensions/ "Include/Extensions"
4752
cp -H ../_Build/Debug/libNRI.so "Lib/Debug"
4853
cp -H ../_Build/Release/libNRI.so "Lib/Release"
4954
cp ../$NRI_DIR/LICENSE.txt "."

External/NRD

Submodule NRD updated from 39b7ae9 to 247382b

External/NRIFramework

Shaders/IndirectRays.cs.hlsl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ TraceOpaqueResult TraceOpaque( TraceOpaqueDesc desc )
270270
else
271271
{
272272
// Generate a ray
273-
float trimmingFactor = NRD_GetTrimmingFactor( materialProps.roughness, gTrimmingParams );
273+
float trimmingFactor = gTrimmingParams.x * STL::Math::SmoothStep( gTrimmingParams.y, gTrimmingParams.z, materialProps.roughness );
274274
float3 Vlocal = STL::Geometry::RotateVector( mLocalBasis, -geometryProps.rayDirection );
275275

276276
float3 Hlocal = STL::ImportanceSampling::VNDF::GetRay( rnd, materialProps.roughness, Vlocal, trimmingFactor );
@@ -487,6 +487,9 @@ void main( uint2 pixelPos : SV_DispatchThreadId )
487487
gOut_Diff[ outPixelPos ] = 0;
488488
gOut_Spec[ outPixelPos ] = 0;
489489

490+
gOut_DiffDirectionPdf[ outPixelPos ] = 0;
491+
gOut_SpecDirectionPdf[ outPixelPos ] = 0;
492+
490493
return;
491494
}
492495

Source/NRDSample.cpp

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ constexpr float NEAR_Z = 0.001f; // m
5151
constexpr bool CAMERA_RELATIVE = true;
5252
constexpr bool CAMERA_LEFT_HANDED = true;
5353

54+
// Important tests, sensitive to regressions or just testing base functionality
55+
std::vector<uint32_t> checkMeTests =
56+
{{
57+
1, 6, 8, 9, 10, 12, 13, 14, 23, 27, 28,
58+
29, 31, 32, 35, 43, 44, 47, 53, 59, 60,
59+
62, 67, 75, 79, 95, 109, 110, 114, 120,
60+
124, 126, 127, 139, 140, 145, 148, 155,
61+
156, 157, 160, 161, 162,
62+
}};
63+
64+
// Tests, where IQ improvement would be "nice to have"
65+
std::vector<uint32_t> improveMeTests =
66+
{{
67+
3, 76, 96, 134, 150, 153, 158,
68+
}};
69+
5470
//=================================================================================
5571

5672
constexpr uint32_t TEXTURES_PER_MATERIAL = 4;
@@ -602,7 +618,6 @@ class Sample : public SampleBase
602618

603619
inline float3 GetSpecularLobeTrimming() const
604620
{
605-
// See NRDSettings.h - it's a good start
606621
return m_Settings.specularLobeTrimming ? float3(0.95f, 0.04f, 0.11f) : float3(1.0f, 0.0f, 0.0001f);
607622
}
608623

@@ -1772,11 +1787,19 @@ void Sample::PrepareFrame(uint32_t frameIndex)
17721787
if (i % 14 != 0)
17731788
ImGui::SameLine();
17741789

1775-
bool cmp = i == m_LastSelectedTest;
1776-
if (cmp)
1777-
ImGui::PushStyleColor(ImGuiCol_Text, UI_GREEN);
1790+
bool isColorChanged = false;
1791+
if(std::find(improveMeTests.begin(), improveMeTests.end(), i + 1) != improveMeTests.end())
1792+
{
1793+
ImGui::PushStyleColor(ImGuiCol_Text, UI_RED);
1794+
isColorChanged = true;
1795+
}
1796+
else if(std::find(checkMeTests.begin(), checkMeTests.end(), i + 1) != checkMeTests.end())
1797+
{
1798+
ImGui::PushStyleColor(ImGuiCol_Text, UI_YELLOW);
1799+
isColorChanged = true;
1800+
}
17781801

1779-
if (ImGui::Button(s, ImVec2(25.0f, 0.0f)) || isTestChanged)
1802+
if (ImGui::Button(i == m_LastSelectedTest ? "*" : s, ImVec2(25.0f, 0.0f)) || isTestChanged)
17801803
{
17811804
uint32_t test = isTestChanged ? m_LastSelectedTest : i;
17821805
FILE* fp = fopen(path.c_str(), "rb");
@@ -1809,7 +1832,7 @@ void Sample::PrepareFrame(uint32_t frameIndex)
18091832
isTestChanged = false;
18101833
}
18111834

1812-
if (cmp)
1835+
if (isColorChanged)
18131836
ImGui::PopStyleColor();
18141837
}
18151838

@@ -3717,7 +3740,7 @@ void Sample::RenderFrame(uint32_t frameIndex)
37173740
bool isFastHistoryEnabled = m_Settings.maxAccumulatedFrameNum > m_Settings.maxFastAccumulatedFrameNum;
37183741

37193742
float fps = 1000.0f / m_Timer.GetSmoothedElapsedTime();
3720-
float maxAccumulatedFrameNum = Clamp(ACCUMULATION_TIME * fps, 1.0f, float(MAX_HISTORY_FRAME_NUM));
3743+
float maxAccumulatedFrameNum = Clamp(ACCUMULATION_TIME * fps, 5.0f, float(MAX_HISTORY_FRAME_NUM));
37213744
float maxFastAccumulatedFrameNum = isFastHistoryEnabled ? (maxAccumulatedFrameNum / 5.0f) : float(MAX_HISTORY_FRAME_NUM);
37223745

37233746
m_Settings.maxAccumulatedFrameNum = int32_t(maxAccumulatedFrameNum + 0.5f);
@@ -3978,9 +4001,6 @@ void Sample::RenderFrame(uint32_t frameIndex)
39784001

39794002
if (m_Settings.denoiser == REBLUR || m_Settings.denoiser == REFERENCE)
39804003
{
3981-
const float3 trimmingParams = GetSpecularLobeTrimming();
3982-
m_ReblurSettings.specularLobeTrimmingParameters = {trimmingParams.x, trimmingParams.y, trimmingParams.z};
3983-
39844004
nrd::HitDistanceParameters hitDistanceParameters = {};
39854005
hitDistanceParameters.A = m_Settings.hitDistScale * m_Settings.meterToUnitsMultiplier;
39864006
m_ReblurSettings.hitDistanceParameters = hitDistanceParameters;

Tests/BistroInterior.bin

3.13 KB
Binary file not shown.

0 commit comments

Comments
 (0)