Sharp Temporal AA

I tempered with TAA code and managed to make it sharp at the cost of some aliasing. Artefacts (overall blurriness, smearing, ghosting) are reduced, temporal stability kind of looks like with 8xMSAA and specular aliasing is still taken care of. (And all this by only changing one number in code.)

…(installation path)/Epic Games/4.14/Engine/Shaders/PostProcessTemporalCommon.usf
under the ‘COMPUTE BLEND AMOUNT’ section I changed “BlendFinal = 0.04” to “BlendFinal = 0.25”
and run the console command “r.TemporalAASamples 2”

Moving foliage looks a lot better this way and everything is sharper.
What I still can’t find out is how to change the number of frames TAA blends together.


Definitely needs some comparison images.

TAA’s artefacts are best seen in motion images can’t show them.

Edit: OK, ghosting can be seen in images.

UE4 TAA use exponential blending so basically number of frame is infinite.(but older frames have infinite small weight.). So there are no simple number of frames control.

It sounds awesome, but if you could show some comparison images it would definitely be great! Still images work great for showing how the overall bluriness is reduced. Here I made a comparison between TAA and MSAA:


Even with it being a still image you see how superior MSAA is because you can read the text. So if you could take some images showing the comparison between TAA default and TAA with your change that would be awesome! :cool:

Comparison of blurring:


EDIT: Certainly looks sharper, but be interesting to see how it behaves with SSR / SSAO etc. I suspect sharper TAA is likely to introduce more AO / SSR artefacts.

Reducing ghosting is probably the biggest way to improve TAA. Just reading through that presentation, and maybe scaling pixel samples by their scene depth vs current pixel scene depth would be a good way to circumvent that.

Beyond my expertise though and probably pretty expensive…

SSAO seems to be fine. As for SSR, well, it doesn’t like it. SSR vibrates a bit even when the camera is still, but it depends on resolution. It’s not that noticable.

I have tested it now.

I noticed that without the change, switching between r.PostProcessAAQuality 3 and 6 did not change anything, so it looked same.
With the change, switching between r.PostProcessAAQuality 3 and 6 is a big difference, I think r.PostProcessAAQuality 3 equals how it looks like without the change, so only r.PostProcessAAQuality 6 is affected. Thats a good way to see the difference on-the-fly while being in the game without recompiling that shader.

I do not see a difference between r.TemporalAASamples 8 (thats the default I think) and the r.TemporalAASamples 2 you said that should be used.

With the change, the TAA is definitely making it less blurry. But there is visible aliasing, and SSAO also becomes a lot more noisy. Still, modifying the BlendFinal allows for fine tuning this quite well. I think with a value of 0.15 I am quite happy. I have tested this in VR, and regarding the blurriness it looks like 10-20% more screen percentage I think. SSAO becomes noisy, but still acceptable with 0.15.

So, definitely a very nice change, thanks @helluvamesh for finding that :slight_smile:

With ‘r.TemporalAASAmples 8’ I can see heavy vibration (when the camera is still) on lengthy thin geometry (window frame) and some on masked materials (foliage), r.TemporalAASamles 2’ solves this for me.

I’ve just seen that Epic added 3 new console commands for tweaking TAA in 4.15 preview 1 and one of them modifies the BlendFinal: r.TemporalAACurrentFrameWeight. So, now it can be set from within the editor without having to manually change PostProcessTemporalCommon.usf

Interesting, thanks! So setting r.TemporalAACurrentFrameWeight to 0.25 equals the change you did in the source?

It should. They changed the line “BlendFinal = 0.04” to “BlendFinal = CurrentFrameWeight”.

There’s also 2 more new console commands r.TemporalAAFilterSize and r.TemporalAACatmullRom that I don’t know what they do yet.

Just using r.Tonemapper.Sharpen 1 or 2 also does a surprisingly good job reducing the blurriness without adding any sparkling. We shipped Ripcoil for Oculus using that.

Thanks for mentioning that. I’ve tested it now and it seems to have roughly the same impact like modifying the BlendFinal variable.

In my opinion modifying the BlendFinal variable looks a bit better because it introduces a less noticeable noisiness to the SSAO than the r.Tonemapper.Sharpen.

Also it can be good to add a negative mipmap bias to your textures, using r.MipMapLODBias=-1 and
r.Streaming.MipBias=-1. This will make normal maps in particular significantly sharper, and any other texture with lots of high frequency detail. Temporal AA gives the best image quality when it is given lots of different samples over time, and the “correct” mip map levels do the opposite.

You do trade off a bit more smearing though and it increases your VRAM usage significantly, so consider putting it in your scalability settings, or only apply a bias for certain texture samplers in your materials.

looks a lot better in VR too!!

more 3d definition.

Thanks for the tip!

For me, 0.25 and 0.15 gives good result for grass at short range, but adds noticeable noise to all other objects in the distance.

Wonder if anyone found a good combination of newly available settings.

Somewhat off topic. But a trick I use in games is this:

You can set the screen percentage in World settings to 120% and it should produce a clearer result since the AA is then applied before down scaling to screen size. Adding a sharpening post process (10-20%) should also help make the scene sharper without causing aliasing.
This will however use more resources since you render 20% more pixels.

Not sure I’d opt for a solution that makes the end-user render more pixels on screen than what is already necessary, especially in complicated scenes. I can see a few use-cases for this though!

After experimenting with numerous setups, I think I may have found the diamond in the rough…maybe…

UE4 4.15.1 - Temporal Anti-Aliasing Settings

r.TemporalAACurrentFrameWeight .5 (A bit higher than what I’ve seen mentioned but anything less than this introduced some pretty unusual artifacting in the scenes I tested it on)
r.TemporalAASamples 4 (5-6 Samples seemed to introduce quite a bit of vibration/stuttering. 4 looks B-E-A-U-TIFUL)
r.Tonemapper.Sharpen .5 (One of the only downsides to TAA is the ‘bluriness’ but sharpening the render just a bit eliminated this effect for me)

Both SSR and SSAO seem to be unaffected quality-wise using these settings.

Keep in mind that these may not be optimal for all setups (but they were in just about every scene I threw at it). Also, on a side note, I’ve spent about 4-5 years in Unity but fairly recently switched over to UE4 (so take my advice with a grain of salt and do what works best for you!) I’ve just seen quite a few questions/concerns with TAA recently and figured I’d chime in and try to help!