Custom depth buffer corruption (caused by TemporalAA)

I have a bunch of meshes with custom depth enabled, all with the same stencil value. Then I read that stencil in a post process. Usually everything works fine, but sometimes the buffer seems to be written with the meshes in a weird transform.

What’s particularly weird is that while in PIE, the camera preview of the player’s camera renders correctly while the main viewport is wrong. Similarly, if I eject from the pawn, it looks correctly in the main viewport. Additionally, when the stenciled meshes move, the custom depth buffer remains unchanged, but when camera focal length changes, the stencils clearly switch between mesh LODs. However, destroying and respawning the meshes or continuously ejecting and repossessing sometimes fixes it.

Here’s an example with a post process that just renders SceneTexture:CustomDepth / 1e8. The preview in the corner is the camera of the possessed pawn, and always renders correctly.

Anyone seen this or have any idea what might be causing this?

EDIT: After further digging, I found that the problem is due to the Custom Depth with TemporalAA Jitter setting being off. With it on everything works. With it off, the issue described in the post and answer occurs.

Not a root cause, but I’ve narrowed this down to WidgetComponent. If it’s in the scene and uses world-space rendering, rotating the camera beyond 180 degrees of yaw will cause the transform of meshes rendered to the custom depth / stencil buffer to intermittently stop updating. WidgetComponents are not critical for us, so I’ve opted to simply get rid of them, but the root cause should obviously be fixed in the engine.