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

#3318 #3254
This commit is contained in:
Wojtek Figat
2026-01-13 13:12:33 +01:00
parent 14842183f2
commit 2b4dc97a97
6 changed files with 29 additions and 6 deletions

View File

@@ -6,10 +6,10 @@
#include "Engine/Graphics/GPUContext.h"
#include "Engine/Graphics/RenderTargetPool.h"
#include "Engine/Graphics/RenderBuffers.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Renderer/RenderList.h"
#include "Engine/Renderer/GBufferPass.h"
#include "Engine/Engine/Engine.h"
#include "Engine/Graphics/RenderTools.h"
GPU_CB_STRUCT(Data {
Float2 ScreenSizeInv;
@@ -18,6 +18,8 @@ GPU_CB_STRUCT(Data {
float StationaryBlending;
float MotionBlending;
float Dummy0;
Float3 QuantizationError;
float Dummy1;
ShaderGBufferData GBuffer;
});
@@ -122,6 +124,7 @@ void TAA::Render(const RenderContext& renderContext, GPUTexture* input, GPUTextu
data.Sharpness = settings.TAA_Sharpness;
data.StationaryBlending = settings.TAA_StationaryBlending * blendStrength;
data.MotionBlending = settings.TAA_MotionBlending * blendStrength;
data.QuantizationError = RenderTools::GetColorQuantizationError(tempDesc.Format);
GBufferPass::SetInputs(renderContext.View, data.GBuffer);
const auto cb = _shader->GetShader()->GetCB(0);
context->UpdateCB(cb, &data);

View File

@@ -6,7 +6,7 @@
#include "Engine/Content/Content.h"
#include "Engine/Graphics/Graphics.h"
#include "Engine/Graphics/GPUContext.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Graphics/RenderTools.h"
#include "Engine/Graphics/RenderTargetPool.h"
#include "Engine/Engine/Time.h"
@@ -58,6 +58,9 @@ GPU_CB_STRUCT(Data{
Color ScreenFadeColor;
Float3 QuantizationError;
float Dummy2;
Matrix LensFlareStarMat;
});
@@ -359,6 +362,7 @@ void PostProcessingPass::Render(RenderContext& renderContext, GPUTexture* input,
data.LensFlareIntensity = 0;
data.LensDirtIntensity = 0;
}
data.QuantizationError = RenderTools::GetColorQuantizationError(output->Format());
data.PostExposure = Math::Exp2(settings.EyeAdaptation.PostExposure);
data.InputSize = Float2(static_cast<float>(w1), static_cast<float>(h1));
data.InvInputSize = Float2(1.0f / static_cast<float>(w1), 1.0f / static_cast<float>(h1));