Anti-aliasing
Smooth jagged edges with MSAA, FXAA, SMAA or TAA, sharpen the result with contrast-adaptive sharpening, and which methods work in web builds.
Anti-aliasing smooths the jagged, stair-stepped edges of polygons and the shimmering of thin details. Every method is a component on the camera. MSAA is on by default; the others are post-processing passes you add.
Choosing a method#
| Method | Component | Quality | Cost | Web builds |
|---|---|---|---|---|
| MSAA | Msaa | Clean geometry edges; does nothing for texture or shader aliasing. | Grows with the sample count and with lots of small triangles. | Yes |
| FXAA | Fxaa | Smooths every edge, slightly blurry. | Very cheap. | Yes |
| SMAA | Smaa | Sharper than FXAA, better on text and thin lines. | Cheap. | Yes |
| TAA | TemporalAntiAliasing | Best overall, also on textures and shading; can ghost on fast motion. | Needs extra prepasses. | No |
A common choice is MSAA alone for simple scenes, SMAA when you turn MSAA off for an effect, and TAA on the desktop for the cleanest image. Example: cargo run --example anti_aliasing (desktop only) lets you switch between them.
MSAA#
Msaa is a component on the camera with four values: Off, Sample2, Sample4 (the default) and Sample8.
commands.spawn((Camera3d::default(), Msaa::Sample8));Turn MSAA off (Msaa::Off) when you use TAA, SSAO, SSR or deferred rendering, and in web builds when you use motion blur. Materials with AlphaMode::AlphaToCoverage get smoother cut-out edges with MSAA on.
FXAA#
use neo::anti_alias::fxaa::{Fxaa, Sensitivity};
commands.spawn((
Camera3d::default(),
Msaa::Off,
Fxaa { edge_threshold: Sensitivity::Ultra, ..default() },
));edge_threshold and edge_threshold_min take Sensitivity::Low, Medium, High (the default), Ultra or Extreme. Higher sensitivity smooths more edges and blurs more detail.
SMAA#
use neo::anti_alias::smaa::{Smaa, SmaaPreset};
commands.spawn((Camera3d::default(), Msaa::Off, Smaa { preset: SmaaPreset::High }));SmaaPreset is Low, Medium, High (the default) or Ultra. SMAA uses lookup tables from the smaa_luts feature, which NEO's builds include.
TAA#
Temporal anti-aliasing jitters the camera slightly each frame and blends the results over time:
use neo::anti_alias::taa::TemporalAntiAliasing;
commands.spawn((Camera3d::default(), Msaa::Off, TemporalAntiAliasing::default()));- It adds the depth and motion-vector prepasses and the camera jitter for you.
- The camera must have
Msaa::Off; with MSAA on, the engine warns and TAA doesn't run correctly. - Set
reset: trueafter a camera cut or teleport to drop the old frames and avoid ghosting. - Alpha-blended meshes don't write motion vectors, so they can smear.
- It pairs with
ShadowFilteringMethod::Temporaland SSAO, whose noise it smooths.
TAA needs the depth prepass, which WebGL 2 can't read, so don't use it in web builds. Guard it with #[cfg(not(target_arch = "wasm32"))] if your game also ships there.
Sharpening#
Anti-aliasing softens the image a little. ContrastAdaptiveSharpening brings detail back, and pairs well with TAA:
use neo::anti_alias::contrast_adaptive_sharpening::ContrastAdaptiveSharpening;
commands.spawn((
Camera3d::default(),
ContrastAdaptiveSharpening { sharpening_strength: 0.6, ..default() },
));sharpening_strength runs from 0 to 1 (default 0.6). Leave denoise off.
Not in NEO's builds#
DLSS (Dlss) needs the dlss cargo feature and NVIDIA's SDK; NEO's builds don't include it.