Anti-Aliasing
LightningChart® .NET supports anti-aliased rendering. It can be applied for objects having AntiAliasing-property. With anti-aliasing, lines etc. can be rendered with smoothened edges, resulting in a more polished graphical representation, but with a performance cost as it increases the CPU/GPU overhead.
Enabling Anti-Aliasing
Anti-aliasing can be controlled through AntiAliasing-property, which is set via a boolean value or LineAntialias-enumeration depending on the related component. For the latter, there currently are two options available:
LineAntialias.None; // No anti-aliasing
LineAntialias.Normal; // Anti-aliasing
For example,
seriesEventMarker.Symbol.Antialiasing = true;
pointLineSeries.LineStyle.AntiAliasing = LineAntialias.Normal;
Anti-aliasing is also affected by chart’s AntiAliasLevel (see RenderOptions/ChartRenderOptions). It is a factor defining the applied anti-aliasing mode based on the selected rendering engine (DirectX9 and DirectX11). Setting anti-aliasing level to 0 or 1 will result into no anti-aliasing to be applied on rendering even if the AntiAliasing-property for the individual components is set to true or LineAntialias.Normal.
AntiAliasLevel can be set through chart’s rendering options (RenderOptions/ChartRenderOptions):
// Anti-aliasing factor. Values 0 and 1 result into no anti-aliasing applied.
chart.ChartRenderOptions.AntiAliasLevel = 2;
Without setting the value manually AntiAliasLevel defaults to 4 or 8.
DirectX11 Anti-Aliasing
On DirectX11 there are a couple of common features, which should be taken into account, when rendering with anti-aliasing:
- Setting AntiAliasLevel overrides the AntiAliasing-property if set to a value greater than 1, meaning that the rendering will be done using anti-aliasing even if the AntiAliasing-property has been set to be false or LineAntialias.None. The only exception of this is if LineOptimization.Hairline is applied (only available with 3D rendering).
- LineAntiAliasType can be used to choose whether alpha-blending (ALAA)- or quadrilateral anti-aliasing (QLAA) is used (see RenderOptions/ChartRenderOptions):
LineAntiAliasingType.ALAA; // Alpha-blending anti-aliasing.
LineAntiAliasingType.QLAA; // Quadrilateral anti-aliasing.
chart.ChartRenderOptions.LineAAType2D = LineAntiAliasingType.ALAA;
On 3D rendering with DirectX11, all triangle lines are always rendered with anti-aliasing unless the AntiAliasLevel is set to 0 or 1.