When I try to implement TAA, I update the pixel color like this:
float4 PS(VertexOut pin) : SV_Target
{
float2 currPos = pin.PosH.xy * gInvRenderTargetSize;
float2 histPos = currPos + gVelocityBuffer.Sample(gsamPointClamp, currPos).xy;
float4 currPixel = gCurrFrameMap.Sample(gsamPointClamp, currPos);
float4 histPixel = gHistoryFrameMap.Sample(gsamPointClamp, histPos);
if(gFirstFrame == 1)
{
return currPixel;
}
float4 taaPixel = 0.05 * currPixel + 0.95 * histPixel;
return taaPixel;
}
But after some frames it just show the history pixel instead of the new pixel, making the render result dirty. How could I solve this?
This is the render target picture
The history frame
The current frame
The render target frame, and we can see that the pixel color do not change here



