Temporal Anti-Aliasing (TAA)
Temporal anti-aliasing (also known as TAA) is a anti-aliasing technique to reduce temporal aliasing (flickering or shimmering effects). This technique can be combined with FXAA for better quality.
ISS without TAA.
|
ISS with TAA.
|
TAA Features#
Unlike Multisample anti-aliasing (MSAA) that performs anti-aliasing only on edges of polygons (and makes this edges smoother), Temporal anti-aliasing applies smoothing to the whole scene. In case of full deferred rendering (when the final image is composed of different texture buffers: depth, normal, etc.), MSAA will increase performance costs, because Multisample anti-aliasing should be applied to each texture buffer.
How TAA works#
The main concept of temporal anti-aliasing is to use a subpixel jitter of scene camera every frame and then combine all this frames into the final image. So, it will take time to get a smoothed picture (for example, 5-7 frames), but with the frequency of 60 frames per second it will look seamlessly.
During rasterization process, there is a test whether the object will get into pixel or not. And the object will not be rendered if it doesn't occupy a major part of a pixel.
And here we can get an error, when we have a sphere object before rasterization and get a square object after, because some parts of the sphere doesn't occupy enough pixel space.
Not a very good rendering, right? And temporal anti-aliasing solves this problem, because camera will have a subpixel jitter, and each part of this sphere at least once will be rendered in a frame. And after combining these frames, we will get a true sphere, not a square! Voila!
Ghosting#
This anti-aliasing technique works perfectly for static scenes (without any moving objects). But when objects are moving, frames will significantly differ one from another and we will see a trail of "ghosts" of the moving object. This effect is called ghosting.
To get rid of ghosting, there is a velocity buffer. Velocity buffer stores information about transformations of objects. Due to this buffer, the engine knows about the object transformation and don't render the "ghosts" of the moving object. Also, the engine checks the color intensity of the pixel, because of camera jitter.
Summary#
TAA has a wide scope of usage, because it improves whole image (not only the edges of the geometry, like MSAA) including geometry, shadows, etc. It greatly reduces all the problems, and does not cut the performance down, working well with both static and dynamic images. However, keep in mind that the key factor of good TAA performance is optimized content of the scene: the higher FPS is, the faster temporal anti-aliasing smooths the scene. In addition to this, UNIGINE allows you to choose the type of anti-aliasing: TAA or FXAA, or combine them both for better image quality (FXAA is applied before temporal summing).
TAA Adjustment#
Temporal Anti-Aliasing (TAA) settings are available for adjustment via the Render -> Antialiasing section of the Settings window, along with SRAA, Fast approXimate Anti-Aliasing (FXAA) and Supersampling settings. The following settings are available when the Custom preset for Anti-Aliasing is selected.
TAA | The value indicating if TAA (Temporal Anti-Aliasing) is enabled. enabled by default.
Console access: render_taa (API control) |
---|---|
Preset | The index of the AA (Anti-Aliasing) preset used at the moment. To customize Anti-Aliasing options at run time you should activate the Custom preset: One of the following values:
Console access: render_aa_preset (API control) |
Customizable Settings#
The following settings are available when the Custom preset is selected.
Fix Flicker | The value indicating if the taa fix flicker option is enabled. This option fixes flickering edges caused by TAA: it removes bright pixels by using the pixel brightness information from the previous frame. It is recommended to enable the option for bright thin ropes, wires and lines. The option is available only when TAA (see the ) is enabled. Enabling this option may increase performance costs. Console access: render_taa_fix_flicker (API control) |
---|---|
Frames By Color | The value indicating if TAA color clamping option is enabled. This option clamps the color of the current and previous frame. The image becomes more sharp. TAA (see the ) must be enabled. enabled by default.
Console access: render_taa_frames_by_color (API control) |
Fix Blur | The value indicating if Catmull-Rom resampling is enabled. This option enables you to reduce image blurring when the camera moves forward/backward. It is recommended to disable resampling fow low-quality presets. enabled by default.
Console access: render_taa_catmull_resampling (API control) |
Fix Blur Sharpness | |
Antialiasing In Motion | The value indicating if improved anti-aliasing in motion (for moving camera and objects) is enabled. TAA (see the ) must be enabled. disabled by default.
Console access: render_taa_antialiasing_in_motion (API control) |
Diagonal Neighbors | The value indicating if diagonally neighboring pixels are to be taken into account in the process of color clamping for TAA. This mode can be used for relatively static scenes when improved antialiasing is required. In case of a dynamic scene, blurring artefacts near the screen borders may appear. disabled by default.
Console access: render_taa_diagonal_neighbors (API control) |
Preserve Details | The detail level of TAA (Temporal Anti-Aliasing). The higher the value, the more detailed the image is. Can produce additional flickering. Range of values: [0.0f, inf]. The default value is : 0.5f. Console access: render_taa_preserve_details (API control) |
Frame Count | The frame count of TAA (Temporal Anti-Aliasing). Specifies the number of frames combined for pixels. The higher the value, the more frames are combined into the final image and the better anti-aliasing. This value is used only when the Frames By Velocity option (see the ) is disabled. Range of values: [0.0f, inf]. The default value is : 30.0f. Console access: render_taa_frame_count (API control) |
Pixel Offset | The size of the sample offset performed during subpixel jittering. The offset can be less than a pixel: for example, if 0.5 is set, frames will shift to half a pixel. Range of values: [0.0f, 1.0f]. The default value is : 1.0f. Console access: render_taa_pixel_offset (API control) |
Samples | The number of the sample offsets performed during subpixel jittering. The parameter allows reducing image jittering and blurring. By the minimum value of 0 (1 sample offset), there will be no offsets, and, therefore, no anti-aliasing. TAA (see the ) must be enabled. One of the following values:
Console access: render_taa_samples (API control) |
Frames By Velocity | The value indicating if the TAA velocity clamping option is enabled. This option controls the number of frames combined for pixels depending on the velocity in the fragment: the number of frames is clamped to the [Min frame count; Max frame count]. It reduces blurring in dynamic scenes with a lot of moving objects. enabled by default.
Console access: render_taa_frames_by_velocity (API control) |
Threshold | The velocity threshold of TAA (Temporal Anti-Aliasing), at which pixels are treated as fast moving ones.This value specifies the intensity of velocity clamping. The following options must be enabled: TAA (see the ) and TAA velocity clamping (see the ). Range of values: [0.0f, inf]. The default value is : 1.0f. Console access: render_taa_frames_velocity_threshold (API control) |
Max Frame Count | The maximum frame count of TAA (Temporal Anti-Aliasing). Specifies the maximum number of frames in the velocity buffer combined for pixels that don't move relative to the screen space. Range of values: [0.0f, inf]. The default value is : 60.0f. Console access: render_taa_max_frames_by_velocity (API control) |
Min Frame Count | The minimum frame count of TAA (Temporal Anti-Aliasing). Specifies the minimum number of frames in the velocity buffer combined for fast moving pixels on the screen. Range of values: [0.0f, inf]. The default value is : 4.0f. Console access: render_taa_min_frames_by_velocity (API control) |
Edges Frame Count Multiplier | The multiplier for the number of frames accumulated for TAA effect on the sharp edges of objects within the image. Range of values: [1.0f, inf]. The default value is : 1.0f. Console access: render_taa_edges_frame_count_multiplier (API control) |
Recommendations#
As you can see TAA has a lot of settings enabling you to adjust it for relatively static scenes as well as for dynamically changing environments.
Static Scenes#
Below is an example of TAA settings for relatively static scenes.
- The Diagonal Neighbors option should be enabled, as it provides more accurate pixel color information reducing the stair-step effect. At the same time TAA causes more blurring is case of fast camera movement, which is especially noticeable on grass and other similar high-contrast screen areas.
- Preserve Detail value is decreased to reduce flickering of small pixels.
- The number of TAA Samples is set to 16, which increases the number of variants for subpixel camera jittering, thus making the stair-step effect even less noticeable.
Dynamic Scenes#
Below is an example of TAA settings for very dynamic scenes where trails from thin objects are especially noticeable.
- The Diagonal Neighbors option should be turned off, as it may result in significant blurring of small details in motion.
- Increase the Preserve Details value up to 1 or higher to reduce ghosting effect for moving objects.
- Set TAA Samples value to 4 to reduce flickering of small pixels when the camera does not move.
- It is also recommended to reduce Max Frame Count to 60 or lower, to accumulate less frames for slow motion, reducing the ghosting effect.