Skip to content

Commit 2d55ae8

Browse files
TAA: removed unneeded FEATURE_FLAG_REVERSED_DEPTH flag (#228)
1 parent 9cc4d2b commit 2d55ae8

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

PostProcess/TemporalAntiAliasing/interface/TemporalAntiAliasing.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,14 @@ class TemporalAntiAliasing
5555
{
5656
FEATURE_FLAG_NONE = 0u,
5757

58-
// Indicates that the application uses a reversed depth buffer.
59-
FEATURE_FLAG_REVERSED_DEPTH = 1u << 0u,
60-
6158
// Use Gaussian weighting in the variance clipping step.
62-
FEATURE_FLAG_GAUSSIAN_WEIGHTING = 1u << 1u,
59+
FEATURE_FLAG_GAUSSIAN_WEIGHTING = 1u << 0u,
6360

6461
// Use Catmull-Rom filter to sample the history buffer.
65-
FEATURE_FLAG_BICUBIC_FILTER = 1u << 2u,
62+
FEATURE_FLAG_BICUBIC_FILTER = 1u << 1u,
6663

6764
// Use YCoCg color space for color clipping.
68-
FEATURE_FLAG_YCOCG_COLOR_SPACE = 1u << 3u
65+
FEATURE_FLAG_YCOCG_COLOR_SPACE = 1u << 2u
6966
};
7067

7168
struct RenderAttributes

PostProcess/TemporalAntiAliasing/src/TemporalAntiAliasing.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diligent Graphics LLC
2+
* Copyright 2024-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -234,7 +234,6 @@ void TemporalAntiAliasing::PrepareShadersAndPSO(const RenderAttributes& RenderAt
234234

235235
ShaderMacroHelper Macros;
236236
Macros.Add("TAA_OPTION_GAUSSIAN_WEIGHTING", (FeatureFlags & FEATURE_FLAG_GAUSSIAN_WEIGHTING) != 0);
237-
Macros.Add("TAA_OPTION_INVERTED_DEPTH", (FeatureFlags & FEATURE_FLAG_REVERSED_DEPTH) != 0);
238237
Macros.Add("TAA_OPTION_BICUBIC_FILTER", (FeatureFlags & FEATURE_FLAG_BICUBIC_FILTER) != 0);
239238
Macros.Add("TAA_OPTION_YCOCG_COLOR_SPACE", (FeatureFlags & FEATURE_FLAG_YCOCG_COLOR_SPACE) != 0);
240239

Shaders/PostProcess/TemporalAntiAliasing/private/TAA_ComputeTemporalAccumulation.fx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
#include "PostFX_Common.fxh"
44
#include "TemporalAntiAliasingStructures.fxh"
55

6-
#define FLT_EPS 5.960464478e-8
7-
#define FLT_MAX 3.402823466e+38
8-
9-
#if TAA_OPTION_INVERTED_DEPTH
10-
#define DepthFarPlane 0.0
11-
#else
12-
#define DepthFarPlane 1.0
13-
#endif // TAA_OPTION_INVERTED_DEPTH
6+
#define FLT_EPS 5.960464478e-8
147

158
cbuffer cbCameraAttribs
169
{
@@ -119,9 +112,11 @@ float3 ClipToAABB(float3 ColorPrev, float3 ColorCurr, float3 AABBCentre, float3
119112

120113
float ComputeDepthDisocclusionWeight(float CurrDepth, float PrevDepth)
121114
{
122-
float LinearDepthCurr = DepthToCameraZ(CurrDepth, g_PrevCamera.mProj);
123-
float LinearDepthPrev = DepthToCameraZ(PrevDepth, g_PrevCamera.mProj);
124-
return exp(-abs(LinearDepthPrev - LinearDepthCurr) / LinearDepthCurr);
115+
float LinearDepthCurr = abs(DepthToCameraZ(CurrDepth, g_PrevCamera.mProj));
116+
float LinearDepthPrev = abs(DepthToCameraZ(PrevDepth, g_PrevCamera.mProj));
117+
float MaxLinearDepth = max(LinearDepthCurr, LinearDepthPrev);
118+
float LinearDepthDelta = abs(LinearDepthCurr - LinearDepthPrev);
119+
return exp(-LinearDepthDelta / max(MaxLinearDepth, 1e-6));
125120
}
126121

127122
float ComputeDepthDisocclusion(float2 Position, float2 PrevPosition)

0 commit comments

Comments
 (0)