Skip to content

Commit 7f7e8fa

Browse files
Merge branch 'master' into master
2 parents 496e6eb + 92105f7 commit 7f7e8fa

File tree

9 files changed

+45
-20
lines changed

9 files changed

+45
-20
lines changed

Samples/Atmosphere/src/AtmosphereSample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "MapHelper.hpp"
3434
#include "GraphicsUtilities.h"
3535
#include "imgui.h"
36-
#include "imGuIZMO.h"
36+
#include "../imGuIZMO.quat/imGuIZMO.h"
3737
#include "PlatformMisc.hpp"
3838
#include "ImGuiUtils.hpp"
3939

Samples/GLTFViewer/src/GLTFViewer.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "ShaderMacroHelper.hpp"
3838
#include "FileSystem.hpp"
3939
#include "imgui.h"
40-
#include "imGuIZMO.h"
40+
#include "../imGuIZMO.quat/imGuIZMO.h"
4141
#include "ImGuiUtils.hpp"
4242
#include "CallbackWrapper.hpp"
4343
#include "CommandLineParser.hpp"
@@ -427,6 +427,18 @@ struct PSOutput
427427
}
428428

429429
static constexpr char EnvMapPSMain[] = R"(
430+
void main(in float4 Pos : SV_Position,
431+
in float4 ClipPos : CLIP_POS,
432+
out float4 Color : SV_Target0,
433+
out float4 MotionVec : SV_Target4)
434+
{
435+
SampleEnvMapOutput EnvMap = SampleEnvMap(ClipPos);
436+
Color = EnvMap.Color;
437+
MotionVec = float4(EnvMap.MotionVector, 0.0, 1.0);
438+
}
439+
)";
440+
441+
static constexpr char EnvMapPSMainGL[] = R"(
430442
void main(in float4 Pos : SV_Position,
431443
in float4 ClipPos : CLIP_POS,
432444
out float4 Color : SV_Target0,
@@ -436,12 +448,12 @@ void main(in float4 Pos : SV_Position,
436448
out float4 MotionVec : SV_Target4,
437449
out float4 SpecularIBL : SV_Target5)
438450
{
439-
Color = SampleEnvMap(ClipPos);
440-
451+
SampleEnvMapOutput EnvMap = SampleEnvMap(ClipPos);
452+
Color = EnvMap.Color;
441453
Normal = float4(0.0, 0.0, 0.0, 0.0);
442454
BaseColor = float4(0.0, 0.0, 0.0, 0.0);
443455
MaterialData = float4(0.0, 0.0, 0.0, 0.0);
444-
MotionVec = float4(0.0, 0.0, 0.0, 0.0);
456+
MotionVec = float4(EnvMap.MotionVector, 0.0, 1.0);
445457
SpecularIBL = float4(0.0, 0.0, 0.0, 0.0);
446458
}
447459
)";
@@ -539,8 +551,12 @@ void GLTFViewer::CrateEnvMapRenderer()
539551

540552
if (m_pDevice->GetDeviceInfo().IsGLDevice())
541553
{
542-
// Normally, environment map shader does not need to write to other targets.
554+
// Normally, environment map shader only needs to write color and motion vector.
543555
// However, on WebGL this results in errors.
556+
EnvMapRendererCI.PSMainSource = EnvMapPSMainGL;
557+
}
558+
else
559+
{
544560
EnvMapRendererCI.PSMainSource = EnvMapPSMain;
545561
}
546562
}
@@ -1197,8 +1213,9 @@ void GLTFViewer::Render()
11971213
EnvMapAttribs.MipLevel = m_EnvMapMipLevel;
11981214
// It is essential to write zero alpha because we use alpha channel
11991215
// to attenuate SSR for transparent surfaces.
1200-
EnvMapAttribs.Alpha = 0.0;
1201-
EnvMapAttribs.ConvertOutputToSRGB = (m_RenderParams.Flags & GLTF_PBR_Renderer::PSO_FLAG_CONVERT_OUTPUT_TO_SRGB) != 0;
1216+
EnvMapAttribs.Alpha = 0.0;
1217+
EnvMapAttribs.ConvertOutputToSRGB = (m_RenderParams.Flags & GLTF_PBR_Renderer::PSO_FLAG_CONVERT_OUTPUT_TO_SRGB) != 0;
1218+
EnvMapAttribs.ComputeMotionVectors = m_bEnablePostProcessing;
12021219

12031220
m_EnvMapRenderer->Render(EnvMapAttribs, TMAttribs);
12041221
}
@@ -1274,7 +1291,7 @@ void GLTFViewer::Render()
12741291
Attribs.pContext = m_pImmediateContext;
12751292
Attribs.GridSize = {SCDesc.Width / 20, SCDesc.Height / 20};
12761293
// Render motion vectors in the opposite direction
1277-
Attribs.Scale = float2{-0.05f} / std::max(m_ElapsedTime, 0.001f);
1294+
Attribs.Scale = float2{-0.01f} / std::max(m_ElapsedTime, 0.001f);
12781295
Attribs.StartColor = float4{1};
12791296
Attribs.EndColor = float4{0.5, 0.5, 0.5, 1.0};
12801297
Attribs.ConvertOutputToSRGB = (SCDesc.ColorBufferFormat == TEX_FORMAT_RGBA8_UNORM || SCDesc.ColorBufferFormat == TEX_FORMAT_BGRA8_UNORM);

Samples/Shadows/src/ShadowsSample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "GraphicsUtilities.h"
3535
#include "AdvancedMath.hpp"
3636
#include "imgui.h"
37-
#include "imGuIZMO.h"
37+
#include "../imGuIZMO.quat/imGuIZMO.h"
3838
#include "ImGuiUtils.hpp"
3939
#include "CallbackWrapper.hpp"
4040
#include "Utilities/interface/DiligentFXShaderSourceStreamFactory.hpp"

Samples/USDViewer/src/USDViewer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ void USDViewer::LoadStage()
294294
m_PostProcessParams = {};
295295
m_PostProcessParams.ToneMappingMode = TONE_MAPPING_MODE_UNCHARTED2;
296296
m_PostProcessParams.ConvertOutputToSRGB = m_ConvertPSOutputToGamma;
297+
m_PostProcessParams.EnableTAA = true;
297298
m_Stage.TaskManager->SetPostProcessParams(m_PostProcessParams);
298299

299300
const pxr::TfToken UpAxis = pxr::UsdGeomGetStageUpAxis(m_Stage.Stage);
@@ -468,6 +469,8 @@ void USDViewer::EditSelectedPrimTransform()
468469
// New local matrix is the delta between new global matrix and parent global matrix
469470
float4x4 NewLocalMatrix = NewGlobalMatrix * ParentGlobalMatrix.Inverse();
470471
XFormable.MakeMatrixXform().Set(USD::ToGfMatrix4d(NewLocalMatrix));
472+
// For now, reset TAA when the transform changes
473+
m_Stage.TaskManager->ResetTAA();
471474
}
472475
}
473476

@@ -640,6 +643,11 @@ void USDViewer::UpdateUI()
640643
}
641644
}
642645

646+
if (ImGui::Checkbox("Enable TAA", &m_PostProcessParams.EnableTAA))
647+
{
648+
UpdatePostProcessParams = true;
649+
}
650+
643651
ImGui::TreePop();
644652
}
645653

Tutorials/Tutorial13_ShadowMap/src/Tutorial13_ShadowMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "../../Common/src/TexturedCube.hpp"
3636
#include "imgui.h"
3737
#include "ImGuiUtils.hpp"
38-
#include "imGuIZMO.h"
38+
#include "../imGuIZMO.quat/imGuIZMO.h"
3939

4040
namespace Diligent
4141
{

Tutorials/Tutorial22_HybridRendering/src/Tutorial22_HybridRendering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "ShaderMacroHelper.hpp"
3333
#include "imgui.h"
3434
#include "ImGuiUtils.hpp"
35-
#include "imGuIZMO.h"
35+
#include "../imGuIZMO.quat/imGuIZMO.h"
3636
#include "Align.hpp"
3737
#include "../../Common/src/TexturedCube.hpp"
3838

Tutorials/Tutorial27_PostProcessing/assets/shaders/ComputeLighting.fx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ float3 ComputeSpecularIBL(float2 Location, float3 F0, float3 N, float3 V, float
7777
float3 R = reflect(-V, N);
7878
float2 BRDF_LUT = SampleBRDFIntegrationMap(float2(NdotV, Roughness));
7979
float4 SSR = g_TextureSSR.Load(int3(Location, 0));
80-
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeMipLevels);
80+
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeLastMip);
8181
float3 T2 = (F0 * BRDF_LUT.x + BRDF_LUT.yyy);
8282
return lerp(T1, SSR.rgb, SSR.w * g_Camera.f4ExtraData[0].w) * T2;
8383
}

Tutorials/Tutorial27_PostProcessing/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ float3 ComputeSpecularIBL(float2 Location, float3 F0, float3 N, float3 V, float
233233
float3 R = reflect(-V, N);
234234
float2 BRDF_LUT = SampleBRDFIntegrationMap(float2(NdotV, Roughness));
235235
float4 SSR = g_TextureSSR.Load(int3(Location, 0));
236-
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeMipLevels);
236+
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeLastMip);
237237
float3 T2 = (F0 * BRDF_LUT.x + BRDF_LUT.yyy);
238238
return lerp(T1, SSR.rgb, SSR.w) * T2;
239239
}

Tutorials/Tutorial27_PostProcessing/src/Tutorial27_PostProcessing.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ void Tutorial27_PostProcessing::Initialize(const SampleInitInfo& InitInfo)
193193
m_ScreenSpaceReflection = std::make_unique<ScreenSpaceReflection>(m_pDevice);
194194
m_ShaderParams = std::make_unique<ShaderParams>();
195195

196-
m_ShaderParams->PBRRenderParams.OcclusionStrength = 1.0f;
197-
m_ShaderParams->PBRRenderParams.IBLScale = 1.0f;
198-
m_ShaderParams->PBRRenderParams.AverageLogLum = 0.2f;
199-
m_ShaderParams->PBRRenderParams.WhitePoint = HLSL::ToneMappingAttribs{}.fWhitePoint;
200-
m_ShaderParams->PBRRenderParams.MiddleGray = HLSL::ToneMappingAttribs{}.fMiddleGray;
201-
m_ShaderParams->PBRRenderParams.PrefilteredCubeMipLevels = static_cast<float>(m_Resources[RESOURCE_IDENTIFIER_PREFILTERED_ENVIRONMENT_MAP].AsTexture()->GetDesc().MipLevels - 1.0);
196+
m_ShaderParams->PBRRenderParams.OcclusionStrength = 1.0f;
197+
m_ShaderParams->PBRRenderParams.IBLScale = 1.0f;
198+
m_ShaderParams->PBRRenderParams.AverageLogLum = 0.2f;
199+
m_ShaderParams->PBRRenderParams.WhitePoint = HLSL::ToneMappingAttribs{}.fWhitePoint;
200+
m_ShaderParams->PBRRenderParams.MiddleGray = HLSL::ToneMappingAttribs{}.fMiddleGray;
201+
m_ShaderParams->PBRRenderParams.PrefilteredCubeLastMip = static_cast<float>(m_Resources[RESOURCE_IDENTIFIER_PREFILTERED_ENVIRONMENT_MAP].AsTexture()->GetDesc().MipLevels - 1);
202202

203203
m_ShaderParams->SSRSettings.MaxTraversalIntersections = 64;
204204
m_ShaderParams->SSRSettings.DepthBufferThickness = 0.15f;

0 commit comments

Comments
 (0)