[5.4.1p4] Issue with ImageEffectOpaque on TAA [Solved]

I’m having a bit of an issue combining the left for dead temporal AA with transparent items drawn afterwards.

Since the transparent items pose a sorting issue and their motion is fairly complex, I want to exclude them from TAA. The shader for the transparent items will just use screen space derivatives to make the transparent objects perfectly anti-aliased anyway.

So, top image, TAA disabled. You can see the opaque parts miss AA, but the green dashed line has AA applied inherently by the shader.

The middle image shows the same with TAA enabled (after all rendering.) I disabled the animation for the screenshots, so there are no artifacts visible now. But in motion, the artifacts appear.

So then I decided to move the TAA in between the opaque rendering and the green overlay line (drawn at queue 3000, Transparent.) This is the bottom image. Somehow the green overlay line doesn’t seem to be drawn after the TAA at all, but there is a weak shimmer of it still visible.

The TAA in question calculates a velocity buffer OnPostRender. The color is blended with the previous frame in OnRenderImage (which is set to ImageEffectOpaque.) Storing the current frame for usage in the next frame is done in the same pass using mrt.

I’ve looked at Z-buffer and color blending issues, but that doesn’t seem to be the problem. Am I missing something here? By the still visible shimmer, it seems that the green overlay is rendered either in the current frame or in the previous frame. Since blending and frame storage happen in the same pass, that should not be possible.

Just did some further testing to see whether the green dashed line appears in the current frame and/or the previous frame output from the TAA pass. The result is that it only appears in the previous frame and not the current frame. That doesn’t make much sense unless the rendertarget is somehow switched from the original target to the previous frame buffer.

Edit: Ok, that was it. So what happened was this:

  • Opaque geometry is rendered as usual
  • TAA is applied as image effect after opaque
  • TAA sets the buffer to use in the next frame and the OnRenderImage destination as targets
  • Transparant geometry is rendered, but into the first MRT target, which is the buffer for the next frame

I solved it by reverting from the MRT setup after it is no longer needed by setting the OnRenderImage destination as only target.

1 Like