Fix yellowish artifacts due to quantization error in TAA and composite image output

#3318 #3254
This commit is contained in:
2026-01-13 13:12:33 +01:00
parent 14842183f2
commit 2b4dc97a97
6 changed files with 29 additions and 6 deletions
+8
View File
@@ -22,6 +22,7 @@
#include "./Flax/Common.hlsl"
#include "./Flax/Random.hlsl"
#include "./Flax/Noise.hlsl"
#include "./Flax/GammaCorrectionCommon.hlsl"
#define GB_RADIUS 6
@@ -80,6 +81,9 @@ float LensDirtIntensity;
float4 ScreenFadeColor;
float3 QuantizationError;
float Dummy2;
float4x4 LensFlareStarMat;
META_CB_END
@@ -738,6 +742,10 @@ float4 PS_Composite(Quad_VS2PS input) : SV_Target
// Saturate color since it will be rendered to the screen
color.rgb = saturate(color.rgb);
// Apply quantization error to reduce yellowish artifacts due to R11G11B10 format
float noise = rand2dTo1d(input.TexCoord);
color.rgb = QuantizeColor(color.rgb, noise, QuantizationError);
// Return final pixel color (preserve input alpha)
return color;
}
+8
View File
@@ -5,6 +5,7 @@
#include "./Flax/Common.hlsl"
#include "./Flax/GBuffer.hlsl"
#include "./Flax/Noise.hlsl"
META_CB_BEGIN(0, Data)
float2 ScreenSizeInv;
@@ -13,6 +14,8 @@ float Sharpness;
float StationaryBlending;
float MotionBlending;
float Dummy0;
float3 QuantizationError;
float Dummy1;
GBufferData GBuffer;
META_CB_END
@@ -104,5 +107,10 @@ float4 PS(Quad_VS2PS input) : SV_Target0
color = lerp(color, neighborhoodSharp, saturate(miss));
color = clamp(color, 0, HDR_CLAMP_MAX);
// Apply quantization error to reduce yellowish artifacts due to R11G11B10 format
float noise = rand2dTo1d(input.TexCoord);
color.rgb = QuantizeColor(color.rgb, noise, QuantizationError);
return color;
}