Anti-aliasing

From Valve Developer Community
(Redirected from Anti aliasing)
Jump to: navigation, search
English (en)
Comparison of no anti-aliasing and 8x MSAA. Click to enlarge

Anti-aliasing is a graphics technique extensively employed in Valve video games, such as those in the Half-Life series, as well as in other software applications developed by Valve, including Steam Steam and Source Filmmaker Source Filmmaker, 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 is very noticeable the lower the resolution is, which is often referred to in the Video game world as "Aliasing". Wikipedia icon Spatial anti-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.

Overview

MSAA

Wikipedia icon MultiSample Anti-Aliasing (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 version available (alongside CSAA on NVIDIA cards prior to Maxwell) in all Source Source games before Counter-Strike: Global Offensive Counter-Strike: Global Offensive, and later available in GoldSrc GoldSrc in 2013, with only MSAA 4X being available, which is enabled by default. 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 does not 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 GoldSrc GoldSrc (can be enhanced in GPU control panels)
  • 8x - Introduced since Source 2006, you can enable 8X MSAA in previous branches (such as Source 2004) by using mat_antialias 8 console command, or force it through driver settings.[1]

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.

Warning.pngWarning:If MSAA is enabled, ReShade depth buffer detection will stops working, which means that you are unable to use some AA methods for example (such as TAA), or even shaders such as SSAO in general.
Note.pngNote:Previous version of engine branch, Source 2004 Source 2004, has option for MSAA 6X. This settings of MSAA does not work on modern graphics card or newer drivers, and was replaced by MSAA 8X.
Note.pngNote:Alpha to coverage requires MSAA, as it is a multisampling method.

CSAA[Obsolete-notext.png Deprecated]

Coverage Sampling Anti-Aliasing (CSAA) was a NVIDIA-exclusive method of anti-aliasing, introduced with GeForce 8000 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 whilst 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) whilst 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 MFAA completely succeeded it, with lots of limitations however.

Source Source natively support CSAA since Source 2007 Source 2007. Support for CSAA was broken on some newer NVIDIA GPUs starting with GeForce 400 series (or Maxwell and newer NVIDIA cards) with new driver update, or Source 2013 Source 2013 update.[2]

FXAA

Wikipedia icon Fast Approximate Anti-Aliasing (FXAA) is a post-processing anti-aliasing with a low performance cost. The main advantage of this technique over regular anti-aliasing is that it does not require a lot of computing power. And also its capable of smoothing out alpha blended textures (aka Transparent textures). Its main drawback it's that it blurs the final image, so textures will look less sharp, and plus, they do not recover the missing pixel (or Alpha to coverage) without using FXAA with MSAA simultaneously (or by downscaling). Regular Source Source (prior to CS:GO engine branch CS:GO engine branch, or in third-party engine branch such as Xengine Xengine) doesn't have support for it but as FXAA is a postprocessing effect, it can easily be implemented like with the Source shader editor or with ReShade.

Icon-Important.pngImportant:Using ReShade for multiplayer games and connecting to a VAC-secured server is not recommended.
Additionally, using ReShade on Counter-Strike: Global Offensive and Counter-Strike 2 requires -allow_third_party_software and -insecure command line options, which would preventing you from connecting to any VAC-secured servers.

MLAA

Wikipedia icon Morphological Anti-Aliasing (MLAA) is a post-processing anti-aliasing typically available on AMD cards, but it can be used with any other graphics card. It is similar to NVIDIA's FXAA but have higher performance cost. It is used in PlayStation 3 PlayStation 3 version of Portal 2.

Confirm.pngConfirm: What about Counter-Strike: Global Offensive Counter-Strike: Global Offensive on PS3?

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 GoldSrc, Source or Source 2 games used this AA method, but users can add SMAA by using ReShade or Source Shader Editor.

TAA/TSSAA

Wikipedia icon Temporal Anti Aliasing (TAA) is a spatial anti-aliasing technique that combines information from past frames and the current frame, while also slightly jittering to smooth the current frame. TAA, 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 then MSAA, its main drawback is that it can cause ghosting and blurriness to the image, noticeable with lower framerate or resolution, depending on the implementation (Example here).

As of mid 2010s, it is the current gaming industry standard of anti-aliasing (alongside FXAA for weaker hardware) with many modern games started to use TAA as most modern games transitioned from forward rendering to deferred rendering (except Valve Valve games, which continued to use forward rendering, therefore, MSAA is still available as an option for anti-aliasing in Source 2 Source 2), allowing many lights to be rendered without significant performance hit.

The only Source engine game that supports TAA natively is Apex Legends Apex Legends, along with all Titanfall engine branch Titanfall engine branch games, through it uses TXAA instead and running on top of MSAA. Portal with RTX and all other RTX Remix games also uses TAA (or TSSAA) anti-aliasing.

TXAA

TXAA is a form of TAA that creates a smoother, clearer image than any other anti-aliasing solution by combining MSAA with Nvidia Nvidia-designed temporal filters. TXAA can results in much sharper image quality compared to TAA, depending on the implementation in some games. TXAA is supported with Nvidia GeForce GTX 600 series or higher, and requires MSAA enabled in order to use.

CMAA

Wikipedia icon Conservative Morphological Anti Aliasing (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 on supported in games starting with Counter-Strike 2 Counter-Strike 2.

Note.pngNote:When Counter-Strike: Global Offensive Counter-Strike: Global Offensive got ported to Source 2 Source 2 (and renamed to Counter-Strike 2 Counter-Strike 2), (FXAA) support was removed and (CMAA) was implemented in its place, with the ability to use it alongside MSAA removed.

Media

GoldSrc

Blank image.pngTodo: Add screenshots.

Source

No Anti-aliasing
2x MSAA
4x MSAA
8x MSAA
FXAA through the Source shader editor
No Anti-aliasing (Click to enlarge)
2x MSAA (Click to enlarge)
4x MSAA (Click to enlarge)
8x MSAA (Click to enlarge)
FXAA through ReShade (Click to enlarge)
SMAA through ReShade (Click to enlarge)
SMAA through ReShade, in conjunction with 8x MSAA.
This will produce the best result without using downscaling methods (such as DSR), while at the cost of making the image look blurrier, unless sharpening filter is also used. (Click to enlarge)
Blank image.pngTodo: Add a TAA screenshot, also a MSAA 6x

Source 2

Blank image.pngTodo: Add screenshots.

Support

GoldSrc GoldSrc

Game FXAA MSAA TAA
Half-Life Half-Life
Half-Life: Opposing Force Half-Life: Opposing Force
Half-Life: Blue Shift Half-Life: Blue Shift
Counter-Strike Counter-Strike
Day of Defeat Day of Defeat
Ricochet Ricochet
Team Fortress Classic Team Fortress Classic
Deathmatch Classic Deathmatch Classic
Counter-Strike: Condition Zero Counter-Strike: Condition Zero
Condition Zero Deleted Scenes Condition Zero Deleted Scenes
No Yes (since 2013 engine update, 4X only) No
James Bond 007: Nightfire James Bond 007: Nightfire No Yes
(up to 8X)
No

Source Source

Game FXAA MSAA CSAA (NVIDIA) EQAA (AMD) MLAA TAA
Source 2004 Source 2004
Source 2006 Source 2006
No Yes No No No No
Source 2007 Source 2007
Source 2009 Source 2009/Source Multiplayer Source Multiplayer
Source 2013 Source 2013
Alien Swarm engine branch Alien Swarm engine branch
Alien Swarm: Reactive Drop Alien Swarm: Reactive Drop
Left 4 Dead engine branch Left 4 Dead engine branch
Portal 2: Desolation Portal 2: Desolation[confirm]
No Yes Older NVIDIA GPUs/drivers only Unknown No No
Black Mesa Black Mesa Yes Removed No No No No
CS:GO engine branch CS:GO engine branch Yes Yes No No Unknown on PS3 No
Dota 2 Dota 2 (pre-Reborn) Yes No No No N/A No
Portal 2 engine branch Portal 2 engine branch No Yes No No Yes (PlayStation 3 only) No
Strata Source Strata Source Yes Yes No No No No
Titanfall Titanfall No Yes No longer functional Yes No Yes (TXAA)
Titanfall 2 Titanfall 2 No Yes Unknown, possibly might work (see above) Yes No Yes (TSSAA)
Apex Legends Apex Legends No No No No No Yes (TSSAA)
Portal with RTX Portal with RTX (and other RTX Remix games) No No No No No Yes (DLSS/DLAA)

Source 2 Source 2

Game FXAA MSAA TAA CMAA
Counter-Strike 2 Counter-Strike 2 No Yes No Yes
Half-Life: Alyx Half-Life: Alyx No Always enabled (MSAA 4X) No No
S&box S&box No Yes No No
Dota 2 Dota 2 Yes No No No

Console commands

Source

Source 2013 Source 2013 games and older Source engine games have two console commands dedicated to Anti-aliasing:

mat_antialias (0-8)
Goes from 0x to 8x MSAA.
Note.pngNote:This commands only accepts positive values as negative ones will do nothing. Also if you are using Source 2006 Source 2006 or newer, or by using newer GPUs with later drivers, 6x MSAA is not supported, so it will also do nothing!
This command also does nothing in Black Mesa as MSAA has been removed.
On Source 2004 Source 2004 (which only supports up to 6X officially), MSAA 8X can be enabled by using this command, but once you quit the game, it will reset to MSAA 4X.
mat_aaquality (0-4)
It was used to set CSAA antialiasing settings.
Warning.pngWarning:Ever since the release of Nvidia Nvidia's GTX 900 series cards (aswell as GTX 750, 750Ti and other Maxwell-based card) and newer, or with new drivers update for GeForce 400 series card and later, support for CSAA has been removed! So this commands will do nothing!

Source 2

Counter-Strike 2 Counter-Strike 2 only:

r_csgo_cmaa_enable (0-1)
Enable CMAA2.
r_csgo_cmaa_extra_sharp (0-1)
Enable sharpening when CMAA2 enabled.
Note.pngNote:Doesn't seems to have any noticeable differences.
r_csgo_cmaa_quality (0-3)
Adjust CMAA2 quality from Off, Low, Medium and High.

See also

External links

References

References
1. User:leonidakarlach - (June 4, 2024). MSAA 8X can be enabled in Source 2004 using mat_antialias 8. And there was a difference. But once you quit the game, it will reset to MSAA 4X.