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.
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!
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…
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
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
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.
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!