Post-processing
Finish the camera image with HDR, tonemapping, exposure, bloom, colour grading, depth of field, motion blur, vignette, chromatic aberration and lens distortion.
On this page
Post-processing effects change the finished image, after the scene is drawn. Each one is a component you add to a camera; remove it to turn the effect off. They're all part of DefaultPlugins except auto exposure.
HDR and tonemapping#
The renderer computes light in physical units, which can be far brighter than a screen can show. Tonemapping maps that range to the screen's colours.
| Component | In | What it does |
|---|---|---|
Tonemapping | neo::core_pipeline::tonemapping | The curve. Default TonyMcMapface. |
Hdr | neo::camera | Renders into a 16-bit floating-point texture and tonemaps in a separate pass. Bloom and auto exposure add it for you. |
TonemappingPass | neo::camera | Tonemaps in a separate pass without HDR output. Depth of field and motion blur add it. |
DebandDither | neo::core_pipeline::tonemapping | Enabled adds a little noise to hide colour banding in smooth gradients. |
Without Hdr or TonemappingPass, a camera tonemaps inside its material shaders, which saves a fullscreen pass. This is the cheapest path and the default for a single camera on a window. Custom materials that don't call the standard post-lighting functions aren't tonemapped on that path.
Tonemapping | Look |
|---|---|
TonyMcMapface | Neutral, desaturates very bright colours. A good default, and a good match for bloom. |
AgX | Very neutral and slightly desaturated. |
AcesFitted | Filmic contrast with deliberate hue shifts. |
BlenderFilmic | Blender's default view transform. |
KhronosPbrNeutral | Keeps base colours faithful, for product shots. |
SomewhatBoringDisplayTransform, Reinhard, ReinhardLuminance | Simpler curves. |
Linear | No curve; grading, exposure and dither still apply. |
None | No tonemapping at all. |
TonyMcMapface, AgX and BlenderFilmic use lookup tables from the tonemapping_luts feature, which NEO's builds include. Example: cargo run --example tonemapping.
Exposure#
Exposure (in neo::camera) on a camera sets how much light it takes in, as an EV100 value; higher values make the image darker. The default is Exposure::BLENDER (EV100 9.7).
| Preset | EV100 | For |
|---|---|---|
Exposure::INDOOR | 7 | Indoor lighting. |
Exposure::BLENDER | 9.7 | The default. |
Exposure::OVERCAST | 12 | An overcast day. |
Exposure::SUNLIGHT | 15 | Direct sunlight. |
Exposure::from_physical_camera(PhysicalCameraParameters { aperture_f_stops, shutter_speed_s, sensitivity_iso, sensor_height }) derives it from real camera settings. Example: cargo run --example lighting.
Auto exposure#
AutoExposure adjusts exposure over time, like an eye adapting when walking out of a tunnel. Add AutoExposurePlugin yourself, then the component:
use neo::post_process::auto_exposure::{AutoExposure, AutoExposurePlugin};
// App: .add_plugins(AutoExposurePlugin)
commands.spawn((Camera3d::default(), AutoExposure { range: -9.0..=1.0, ..default() }));range limits the EV100 adjustment, speed_brighten and speed_darken set how fast it adapts, and metering_mask and compensation_curve weight parts of the screen and brightness levels. Auto exposure needs compute shaders, so it doesn't work in web builds. Example: auto_exposure.
Bloom#
Bloom makes bright parts of the image glow. It's best with emissive materials whose values go well above 1:
use neo::post_process::bloom::Bloom;
commands.spawn((Camera3d::default(), Bloom::NATURAL));
commands.spawn((
Mesh3d(meshes.add(Sphere::new(0.5))),
MeshMaterial3d(materials.add(StandardMaterial {
emissive: LinearRgba::rgb(13.99, 5.32, 2.0),
..default()
})),
));| Preset | Look |
|---|---|
Bloom::NATURAL | Energy-conserving and subtle. The default. |
Bloom::ANAMORPHIC | Stretched horizontally, like a cinema lens. |
Bloom::OLD_SCHOOL | Additive with a threshold: only bright areas glow, strongly. |
Bloom::SCREEN_BLUR | Blurs the whole screen; useful behind menus. |
Tune intensity, low_frequency_boost, high_pass_frequency, prefilter (threshold, threshold_softness), composite_mode (EnergyConserving or Additive) and scale. Bloom adds Hdr to the camera and works on every platform, including the web. Examples: bloom_3d, bloom_2d.
Colour grading#
ColorGrading (in neo::render::view) adjusts colour before tonemapping:
use neo::render::view::{ColorGrading, ColorGradingGlobal, ColorGradingSection};
commands.spawn((
Camera3d::default(),
ColorGrading {
global: ColorGradingGlobal { exposure: 0.2, temperature: 0.05, post_saturation: 1.1, ..default() },
shadows: ColorGradingSection { saturation: 0.9, ..default() },
..default()
},
));global has exposure (stops), temperature, tint, hue, post_saturation and midtones_range. shadows, midtones and highlights each have saturation, contrast, gamma, gain and lift. ColorGrading::with_identical_sections sets all three at once. Example: color_grading (needs the neo_feathers feature for its UI).
Depth of field#
DepthOfField (in neo::post_process::dof) blurs what's out of focus:
use neo::post_process::dof::{DepthOfField, DepthOfFieldMode};
commands.spawn((
Camera3d::default(),
DepthOfField {
mode: DepthOfFieldMode::Bokeh,
focal_distance: 4.0,
aperture_f_stops: 1.0, // lower values blur more
..default()
},
));Gaussian mode is cheaper; Bokeh gives lens-shaped highlights. max_depth stops blurring the far background, and DepthOfField::from_physical_camera matches a physical camera. Depth of field reads the depth buffer, which WebGL 2 can't, so it's turned off in web builds (the renderer logs a message once). Example: depth_of_field.
Motion blur#
MotionBlur (in neo::post_process::motion_blur) blurs moving objects and camera motion using per-pixel motion vectors:
use neo::post_process::motion_blur::MotionBlur;
commands.spawn((Camera3d::default(), MotionBlur { shutter_angle: 1.0, samples: 2 }));shutter_angle is the blur length (0.5 is a typical film camera), samples its quality. It adds the motion-vector prepass. In web builds, turn MSAA off (Msaa::Off) on that camera: the two don't work together on WebGL 2. Example: motion_blur.
Lens effects#
Three effects in neo::post_process::effect_stack imitate a real lens. They run together in one pass:
| Component | What it does | Main fields |
|---|---|---|
ChromaticAberration | Colour fringes towards the screen edges. | intensity, max_samples, color_lut |
Vignette | Darkens the corners. | intensity, radius, smoothness, roundness, center, color |
LensDistortion | Barrel or pincushion distortion. | intensity, scale, multiplier, center, edge_curvature |
use neo::post_process::effect_stack::{ChromaticAberration, Vignette};
commands.spawn((
Camera3d::default(),
ChromaticAberration { intensity: 0.02, ..default() },
Vignette { intensity: 0.6, ..default() },
));Example: cargo run --example post_processing.
Your own effects#
Write a fullscreen shader with FullscreenMaterial; see Custom materials and shaders.