Skip to content

Commit eedf8ae

Browse files
SSAO: added SSAO_MAX_HISTORY_LENGTH macro
1 parent 7756052 commit eedf8ae

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Shaders/PostProcess/ScreenSpaceAmbientOcclusion/private/SSAO_ComputeTemporalAccumulation.fx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ ProjectionDesc ComputeReprojection(float2 PrevPos, float CurrDepth)
140140
LoadHistory(FetchCoords.xw),
141141
LoadHistory(FetchCoords.zw)
142142
);
143-
History = min(float4(16.0, 16.0, 16.0, 16.0), History + float4(1.0, 1.0, 1.0, 1.0));
143+
History = min(History + float4(1.0, 1.0, 1.0, 1.0), float4(SSAO_MAX_HISTORY_LENGTH, SSAO_MAX_HISTORY_LENGTH, SSAO_MAX_HISTORY_LENGTH, SSAO_MAX_HISTORY_LENGTH));
144144
Desc.Occlusion = dot(PrevOcclusion, Weights) / TotalWeight;
145145
Desc.History = dot(History, Weights) / TotalWeight;
146146
}

Shaders/PostProcess/ScreenSpaceAmbientOcclusion/public/ScreenSpaceAmbientOcclusionStructures.fxh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
// Determines the similarity of the depth in the current and previous frame to calculate the disoclusion in the temporal accumulation step
5050
#define SSAO_DISOCCLUSION_DEPTH_THRESHOLD 0.01
5151

52+
// Maximum history length in the temporal accumulation step.
53+
// Higher values reduce noise for the price of increased ghosting.
54+
#define SSAO_MAX_HISTORY_LENGTH 16.0
55+
5256
struct ScreenSpaceAmbientOcclusionAttribs
5357
{
5458
// The value defines world space radius of ambient occlusion

0 commit comments

Comments
 (0)