Summary
On a camera-cut frame, the final image shows a ghost of an old, unrelated frame for one frame. It needs TSR, motion blur, and r.MotionBlur.HalfResInput=1 (the default). Setting r.AntiAliasingMethod to something other than TSR, or r.MotionBlurQuality=0, removes it.
Root cause
In 5.8, TSR can write a half-res mip 1 of its output, which motion blur uses as a prefiltered input for long blur streaks. TemporalSuperResolution.cpp splits allocating that mip from writing it:
bool bAllocateOutputMip1 = PassInputs.bGenerateOutputMip1;
bool bWriteOutputMip1 = PassInputs.bGenerateOutputMip1 && PassConfig.MotionBlurValidInCurrentFrame;
MotionBlurValidInCurrentFrame is false on camera cuts (View.bCameraCut or View.bPrevTransformsReset). On those frames:
- The output texture is still allocated with 2 mips: the history array (bRequires2Mips) or TSR.Output (NumMips = bAllocateOutputMip1 ? 2 : 1).
- Mip 1 is not written, so it holds whatever the pooled texture last held, often a frame from a different camera.
- The output SRV still covers both mips:
- UpdateHistoryTextureSRV = CreateSRV(FRDGTextureSRVDesc::CreateForSlice(History.ColorArray, …)) (5.8 line ~3298, Main ~3416)
- SceneColorOutputTextureSRV = CreateSRV(FRDGTextureSRVDesc(SceneColorOutputTexture)) (5.8 lines ~3423 and ~3472, Main ~3541 and ~3590)
- Motion blur is skipped on the cut frame, so Tonemap reads the TSR output directly. PostProcessTonemap.usf samples ColorTexture with Texture2DArraySample / Texture2DSample, which uses an implicit LOD. Chromatic aberration and other UV scaling push the derivative-based LOD above 0 at screen edges, so the stale mip 1 gets blended in.
We confirmed this in a RenderDoc capture: on the cut frame, mip 1 of TSR.History.Color holds an older frame, and the Tonemap output matches a blend of the correct mip 0 and that stale mip 1. On the next frame, mip 1 is written again and the image is clean.
What Type of Bug are you experiencing?
Rendering (Graphics / Niagara)
Steps to Reproduce
- TSR, motion blur on, r.MotionBlur.HalfResInput=1, and some chromatic aberration (or any setting that makes Tonemap’s sample LOD greater than 0).
- Use Sequencer camera cuts (or SetGameCameraCutThisFrame) between two very different views.
- On the cut frame, the edges of the image show a faint ghost of an earlier frame.
Expected Result
Corrupted frame image.
Observed Result
On a camera-cut frame, the final image shows a ghost of an old, unrelated frame for one frame.
Affects Versions
5.9
5.8
Platform(s)
Windows
Additional Notes
Suggested fix
On frames that don’t write mip 1, limit the output SRVs to mip 0:
FRDGTextureSRVDesc UpdateHistorySRVDesc = FRDGTextureSRVDesc::CreateForSlice(
History.ColorArray, ColorUAVDesc.FirstArraySlice + HistoryArrayIndices.HighFrequency);
if (!(bWriteOutputMip1 && HistorySize == OutputRect.Size()))
{
UpdateHistorySRVDesc.NumMipLevels = 1;
}
UpdateHistoryTextureSRV = GraphBuilder.CreateSRV(UpdateHistorySRVDesc);
SceneColorOutputTextureSRV = GraphBuilder.CreateSRV(bWriteOutputMip1
? FRDGTextureSRVDesc(SceneColorOutputTexture)
: FRDGTextureSRVDesc::CreateForMipLevel(SceneColorOutputTexture, 0)); // both TSR.Output sites
Other options: always write mip 1 when it is allocated, or have Tonemap sample with SampleLevel(…, 0).
Question: is this fixed in a later change we haven’t picked up? If not, could it be fixed for 5.8.x hotfix or 5.9?