Anti-aliasing

Anti-aliasing (AA) is a graphics technique extensively employed in video games, such as those in the series, as well as in other software applications developed by , including and , etc. This technique is utilized to enhance the visual quality and reduce the jagged edges, or jaggies, that can appear in computer-generated imagery.
Computer monitors are essentially a large grid of squares that can be set to any color or brightness. As such, it is impossible to draw a perfectly straight line, because no matter how many squares there are, it will never be able to make a perfectly smooth diagonal. This creates a stair-step pattern that gets increasingly noticeable the lower the resolution is, which is often referred to in the video game world as "Aliasing". , often referred to simply as anti-aliasing, is designed to combat the problems of aliasing. In simple terms, anti-aliasing is designed to smooth out that stair-step pattern in images and make them look less pixelated, while not changing the resolution of the final image.
While anti-aliasing is available on PC, it was often not supported on consoles until the release of (which uses MLAA on ), as traditional methods like MSAA are very expensive, compared to post-processing methods like FXAA/TAA/MLAA used in later games. In all games and above on , it uses software AA, which is not as effective as newer post-processing methods.
==Overview==
=== Traditional methods ===
* Restore missing details and looks sharper compared to post-processing methods
* More expensive than post-processing methods (also SSAA is more demanding than MSAA, while produce better result)
* Most newer games (that uses deferred renderer) does not support these methods
* MSAA only: Does not apply anti-aliasing to transparent textures without alpha to coverage
====SSAA====
, also known as Full Scene Anti-Aliasing (FSAA) in some games and often interchangeable with the term downscaling.
* Technically when implemented correctly, these do differ in that downscaling applies to an entire frame buffer – 2D and 3D Elements, while SSAA/MSAA are techniques only applied internally to 3D elements. In some implementations this can result in a lesser performance impact and better compatibility.
Compared to MSAA, SSAA/FSAA produces the same result as MSAA, but completely reduced stair-step pattern in alpha textures, and makes transparent letters (on the container prop) less blurry. Additionally, ReShade depth buffer detection works with SSAA. However, despite it's very high-quality results, SSAA is very expensive when it comes to performance compared to MSAA, and SSAA is not available as an option in Source by default, but can be enabled below:
On NVIDIA graphics cards, it's implemented as OGSSAA (Ordered Grid Supersample Anti-Aliasing), and can only be enabled through third-party applications such as , using the following modes: 2x1, 1x2, 2x2, 3x3, 4x4. OGSSAA also only supports Direct3D.
==== Downscaling ====
Downscaling or downsampling is a brute-force method for AA, which applies SSAA to both 2D (such as HUD and UI) and 3D elements by running the game at a higher resolution. It can be enabled on graphics card control panel as NVIDIA DSR or AMD VSR. Unlike SSAA, downscaling will produce slightly blurrier results and does not get rid of the shimmering effect on transparent textures/objects.
Another downside to downscaling is that many older games' UI (such as VGUI) will become smaller at higher resolutions. However, recently and (both since 20th anniversary), and aswell as has been updated to allow VGUI to scale properly on higher resolution, while all games since properly scales UI at 4K or higher (except close captioning which does not scales in , but does on and newer titles).
====MSAA====
 (MSAA) was the gaming industry standard of anti-aliasing (prior to the TAA gradually replacing MSAA in mid-late 2010s as games transitioned from forward rendering to deferred rendering), and as such is the only anti-aliasing available (alongside CSAA on NVIDIA cards prior to Maxwell) in all games before , and later available in in 2013, with only MSAA 4x being available, which is enabled by default. In , the anti-aliasing can be disabled by starting with the launch option. Essentially, if a polygon is crossing a multisample point, or subpixel, it detects how many of its neighboring points are also being intersected, then takes the color of that polygon and adds it over the existing image to create a slightly smother line. This creates a smoother line, but does not completely remove the stair-step pattern (especially on alpha textures that don't use alpha to coverage) without combining FXAA/SMAA/other post-FX AA methods with MSAA, plus games that use deferred rendering and MSAA may not work properly and can cause various other issues. This is usually sufficient for most users, however.
All GoldSrc, Source and Source 2 games contain 3 different settings of MSAA, which include:
*2x
*4x - Default level in post-SteamPipe (can be enhanced in GPU control panels), aswell default on post-20th anniversary
*8x - Very expensive on older/low-end hardware. Introduced in Source 2006. You can enable 8x MSAA in Source 2004 by using the console command, or force it through driver settings.
What this does is add more subpixels to a specified location and increases the accuracy of the multisampling, at the cost of performance. Some alternative anti-aliasing methods such as the post-processing one will be less demanding compared to MSAA or other methods.
==== SGSSAA (and transparency AA) ====
 SGSSAA, short for Sparse Grid Super-Sampling Anti-Aliasing is a improved version of SSAA (or OGSSAA), using MSAA and TrSSAA (for transparent textures without alpha to coverage), to apply anti-aliasing to the image. Enabling this method requires third-party application such as NVIDIA Profile Inspector, plus change the "Antialiasing - Compatibility (DX9)" flag and LOD bias to allow SGSSAA to work, produce good results and makes distant texture looks significantly sharper (compared to NVIDIA DSR), it also produces more detail than OGSSAA (or regular SSAA), and transparent textures will look better than using alpha to coverage (which creates noticeable dithering when looking closer).
Game 	Flag
All 	LOD Bias: Set Negative LOD to "Allow", then set the following value:2xSGSSAA (2 samples): -0.5 (or -0.375)4xSGSSAA (4 samples): -1.0 (or -0.875) 8xSGSSAA (8 samples): -1.5 (or -1.375)
- 	0x000000C10x004000C1 (if ReShade is used)0x004010C1 ()
and above	0x000000C00x004000C0 (if ReShade is used)0x004010C0 ()
==== CSAA ====
Coverage Sampling Anti-Aliasing (CSAA) was an NVIDIA-exclusive method of anti-aliasing, introduced with the GeForce 8 Series. It aims to further reduce the additional stress that MSAA puts on the system, with NVIDIA claiming that a CSAA-rendered image will rival 8x-16x MSAA while only putting a load on the system comparable to 4x MSAA. It does this by reducing the number of settings each sample determines (by creating a new sample for coverage) while increasing the overall number of samples. 
However, by the release of Maxwell-based GPUs such as GTX 750 Ti, GTX 800M/900 series in 2014, and newer NVIDIA graphics card (or drivers released around Feb 2014 onwards which affects GeForce 400 series card and above) drops support for CSAA completely, and Multi-Frame Anti-Aliasing (MFAA) completely succeeded it, with limitations such as disabling D3D11 Driver Command Lists, killing multi-threaded rendering in DX11 Source games (and thus performance when CPU-limited), and FPS lower than 40 will cause smearing and blurring when in motion (similar to TAA).
 natively support CSAA since . Support for CSAA was removed since Maxwell and later NVIDIA cards.
There are 3 different settings of CSAA, which include:
*8x (MSAA 4x performance)
*16x (MSAA 4x performance)
*16xQ (MSAA 8x performance)
=== Post-processing methods ===
* Produces blurrier result and does not restore missing details compared to traditional methods
* Cheap, with little to no performance loss compared to traditional methods
* Only available on (Software AA), (FXAA), but it can be easily implemented to any game using Source shader editor or ReShade.
* Does apply anti-aliasing to all transparent textures.
==== Software AA ====
All Source engine games since introduced software AA, which blurs the jagged edges (similar to FXAA or other post-processing AA). It currently only works on Source 2007 games (tested on 2012/mod version).
Software AA is also supported (and used) in port of Source engine games. Unlike other anti-aliasing, this can be only toggled through console commands ().
====FXAA====
 (FXAA) is a post-processing anti-aliasing with a very low performance cost. The main advantage of this technique over regular anti-aliasing is that it doesn't require a lot of computing power, and is also capable of smoothing out alpha-blended textures (aka transparent textures).
Its main drawback is that it blurs the final image, so textures will look less sharp, and plus, they don't recover the missing pixel (or alpha to coverage) without using FXAA with MSAA simultaneously (or by downscaling).
Regular (prior to , or in third-party engine branch such as ) doesn't have support for it but as FXAA is a post-processing effect, it can easily be implemented like with the Source shader editor or with ReShade.
====MLAA====
 (MLAA) is a post-processing anti-aliasing typically available on AMD cards, but it can be used with any other graphics card. It's similar to NVIDIA's FXAA but has a higher performance cost, but is less demanding compared to MSAA. It's used in version of .
====SMAA====
Subpixel Morphological Anti-Aliasing (SMAA) works similarly to FXAA or MLAA (which is what SMAA was based off), but results in much better image quality than both FXAA and MLAA, while also taking little performance impact. There are currently no , or games using this AA method, but users can add SMAA by using ReShade or Source Shader Editor.
====CMAA====
 (CMAA) 
is an image-based post-processing technique originally developed by Filip Strugar at Intel. CMAA uses 4 main steps to reduce aliasing:
*Color break detection
*Locally dominant edge detection
*Simple shape handling
*Symmetrical long edge shape handling. 
CMAA, while having slight performance impact compared to FXAA, but still has less performance impact than SMAA, CMAA manages high quality anti-aliasing while preserving text and without over blurring the geometry.
CMAA is currently only implemented in .
=== Temporal methods ===
* While producing result similar to SSAA, TAA/TSSAA restore missing details by jittering the image which combines the information from past and current frames, while TXAA restore missing details by using MSAA.
* Temporal methods, when in motion, also produces blurrier image and create ghosting effect noticable with lower framerate and/or resolutions.
* Like post-processing methods, cheap, with little to no performance loss compared to traditional methods
* Only available in , but it can be easily implemented to any game using Source shader editor or ReShade.
* Does apply anti-aliasing to all transparent textures.
====TAA/TSSAA====
 (TAA) is an anti-aliasing technique that reduces shimmering or flickering effects by smoothing the frame when in motion. There are multiple implementations of TAA, but the most common one is TSSAA (Temporal Super-Sampling Anti-Aliasing) which combines information from past frames (usually 8 frames) and the current frame, while also slightly jittering to smooth the current frame. Each pixel is sampled once per frame but in each frame the sample is at a different location within the pixel. Pixels sampled in past frames are blended with pixels sampled in the current frame to produce an anti-aliased image.
While being cheaper to calculate than MSAA, and produces image similar to super sampling anti-aliasing (SSAA) or downscaling, its main drawback is that it can cause ghosting and blurriness to the image, especially when in motion, noticeable with lower framerate or resolution, depending on the implementation (Example here). Some of the drawbacks can be mitigated by adding a sharpening filter.
As of mid 2010s, it's the current gaming industry standard of anti-aliasing (alongside FXAA for weaker hardware) with many modern games (except many VR and mobile games) started to use TAA as most modern games transitioned from forward rendering to deferred rendering, which allows many lights to be rendered without a significant performance hit, and because MSAA is harder to implement on deferred rendering yet produce worse result than games using forward rendering, and some games use TAA to hide dithering effect (such as SSAO or ray tracing).
 as well as are the only Source games that uses TSSAA, while uses TXAA which requires MSAA to function. and all other RTX Remix games also use TSSAA anti-aliasing, through DLSS (or DLAA). One upcoming Source 2 game made by Valve, , supports TAA through AMD FSR2. Both DLSS, XeSS and FSR 2.0 (and later) not only apply TAA anti-aliasing (using AI/Tensor Cores), but also improve performance by rendering the image at lower resolutions then scaling to higher resolutions.
==== TXAA ====
TXAA is an older form of TAA that creates a smoother image by combining MSAA with -designed temporal filters. TXAA is supported with Nvidia GeForce GTX 600 series or higher, and requires MSAA to be enabled in order to use.
==Media==
=== ===
			
=== ===
==== Closeup ====
This image shows how each anti-aliasing methods affect text, details, transparent textures (both non-alpha to coverage and alpha to coverage).
			
			
==== Software AA ====
		
==== ====
; Multisampling
			
; Post-processing
			
; Supersampling
			
==== ====
				
=== ===
==Support==
======
Game	FXAA	MSAA	TAA
 	 	 	
 	 	 	
======
Anti-aliasing types 	Post-processing	Post-processing	Post-processing	Spatial	Spatial 	Spatial 	Temporal
Game 	FXAA 	MLAA 	Software AA 	MSAA 	CSAA (NVIDIA) 	EQAA (AMD)	TAA
 	 	 	 	 	 	 	
 	 	 	 	 	 	 	
 	 	 	 	 	 	 	
/ 	 	 	 	 	 	 	
 	 	() 	 	 	Can be only enabled using .CSAA options removed from menu.	 	
 	 	 	 	 	Can be only enabled using .CSAA options removed from menu.	 	
(pre-Reborn) 	 	 	 	 	 	 	
 	 	 	 	 	 	 	
Consortium 	 	 	 	 	 	 	
 	 	 	 	 	 	 	
 	 	 	 	 	 	 	
 	 	 	 	 	 	 	Also support Adaptive Supersampling (requires TSSAA)
 	 	 	 	 	 	 	Also support Adaptive Supersampling (requires TSSAA)
(and other RTX Remix games)	 	 	 	 	 	 	
======
Game	FXAA	MSAA	TAA	CMAA
 	 	 	 	
 	 	 	 	
 	 	 	 	
 	 	 	 	
 	 	 	 	
== Performance impact ==
Below is the performance impact of each AA method. Most modern mid-range and high-end GPUs are capable of 8x MSAA with no performance loss, and over 60-100 FPS in Source games, as they are capped at 300 FPS by default.
Game 	None 	FXAA 	SMAA 	MSAA 	SSAA 	TAA
(benchmark)	569.23 Avg FPS	549.88 Avg FPS(Negligible)	533.28 Avg FPS(Very Low)	547.00 Avg FPS (2x)(Low - Moderate)520.89 Avg FPS (4x)(Moderate)475.34 Avg FPS (8x)(Moderate - High)	409.26 Avg FPS (2x2)(Very High)329.32 Avg FPS (2x2 + MSAA 4X/SGSSAA)(Very High)147.74 Avg FPS (4x4)(Very High)	TSSAA: Similar to SMAA or FXAATXAA: Similar as MSAA
==Console commands==
=== Source ===
==== MSAA/CSAA ====
 games and older Source engine games have these console commands dedicated to anti-aliasing:
==== Software AA ====
=== Source 2 ===
 only:
== See also ==
* Direct3D
* Software renderer
* Vulkan
* How To Take Artistic Screenshots
== External links ==
* Advanced OpenGL - Anti-Aliasing
* 
Category:Graphics
Category:Shaders
Category:Glossary
Category:Technical