Skip to main content

Overview

Atlas provides a comprehensive post-processing effects system that can be applied to render targets. Effects are applied via shader uniforms and can be stacked for complex visual results.

Effect Base Class

All effects inherit from the Effect base class.
type
RenderTargetEffect
The type of effect this instance represents.
applyToProgram
virtual void
Applies the effect’s parameters to the shader program.Parameters:
  • program - The shader program to apply the effect to
  • index - The index of the effect in the effect array

RenderTargetEffect

RenderTargetEffect
enum
Available post-processing effects:
  • Invert - Inverts the colors of the rendered image
  • Grayscale - Converts the rendered image to grayscale
  • Sharpen - Applies a sharpening filter to enhance edges
  • Blur - Applies a blur effect to the rendered image
  • EdgeDetection - Detects and highlights edges
  • ColorCorrection - Applies color correction adjustments
  • MotionBlur - Simulates camera motion by streaking samples
  • ChromaticAberration - Separates color channels to recreate lens dispersion
  • Posterization - Reduces available color palette for stylized look
  • Pixelation - Divides screen into coarse blocks (retro aesthetic)
  • Dilation - Expands bright regions outward (glow/bloom)
  • FilmGrain - Adds animated noise to mimic analog film

Effect Types

Inversion

Inverts all colors in the rendered image (white becomes black, red becomes cyan, etc.).
Inversion::create
static shared_ptr<Inversion>
Creates an inversion effect.Returns: Shared pointer to the effect

Grayscale

Converts the rendered image to grayscale by calculating luminance.
Grayscale::create
static shared_ptr<Grayscale>
Creates a grayscale effect.Returns: Shared pointer to the effect

Sharpen

Applies a sharpening kernel to enhance edges and details.
Sharpen::create
static shared_ptr<Sharpen>
Creates a sharpen effect.Returns: Shared pointer to the effect

Blur

Applies a Gaussian blur to the rendered image.
magnitude
float
default:"16.0"
The magnitude (radius) of the blur effect. Higher values create stronger blur.
Blur::create
static shared_ptr<Blur>
Creates a blur effect.Parameters:
  • magnitude - Blur radius (default: 16.0)
Returns: Shared pointer to the effect

EdgeDetection

Detects and highlights edges using an edge detection kernel.
EdgeDetection::create
static shared_ptr<EdgeDetection>
Creates an edge detection effect.Returns: Shared pointer to the effect

ColorCorrection

Applies comprehensive color correction including exposure, contrast, saturation, gamma, temperature, and tint.

ColorCorrectionParameters

exposure
float
default:"0.0"
Exposure adjustment. Positive values brighten, negative values darken.
contrast
float
default:"1.0"
Contrast adjustment. Values > 1.0 increase contrast, < 1.0 decrease it.
saturation
float
default:"1.0"
Saturation adjustment. 1.0 is normal, 0.0 is grayscale, > 1.0 increases saturation.
gamma
float
default:"1.0"
Gamma correction value. Typically around 1.0 to 2.2.
temperature
float
default:"0.0"
Temperature adjustment. Positive values add warmth (red), negative values add coolness (blue).
tint
float
default:"0.0"
Tint adjustment. Positive values add green, negative values add magenta.
ColorCorrection::create
static shared_ptr<ColorCorrection>
Creates a color correction effect.Parameters:
  • p - Color correction parameters (default: {})
Returns: Shared pointer to the effect

MotionBlur

Blends samples along motion vectors to create dynamic blur.

MotionBlurParameters

size
int
default:"8"
Number of samples taken along the motion vector.
separation
float
default:"1.0"
Scaling factor applied to the velocity vector when sampling.
MotionBlur::create
static shared_ptr<MotionBlur>
Creates a motion blur effect.Parameters:
  • p - Motion blur parameters (default: {})
Returns: Shared pointer to the effect

ChromaticAberration

Offsets color channels to emulate lens dispersion artifacts.

ChromaticAberrationParameters

red
float
default:"0.01"
Red channel offset strength.
green
float
default:"0.006"
Green channel offset strength.
blue
float
default:"-0.006"
Blue channel offset strength.
direction
Magnitude2d
Direction toward which the channels shift.
ChromaticAberration::create
static shared_ptr<ChromaticAberration>
Creates a chromatic aberration effect.Parameters:
  • p - Chromatic aberration parameters (default: {})
Returns: Shared pointer to the effect

Posterization

Clamps colors to a fixed number of bands for stylized shading.

PosterizationParameters

levels
float
default:"5.0f"
Number of tonal levels to preserve in the final image.
Posterization::create
static shared_ptr<Posterization>
Creates a posterization effect.Parameters:
  • p - Posterization parameters (default: {})
Returns: Shared pointer to the effect

Pixelation

Renders the scene with large pixel blocks for a retro aesthetic.

PixelationParameters

pixelSize
int
default:"5"
Size, in screen pixels, of each pixelated block.
Pixelation::create
static shared_ptr<Pixelation>
Creates a pixelation effect.Parameters:
  • p - Pixelation parameters (default: {})
Returns: Shared pointer to the effect

Dilation

Expands bright fragments to create a blooming halo.

DilationParameters

size
int
default:"5.0"
Radius, in pixels, used when sampling neighbourhood texels.
separation
float
default:"2.0"
Distance multiplier applied when stepping through neighbour samples.
Dilation::create
static shared_ptr<Dilation>
Creates a dilation effect.Parameters:
  • p - Dilation parameters (default: {})
Returns: Shared pointer to the effect

FilmGrain

Overlays animated grain for a cinematic feel.

FilmGrainParameters

amount
float
default:"0.1"
Intensity of the noise pattern added to each frame.
FilmGrain::create
static shared_ptr<FilmGrain>
Creates a film grain effect.Parameters:
  • p - Film grain parameters (default: {})
Returns: Shared pointer to the effect

Example Usage

// Create a render target
RenderTarget renderTarget(window);

// Add basic effects
auto grayscale = Grayscale::create();
renderTarget.addEffect(grayscale);

auto invert = Inversion::create();
renderTarget.addEffect(invert);

// Add blur effect
auto blur = Blur::create(20.0f);
renderTarget.addEffect(blur);

// Add color correction
ColorCorrectionParameters colorParams;
colorParams.exposure = 0.5f;      // Increase brightness
colorParams.contrast = 1.2f;      // Increase contrast
colorParams.saturation = 1.1f;    // Boost saturation
colorParams.temperature = 0.1f;   // Add warmth
auto colorCorrection = ColorCorrection::create(colorParams);
renderTarget.addEffect(colorCorrection);

// Add motion blur
MotionBlurParameters motionParams;
motionParams.size = 12;
motionParams.separation = 1.5f;
auto motionBlur = MotionBlur::create(motionParams);
renderTarget.addEffect(motionBlur);

// Add chromatic aberration
ChromaticAberrationParameters chromaParams;
chromaParams.red = 0.015;
chromaParams.green = 0.008;
chromaParams.blue = -0.008;
chromaParams.direction = {1.0, 0.0};
auto chromatic = ChromaticAberration::create(chromaParams);
renderTarget.addEffect(chromatic);

// Add retro effects
auto posterize = Posterization::create({3.0f});
renderTarget.addEffect(posterize);

auto pixelate = Pixelation::create({8});
renderTarget.addEffect(pixelate);

// Add film grain
auto filmGrain = FilmGrain::create({0.15});
renderTarget.addEffect(filmGrain);

// Add glow/bloom effect
auto dilation = Dilation::create({7, 2.5});
renderTarget.addEffect(dilation);

// Stack multiple effects for creative results
RenderTarget stylizedTarget(window);
stylizedTarget.addEffect(ColorCorrection::create({
    .exposure = 0.3f,
    .contrast = 1.4f,
    .saturation = 0.8f
}));
stylizedTarget.addEffect(EdgeDetection::create());
stylizedTarget.addEffect(Posterization::create({4.0f}));
stylizedTarget.addEffect(FilmGrain::create({0.12}));

Build docs developers (and LLMs) love