pyvista.Plotter.enable_anti_aliasing#
- Plotter.enable_anti_aliasing(aa_type='ssaa', multi_samples=None, all_renderers=True)[source]#
Enable anti-aliasing.
This tends to make edges appear softer and less pixelated.
- Parameters:
- aa_type
str
, default: “ssaa” Anti-aliasing type. See the notes below. One of the following:
"ssaa"
- Super-Sample Anti-Aliasing"msaa"
- Multi-Sample Anti-Aliasing"fxaa"
- Fast Approximate Anti-Aliasing
- multi_samples
int
,optional
The number of multi-samples when
aa_type
is"msaa"
. Note that using this setting automatically enables this for all renderers. Defaults to the theme multi_samples.- all_renderersbool, default:
True
If
True
, applies to all renderers in subplots. IfFalse
, then only applies to the active renderer.
- aa_type
Notes
SSAA, or Super-Sample Anti-Aliasing is a brute force method of anti-aliasing. It results in the best image quality but comes at a tremendous resource cost. SSAA works by rendering the scene at a higher resolution. The final image is produced by downsampling the massive source image using an averaging filter. This acts as a low pass filter which removes the high frequency components that would cause jaggedness.
MSAA, or Multi-Sample Anti-Aliasing is an optimization of SSAA that reduces the amount of pixel shader evaluations that need to be computed by focusing on overlapping regions of the scene. The result is anti-aliasing along edges that is on par with SSAA and less anti-aliasing along surfaces as these make up the bulk of SSAA computations. MSAA is substantially less computationally expensive than SSAA and results in comparable image quality.
FXAA, or Fast Approximate Anti-Aliasing is an Anti-Aliasing technique that is performed entirely in post processing. FXAA operates on the rasterized image rather than the scene geometry. As a consequence, forcing FXAA or using FXAA incorrectly can result in the FXAA filter smoothing out parts of the visual overlay that are usually kept sharp for reasons of clarity as well as smoothing out textures. FXAA is inferior to MSAA but is almost free computationally and is thus desirable on low end platforms.
Examples
Enable super-sample anti-aliasing (SSAA).
>>> import pyvista as pv >>> pl = pv.Plotter() >>> pl.enable_anti_aliasing('ssaa') >>> _ = pl.add_mesh(pv.Sphere(), show_edges=True) >>> pl.show()
See Anti-Aliasing for a full example demonstrating VTK’s anti-aliasing approaches.