Post-processing
Estella runs full-screen post-processing through ping-pong framebuffers. Add a
PostProcessVolume component, enable the effects you want, and tune their
parameters — in the editor or in code. Effects share the ping-pong buffers, so
several can stack in one frame at no extra target cost beyond the passes.
Built-in effects
Section titled “Built-in effects”| Effect | What it does | Key uniforms |
|---|---|---|
bloom |
Glow on bright areas | threshold, intensity, radius |
tonemap |
ACES filmic tonemapping | exposure, curve |
colorGrade |
Exposure / contrast / saturation / white balance, split toning, S-curve and a tinted black level | exposure, contrast, saturation, temperature, tint, shadowTint, highlightTint, toneLow, toneHigh, curve, lift |
lutGrade |
Color grading through a lookup-table texture, on scene values in the chain | u_lut (texture), intensity |
displayLut |
A look read off a lookup table by the picture as the display shows it, in the last pass after the output transform | u_lut (texture), intensity |
agx |
The AgX view transform Blender uses: scene-linear in, display-linear out, so it goes last and the output transform stays none. Brings its own table |
contrast (the look: 1 is AgX Base, 1.2 is Medium High Contrast) |
vignette |
Darkened screen edges: full at radius, soft for softness inside it. roundness 0 follows the frame (1 is the middle of an edge), 1 is a circle whose 1 is the corner |
intensity, softness, radius, roundness |
chromaticAberration |
RGB fringing | intensity |
blur |
Gaussian blur | intensity |
fxaa |
Fast anti-aliasing | intensity |
mist2d |
Drifting banks of mist laid over the ground in world units. Reads no depth, so a 2D scene can have it; what is lit glows through it | density, coverage, scale, speed, direction, glow, colour |
fog2d |
Fog of war for a scene with no depth: ground never seen is dark, ground seen and left is remembered, dimmed and drained of colour, ground in view is as drawn; needs a FogOfWar |
remembered brightness and desaturation, unexplored colour |
rain2d |
Rain for a scene with no depth: streaks, rings and splashes and puddles on the ground in world units, dry under a RainShelter sprite |
intensity, wetness, puddles, puddleScale, rippleScale, wind, speed, streakLength, colour |
distanceFog |
Linear fog by distance from the camera | near, far, intensity, colour |
heightFog |
Exponential height fog with the sun’s glow and a hazy horizon | density, heightFalloff, baseHeight, sunAzimuth, sunElevation, skyFog, colours |
skyAtmosphere |
An atmosphere that scatters the sun’s light, with sun, moon, stars and volumetric clouds, drawn where there is no surface | intensity, haze, altitude, clouds, cloudBase, cloudThickness, windSpeed, overcast, sunAzimuth, sunElevation |
starfield |
Stars drawn a pixel or two across at any resolution, in three layers of brightness, added over whatever sky is already there (an environment’s panorama); with sunSize above 0, also the first directional light as a disc with a glow |
intensity, density, size, band, bandTilt, bandTurn, sunSize, sunGlow |
voxelGI |
Diffuse global illumination from a world-space voxel cache the camera remembers (WebGPU compute; fragment passes on WebGL2) | intensity, rays, voxelSize, range, maxBounce, decay, blend, divisor |
sharpen |
Sharpening that cannot make a halo (a compute pass on WebGPU, a fragment pass of the same arithmetic on WebGL2) | intensity, limit |
lightShafts |
Sun rays through whatever stands in front of it | intensity, sunAzimuth, sunElevation, decay, reach |
ssao |
Ambient occlusion from a ring of depth samples around each point | radius, intensity, bias, power |
gtao |
Ground-truth ambient occlusion: the horizon each point can see, integrated against its own normal | radius, intensity, power, thickness |
subsurface |
Light spreading through a marked surface: its lit colour blurred along it, red furthest | width, strength, color |
contactShadows |
The small sharp shadows at a contact a shadow map is too coarse to hold | intensity, length, thickness |
ssgi |
One bounce of diffuse light between the surfaces the camera sees | intensity, radius, thickness, maxBounce |
autoExposure |
Eye adaptation: exposure follows how bright the picture is | bias, speedUp, speedDown, minEV, maxEV |
depthOfField |
Blur by distance from a focus | focusDistance, focusRange, aperture, maxBlur |
rain |
Falling rain or snow, wet ground, puddles, ripples on the puddles and splashes elsewhere | intensity, wetness, wind, speed, puddles, puddleScale, snowfall |
ssr |
Screen-space reflections: props mirrored in the floor they stand on | intensity, maxDistance, thickness, floorBias, skyReflection |
taa |
Temporal anti-aliasing: edges smoothed over several frames, moving meshes followed by their own motion | blend, objectMotion |
lensDistortion |
Barrel / pincushion warp | strength, zoom |
motionBlur |
Smears what moved since the last frame: the camera’s move from the depth buffer, a moving mesh’s own from the motion pass | intensity (the shutter), maxBlur, objectMotion |
filmGrain |
Noise the size of a film crystal, strongest in the mid-tones, crawling with the clock | intensity, size, response |
lensFlare |
Ghosts and a halo thrown by whatever is brighter than a threshold, with a colour fringe | intensity, threshold, ghosts, dispersal, haloWidth, chromatic, tint |
pixelate |
Block quantization | pixelSize |
palette |
Holds the picture to a palette: each pixel becomes the nearest colour of a strip image (N by 1, one colour a pixel, up to 64), after an ordered dither. Put it last and set the texture to the palette image (import it with nearest filtering) | strength, dither, ditherScale (match the art’s pixel size), palette |
outline |
Ink-edge outlines (Sobel edge darkening) | intensity, threshold, thickness |
depthOutline |
Black outline where the depth steps (a silhouette, not shading) | intensity, threshold, thickness |
edgeOutline |
A coloured line at silhouettes and creases: where the camera distance steps, and where the surface normal turns (needs surfaces that write a normal: lit meshes, Model, Toon) | intensity, depthThreshold, normalThreshold, thickness, colour lineColor |
grayscale |
Desaturate | intensity |

The Post-process Effects example: Bloom makes bright pixels bleed a soft glow.
Anti-aliasing before the chain
Section titled “Anti-aliasing before the chain”Geometry edges are smoothed by MSAA on the scene itself, not by an effect: 4×
by default, on WebGL2 and on WebGPU — which is what every native build (iOS,
Android, desktop, Steam) runs on. createWebApp({ msaaSamples }) sizes it, and
msaaSamples: 1 turns it off where the fill cost matters more than the edges.
fxaa is the cheaper, blurrier alternative for devices where even one sample
extra is too much.
Motion blur and the lens
Section titled “Motion blur and the lens”motionBlur needs no setup: add it and it follows the camera by the depth buffer and any moving mesh by the same
motion pass temporal anti-aliasing uses, so a mesh that moves by itself is smeared along its own path and not the
camera’s. intensity is the shutter — 0.5 is the half-frame exposure of a 180° shutter, 1 a whole frame — and
maxBlur caps the streak as a fraction of the picture so a cut or a teleport smears a little and not the frame.
It draws the picture still when the camera has not moved, and it does not shift the picture sub-pixel the way a
temporal effect does, so it can be used without taa.
filmGrain and lensFlare are plain post effects. The flare reads the picture itself, so it only has something to
throw where the picture holds values above threshold: a bright sun disc, a lamp, an emissive surface (in HDR).
The sky and thin geometry
Section titled “The sky and thin geometry”skyAtmosphere draws the sky after the scene, under it. For that to leave a wire or a railing thinner than a pixel whole, the
scene is cleared to nothing while the effect is in the chain and its alpha says how much of each pixel geometry covers, so the
sky is laid under an edge by that share instead of replacing the pixel. Nothing downstream sees it: the effect hands back alpha 1.
Turn Keep Background up and the scene is cleared to the camera’s colour again, which is what keeping the background means.
starfield, and any sky defined with over, adds its light to a sky already drawn (a nebula ahead of it in the chain, or the
environment’s panorama) and is laid under the scene the same way: it reads how much of each pixel geometry covers from the scene as
it was drawn, before any sky effect ran, so a blended surface in front of the sky (a planet’s ring, glass, smoke) hides the stars by
its own opacity. Where the environment’s panorama is drawn as the background, the panorama is part of what the scene drew, and the
stars are added wherever the depth is still the far plane.
Clouds
Section titled “Clouds”skyAtmosphere marches its clouds through the air, and the sun lights them from inside: each step asks how much of the cloud lies between it and the sun, so the far side of a deep cloud is dark and its thin edge is bright. Silver Lining is how bright that edge is near the sun.
| Setting | What it does |
|---|---|
| Cloud Coverage, Cloud Base, Cloud Thickness | How much of the sky the main layer covers, and where it stands, in kilometres. |
| Cloud Scale, Cloud Softness | How large its clouds are (2 is half as wide), and how soft their edges are. |
| Cloud Change | How fast their shapes change as they go. 0 keeps each cloud as it is. |
| Wind Speed, Wind Direction | How fast they drift, in kilometres a second, and which way. |
| Upper Layer Coverage | A second layer. 0 (the default) costs nothing. |
| Upper Layer Base, Thickness, Scale, Wind | Its own height, grain and share of the wind. It is usually high, thin and faster; set below the main layer it stands in front of it. It casts a shadow too. |
Clouds keep to the game’s clock. Where they are is what the wind has done so far, added up frame by frame, so a stronger wind or one that swings round carries them on from where they are, and a Weather can speed them up in the middle of a transition with nothing jumping. A paused game has a still sky, and the same steps make the same one. The fog’s shafts read the same place. To bring a sky back from a save, store skyClockState() and hand it to setSkyClockState().
Baked clouds
Section titled “Baked clouds”Baked Clouds (u_bakedClouds: 1) is the low tier, for a phone or a mini-game. The clouds are marched for a 512 x 512 panorama of the
dome instead of for every pixel, a sixteenth of it a frame, and each sky pixel reads its direction from it: the dome is new every sixteen
frames, which drifting clouds kilometres up do not show. Until the panorama is full, and for a sky on a planet, the clouds are marched as usual.
While the panorama is whole the cloud pass is a shader that only reads it. On Wilds at 3840 x 2160 the cloud pass took 3.9-4.4 ms marched
and 1.2-2.1 ms baked, plus 0.07 ms for the strip; on either backend the two skies
come out alike (the sky-clouds-marched and sky-clouds-baked render checks). The panorama is eight bits a channel and is read through a
small blur, so the clouds are a little softer than marched.
world.insert(volume, PostProcessVolume, { effects: [{ type: 'skyAtmosphere', enabled: true, uniforms: { u_bakedClouds: 1 } }] });Limits of the clouds
Section titled “Limits of the clouds”- Clouds are seen from below. A camera above the cloud layer sees none of it, so a flight over the clouds has no cloud tops to show.
- Their grain. The march’s jitter is filtered on the way back to full size, and a faint pattern can still show near the horizon or at a large Cloud Scale.
- The fog’s shafts stand under the main layer only. The upper layer does not make beams.
- Where a cloud is does not change the key light. Its shadow is laid on surfaces in the sky’s pass; the light’s own strength follows the weather, not the cloud in front of the sun.
- Not measured on a device. The upper layer adds 12 samples of its density to each half-size pixel it covers against 64 for the main layer, and nothing at 0.
Cloud shadows
Section titled “Cloud shadows”Turn Cloud Shadows above 0 and the sky draws a cloud shadow map before the scene: for a square round the camera, 16 km each way, what of the sun is left after its ray climbs through the cloud layer, against the same density the sky draws. The first directional light reads it where each surface is shaded, as Unreal’s atmosphere sun reads its clouds’ shadow map: the ground is darker and patchier under a cloud and lit where the sky is open. Only the sun’s light is kept off. The sky’s own light (ambient and reflections), other lights and what a surface gives off are not dimmed, so a shaded field keeps its sky colour and an unlit or emissive object is as bright under a cloud as out of it. Casting shadows also pins the clouds to the world instead of carrying them along with the camera, so walking under a cloud and out of it works. The sky is in kilometres and the scene in its own units: World Units per km says how many of the scene’s units make one, and left alone it follows the project’s Units per Metre (100 000 in a centimetre project, 1000 in a metre one). At 0 (the default) the effect is exactly as it was.
The map is one tile of the sun’s shadow atlas. With the atlas full (the High quality level’s four cascades fill it) the sun gives up its farthest cascade to it. Its value is the light left at the camera’s own height on each ray, which is exact under the cloud layer and an estimate for a camera inside it. Beyond 16 km, and where no sky casts clouds, the sun is not dimmed.
Split toning and lifted blacks
Section titled “Split toning and lifted blacks”A film look is mostly where its colour goes in the shadows and the highlights, and Color Grade has the three controls for it. They act on the picture as the display shows it, so put the grade after Tonemap: before it, 0 to 1 is only part of the scene’s light.
- Shadow Tint and Highlight Tint multiply what is dark and what is bright, blended by luma between Tone Low and Tone High (0.03 and 0.55
by default). White is no change; they are multipliers and are not colour-managed, so
(0.80, 1.01, 1.13)in the shadows and(1.07, 1.0, 0.90)in the highlights is teal and warm, and may go above 1. - S-Curve blends in a smoothstep about the picture’s range: shadows sink a little, highlights lift. 0 is off.
- Gain and Offset are a grade’s slope and offset: every tone is multiplied by the gain, then the offset is added. An offset under zero
sinks the blacks, and what is darker than it is black, which a contrast through mid-grey does not do in a linear project (there it is a
power curve about 0.18 and leaves black where it was). A contrast written elsewhere as a line through 0.5,
(c - 0.5) * k + 0.5, is a gain ofkand an offset of0.5 - 0.5 * k: 1.04 isu_gain1.04 andu_offset-0.02. - Lift is a tinted black level, added to every tone at a tenth of its colour, so
(0.06, 0.085, 0.11)lifts the blacks by about(0.006, 0.0085, 0.011)toward teal and a scene with no black left reads as air rather than as ink.
The defaults are white, white, black and 0, so an existing grade does not change.
Rain, wet ground and puddles
Section titled “Rain, wet ground and puddles”rain is a storm in two parts. Falling rain is three layers of thin slanted streaks scrolling down the
screen, each standing at its own distance: a streak is hidden by a surface nearer than its layer and drawn
over one farther away, and the sky counts as infinitely far. Wet surfaces are everything the rain falls on,
darkened by wetness because water in the pores takes the light a dry surface scatters. The darkening is full on
ground that faces the sky and a little less (down to 0.6 of it) where a surface faces away, taken from the surface’s own
normal where the G-buffer has one (a leaf’s) and from the depth buffer elsewhere, so a hillside and a plant in a storm
darken with the flat ground beside them instead of standing out pale. What needs flat ground — a surface that faces
up, flat enough to hold water — is the standing water and the drops that land on it, which leave ripples (rings that spread and fade) where water stands and
splashes (a bright point and a few droplets thrown out, gone in a moment) on ground that is not water, laid out on a grid in the world so they
stay on the ground when the camera moves. Ripples need drops: with intensity at 0 the ground is wet and still.
Puddles are standing water: puddles is how much of the flat ground is under it and puddleScale how big the
pools are, a world length. A pool is darker still and is the only place a drop leaves a ring; it takes no splashes.
Snowfall draws soft flakes in the same three layers as the rain, drifting and swaying, none under a roof; it neither wets nor rings the ground. The Snow weather sets it, and lays snow with Snow Cover. Where a puddle
lies is a function of the world position and of the ground around it: the noise places the pools, and the depth buffer
says which places are low — a point lower than the ground within a pool’s reach holds more water, one on a rise holds
less, and flat ground keeps the coverage it was given. Pools therefore gather against a kerb, in a dip and at the foot
of a slope, and they do not move with the camera. A puddle is also a mirror, and
that is the reflections effect’s part: give ssr the same puddles and puddleScale and the pools the rain
darkens are the pools that reflect — flat, whatever the ground under them, and far more reflective than a dry surface,
with a sharp reflection where a dry one is blurred. Wet ground in general is shinier than dry: raise ssr’s intensity
when it rains.
Shelter. Rain does not fall through a roof. While a rain effect is in the chain the frame draws the scene once from straight
above, depth only, in a 1024² square around the camera (shelterRange world units each way) — a map of the highest surface at
each place — and the effect asks it whether something stands over a point. Ground under an awning stays dry and still (no
wetness, no puddles, no ripples), the streaks of a layer that stands under a roof are not drawn, and the drops that would have
fallen there have landed on the awning, which is open to the sky and is wet in its turn. It costs the depth-only draw of the
resident meshes in range, so keep shelterRange to the reach you need; ground outside the map is treated as open.
The clock is the game’s. A capture that has to be the same on every run sets timeScale to 0 and phase to the time it
wants. What this is not: the ground’s shape is read from what the camera sees (a hollow behind a wall is not known),
and the rain is a screen-space layer, not particles that collide with the world.
Subsurface scattering
Section titled “Subsurface scattering”Skin, wax, marble and leaves show the lit picture softened along the surface, each colour by a different amount: red
travels far, blue barely. subsurface is that blur, as an x pass and a y pass over the finished picture. Which
surfaces take part is the material’s choice — a Model material with u_subsurface above zero marks its pixels (it
draws them with alpha 0.996, which nothing on screen shows and which the effect gives back as 1) — and the effect
decides how far: width is a world length for the widest colour, color the proportions between the channels (the
brightest travels the full width), strength how much of the blur is mixed in. A marked pixel gathers only from marked
neighbours on the same surface, so an ear does not bleed into the wall behind it.
It blurs the lit colour as it stands, specular included, so a sharp highlight on a scattering surface is softened with it, and the width belongs to the effect, so every scattering material in view shares it. The effect needs scene depth like ambient occlusion does, and the low quality level leaves it out.
Ambient occlusion
Section titled “Ambient occlusion”Two estimators share one blur and one composite. ssao counts how many of a ring of nearby points stand above the
surface; it is the cheaper of the two and needs a bias so that a flat floor does not shade itself. gtao marches
the depth buffer along a few slice planes through each pixel, finds how high the horizon climbs on both sides, and
integrates the arc that is left open, weighted by the surface’s own normal — so there is no bias to set, a flat floor
stays white, and a crease darkens by how closed it really is. radius is a world length in both. thickness (GTAO) lets
a thin occluder such as a railing be seen past. Both read scene depth, run at half resolution and blur without crossing
a depth edge. Quality levels govern both through the one ambient-occlusion switch, and the low level leaves GTAO out.
Contact shadows and bounce light
Section titled “Contact shadows and bounce light”contactShadows marches a short ray from each pixel toward the sun (the scene’s own directional light, like the fog) in the depth
buffer, length world units long, and darkens the pixel by intensity where the ray passes just behind what the depth buffer shows
(thickness says how thick a thing may be and still count). It is for what a shadow map is too coarse to hold — a lamp’s foot, a fold of
cloth, the crack under a door — and is laid over the finished picture, so it is a correction at the contact and not a second shadow.
ssgi is one bounce of diffuse light from what the camera can see. It needs the G-buffer: from each surface eight
rays leave over its hemisphere around the stored normal, each is marched six steps up to radius in the depth buffer, and what it lands on
gives out its colour (the scene’s, so the bounce feeds itself over frames). The gather runs at half size into a float target; the second pass averages
the neighbours that lie on the same surface and adds the light times the receiver’s own colour, so a red wall tints the white floor
beside it and a grey wall bounces grey. It is a screen-space estimate — it sees only what is on screen, and a light that moves lights its
surroundings with it, which a baked light cannot do — and it is noisier than it looks in one frame: taa averages what is left.
Auto exposure
Section titled “Auto exposure”autoExposure is the eye: it measures how bright the picture is and settles the exposure that puts
it at middle grey. The measurement is the average of the log of the luminance, since brightness
is judged by ratio and a raw average is decided by whatever lamp is in view; pixels darker than 2^-8
are left out, because a black backdrop is not a dark scene. The result moves toward its target over time
from where the last frame left it — brighter faster (speedUp) than darker (speedDown), per second, so it does not
depend on the frame rate — and minEV / maxEV bound how far it may go. bias adds stops to the result for a
scene that should sit darker or brighter than grey. metering chooses where the picture is measured: 0 all of it, 1
weighted toward the middle (a soft falloff of radius meterSize), 2 a spot — a disc of that radius at the middle and
nothing else, so a bright window behind a dark face stops deciding the face’s exposure. The measurement and the settled
exposure are kept in float targets of their own wherever the device can render to one, so it works the same in an
8-bit chain, where the picture it exposes is still clamped. Put it before the output transform and before bloom,
so the glow sees the exposure the eye settled on.
Depth of field
Section titled “Depth of field”depthOfField blurs what is not at the focus, leaving a slab focusRange deep sharp. It is three passes: the first settles
where the lens is focused, the second measures how blurred each pixel is (stored beside the colour, in a float target),
the third gathers the blur.
Focus is focusDistance, a world length from the camera — or, with autoFocus on, the distance of the surface under
the point focusX, focusY (shares of the screen’s width from the left and height from the top, nine taps around it so one
pixel does not decide). It moves toward that distance at focusSpeed, in the log of the distance, so a rack focus is a
glide; a point with nothing but sky under it leaves the lens where it was.
The blur radius, in pixels, grows with how far a surface is from the focus as a share of its distance, up to maxBlur;
aperture is the radius of something infinitely far, and the sky counts as that. Each pixel gathers its neighbours over its own
circle, counting a neighbour only to the extent that neighbour’s own blur reaches back: a sharp object in front of a
blurred background does not bleed into it, while a blurred foreground spreads over what is behind it. The sixty-four taps
shift along their spiral by a different fraction at each pixel, which leaves a fine grain that taa averages away.
The bokeh is the shape of the lens: blades of 3 or more makes the aperture a polygon of that many sides (0 is round), turned
by bokehRotation, and a bright point out of focus becomes that shape. highlight makes bright taps count for more, so a lamp
out of focus is a bright shape and not a dim smear.
The G-buffer
Section titled “The G-buffer”Some effects have to know what a surface IS, not only how it looks. An effect whose shader says #pragma gbuffer makes the
frame draw a second colour attachment beside the scene’s, in the same pass and from the same shaders: octahedral normal in
r and g, roughness in b, metalness in a (a is 0 where nothing wrote, and 0.75 + 0.25 × metalness, so an edge that multisampling averaged with an unwritten pixel (at most 0.5) is told from a surface
where something did), 8 bits a channel. The effect finds it at u_gbuffer (GLSL) or t6 (WGSL, read with textureLoad).
It costs one extra RGBA8 target and one extra write per pixel, and only while an enabled effect asks: a frame with no such
effect has no attachment and compiles no variant. What writes it today is the built-in Model shader — what an imported
glTF material becomes, with roughness, metalness and normal map as the material says — and the engine’s plain lit mesh, which records
what it is: a rough dielectric. A sprite, a blended surface, an unlit mesh and a custom shader leave it at 0, and an effect must
treat that as “unknown” and leave the pixel alone, as ssr does.
A shader of your own can write it: it is compiled with ES_GBUFFER defined when the pass has the attachment, and then declares
a second output (layout(location = 1) out vec4, or a struct return in WGSL) and writes the same encoding.
On WebGL2 and WebGPU alike the attachment is multisampled with the scene and resolved with it. A blended draw never writes it — a normal averaged with the one behind it is neither’s — and the scene’s own background clears it to 0.
Voxel GI
Section titled “Voxel GI”voxelGI is diffuse global illumination from a world-space voxel cache. A grid of voxels (128 × 64 × 128 around the camera, voxelSize
world units each) remembers what the camera has seen: every frame the lit picture is written into the voxels its visible surfaces
stand in — their average radiance and the way they face — and what was there before fades by decay. Light is then gathered the way a
path tracer would, but through the grid: from each visible surface a few cosine-weighted rays (rays) are marched cell by cell, and
where one meets a voxel that faces it, that voxel’s radiance is the light it brings. The gather runs at a fraction of the picture’s size
(divisor), is blended over frames (blend) and is upsampled with the depth, so it does not bleed across an edge.
Because the cache is the world’s and not the screen’s, a bright wall that has left the picture still tints the floor beside it, a surface lit
only by another is lit, and a moving light lights its surroundings — the three things the screen-space bounce (ssgi) cannot do.
The defaults are tuned for a world measured in pixels. In a 3D scene where a world unit is a metre, scale the lengths to match: for a character
shot a voxelSize of 0.03 (a cache about four metres across) with a range of 48 voxels, and for ssgi a radius of 0.4 and a thickness of
0.15. Both accept values down to a centimetre.
It is not a trace of the scene’s geometry, and it says so:
- the cache holds the surfaces the camera has seen, at the voxel’s size — a surface it has not seen yet sends no light, and a thin one is as thick as a cell;
- one bounce, diffuse only (no glossy transport), and the picture it is injected from carries last frame’s light, so a bright surface feeds itself a little;
- on WebGPU it runs as compute passes. On WebGL2, which has no compute stage, the same cache is built by three fragment passes into one half-float atlas (2048 × 1024, 32 MB): each atlas texel asks the picture what stands in its voxel, so the result matches the WebGPU one but the gather is always at half size (
divisoris ignored), surfaces seen at a grazing angle are thinner in the cache, and the cost is higher. Thelowquality tier leaves it out on WebGL2; - it costs a grid of memory (about 32 MB), a few passes a frame and one cache per camera.
It is not Unreal’s Lumen: there is no distance-field or hardware ray tracing and no surface cache of the scene’s meshes, which is what lets Lumen light what has never been on screen. Voxel GI is the version of the idea that needs only the picture.
Compute effects (WebGPU)
Section titled “Compute effects (WebGPU)”An effect can be a compute shader instead of a draw: WGSL run over the whole picture, which is how an effect that reads
many neighbours or keeps a result of its own is written without a render pass per step. sharpen is one: each pixel is
pushed away from the mean of its neighbours and then held inside the range they span, so an edge gets steeper without a halo.
A compute effect needs a device with a compute stage, which is WebGPU. On WebGL2 an effect that has a fallback (a fragment pass of the same
arithmetic, as sharpen does: the two draw the identical picture) runs that instead; one that has none is left out of the chain and the picture goes
through as it was, so a compute effect without a fallback is for refining a picture that is already whole: write one that way. Ask postprocess_supportsCompute (or check the backend) if your game needs to know.
Register your own like any other effect, with compute in place of factory:
import { registerEffect } from 'esengine';
registerEffect({ type: 'myInvert', label: 'Invert', compute: { source: INVERT_WGSL, workgroupSize: [8, 8] }, // The params block: these, as f32s, in this order. uniforms: [{ name: 'u_amount', label: 'Amount', min: 0, max: 1, step: 0.01, defaultValue: 1 }],});The shader gets these at group 0, and declares the ones it uses, with an entry point named main:
| Binding | What | Declared as |
|---|---|---|
| 0 | the image so far | texture_2d<f32> |
| 1 | the image it writes, the same size | texture_storage_2d<rgba16float, write> |
| 2 | the effect’s uniforms, as f32s in listed order |
var<uniform> of a struct that starts with them |
| 3 | the size, vec4f(w, h, 1/w, 1/h) |
var<uniform> |
| 4 | the scene’s depth | texture_depth_2d |
| 5 | a linear clamp sampler | sampler |
It is dispatched over the whole picture in groups of workgroupSize, so it checks that its pixel is inside the image.
Fog and atmosphere
Section titled “Fog and atmosphere”heightFog is fog that thins with height: a valley fills, a hilltop clears. Its density falls
off exponentially, so how much of it a ray crosses has a closed form — no marching — and the same
formula makes the horizon hazy and the zenith clear, because a ray skimming the ground stays in
the thick part and one aimed up leaves it at once. Sky pixels have no surface to measure to, so they
take the formula with a very long ray; skyFog says how much of that haze the sky keeps. Looking toward
the sun the haze takes sunColor: give it the sun’s direction as sunAzimuth (degrees from +Z toward
+X) and sunElevation (degrees above the horizon). With followSun on (the default) the effect
ignores them and takes the sun from the scene: the first directional light that shines, its direction
and its colour, so a sun that turns takes its haze with it; the two angles are what a scene with no
directional light falls back to.
volumetric makes the haze carry the sun’s shadows. The air between the camera and each surface is walked in
24 steps against the sun’s shadow map, and every step that stands in light scatters some of it toward the
eye — so a building’s shadow is dark fog and the gap between two of them a beam. It needs a directional light
that casts shadows (the effect reads the same atlas the meshes receive from), and volumeRange says how far
from the camera the air is walked; beyond it the fog still dims but takes no shafts.
cloudShade makes those beams follow the sky’s clouds, so a gap in them is a shaft that stands in the air whichever way the camera looks, not
only toward the sun. The fog marches the sun’s ray up through the cloud layer of a skyAtmosphere with cloudShadow above 0 (the clouds are then
fixed to the world and drift with its wind), against the same density the sky draws; what the clouds cover is dark air. Its beams are as long as
volumeRange, in world units, and a beam through clouds kilometres up needs air that far up: a fog with a low heightFalloff and a volumeRange of
a few kilometres. The sky’s cover, height, thickness and wind are copied onto the fog each frame; they are not settings of the fog’s own.
The clouds may be given their shape by a picture. A skyAtmosphere with a Cloud Mask (u_cloudMask, a tileable coverage texture: linear data, one channel, repeating, 0 clear and 1 dense) and its cloudMaskTile (the kilometres of the cloud layer one repeat covers) draws clouds where the mask says, the noise only eroding the edges; a second, softer and higher mask (u_cloudMask2 with cloudMask2Tile) is folded in at a third. The same clouds shape the shadow they cast on the scene and the beams the fog lights, which read the masks off the sky. A mask is data: no sRGB, no compression. It says nothing of height, so give the layer a modest cloudThickness (under a kilometre): seen low, a thick layer of it smears into streaks along the line of sight.
lightShafts finds the sun’s light through whatever stands in front of it, in screen space: each pixel
marches toward the sun’s place on screen and counts how much of the way is open sky. It needs the
sun on screen or just off it, and only what the depth buffer holds can cast a shaft. Together the two
give the haze-and-rays look of a low sun; lightShafts is still screen-space; the shadowed volume is heightFog’s volumetric.
Fog colours are authored as sRGB and converted for a linear project, the way a clear colour and a light colour are, so the colour you pick is the colour a fully fogged surface shows.
Screen-space reflections
Section titled “Screen-space reflections”ssr reflects what is on screen in the surfaces that face up: a wet street, a polished
floor, a lake’s edge. The reflected ray is marched through the world
and projected back at every step, and a step that lands just behind what the depth buffer shows
is a hit. What it finds is blended over the pixel by a Schlick Fresnel term: faint face-on,
strong at a grazing angle, so the floor shines toward the horizon. A farther hit is blurred more,
which stands in for roughness.
What a surface is comes from the G-buffer: where the scene wrote one, the reflection uses the
surface’s own normal (a normal map’s detail, which depth cannot see), its roughness and its metalness. A rough surface
reflects dimly and blurred, and one rougher than maxRoughness is skipped before the ray is marched, which is most of the
cost; a metal reflects nearly all it receives where a dielectric reflects 4% face-on. wetness makes ground
smoother (a film of water fills the pores), so it reflects as it gets wet, and puddles are mirrors. Where nothing wrote
a record — a sprite, a blended or unlit surface, a custom shader — nothing is guessed: the pixel is left as it was. floorBias
(0 by default) can narrow what reflects further: at 1 only up-facing surfaces do.
Where the ray leaves the picture or goes on to the sky, the surface still reflects the environment the frame’s meshes
reflect, at the sharpness its roughness gives; skyReflection says how much (0 turns it off). So a puddle shows the sky and
what lies beyond the edge of the picture, not only the props on screen. maxDistance is a
world length; the step count is fixed, so a longer reach is a coarser march, and the per-pixel
start offset that hides the banding is what taa averages away — use them together.
Temporal anti-aliasing
Section titled “Temporal anti-aliasing”Put taa after every effect whose noise it should average — ambient occlusion, contact shadows, global illumination,
reflections, fog. A temporal pass resolves what runs before it; a speckle added after it reaches the screen as it is. In the
Bistro example moving taa from second place to after the fog lowered the grain on a flat wall by a quarter. The editor marks a
taa that has such an effect after it with a warning tag.
taa smooths what MSAA cannot reach — shader aliasing and thin geometry — by
accumulating frames. While the effect is in the chain the engine shifts the picture by
a different sub-pixel amount each frame (eight positions, repeating), keeps the effect’s
last output, and blends the two. Where a pixel was last frame comes from the depth
buffer: the pixel is un-projected to the world and projected with the previous
frame’s camera, so a moving camera keeps its history. blend is the share of each
frame that is new: lower is smoother and slower to follow a change, 1 is no accumulation.
Put it first in the chain, so everything after it sees the settled image, and keep
msaaSamples on — the two add. Each camera keeps its own history.
The camera’s motion says where history was for everything that stood still. An object
that moves by itself is a different case, so while the effect is in the chain the frame
draws the moving meshes a second time into a target of its own, writing how far each
pixel travelled since last frame, and the effect follows that instead where it is the
surface the scene shows. This is why a thin, fast mover keeps its contrast instead of
fading into the floor behind it. It costs one extra draw of only what moved (nothing,
for a frame where nothing did) and an RGBA32F target the size of the scene, so it needs
float render targets, and is skipped on a device without them. objectMotion at 0
turns it off, which leaves the camera’s answer alone. A skinned mesh is followed by its
bones: the frame remembers the palette each one was drawn with last time. What it does not
follow is a blended surface and motion a material’s vertex hook adds — those fall back to
the camera’s answer, clipped into the colours around the pixel. TAA needs scene depth like SSAO does, so on WebGPU
it cannot run with multisampling on a scene that has no depth resolve.
The uniform names above are the friendly labels; in code they are u_-prefixed
(u_intensity, u_exposure, …). A few effects are identity at their defaults
(colorGrade, lensDistortion, lutGrade with no table bound),
so adding them changes nothing until you dial them in. Most are visible the moment
you add them — grayscale (full desaturation), vignette, bloom, blur (intensity 2),
chromaticAberration (3), pixelate (4), outline, and tonemap (the ACES curve always
applies) — so enable those only when you want them.
HDR (linear color space)
Section titled “HDR (linear color space)”When the project renders in the linear color space (see
Lighting), the effect chain runs in half-float HDR
wherever float render targets are available — always on WebGPU, and on WebGL2 with
the near-universal EXT_color_buffer_float. Light accumulation past 1.0 (a
Light with intensity above 1) then survives into the chain instead of
clamping at the 8-bit store:
bloomwiththresholdabove 1 blooms only over-range energy — bright lights glow while ordinary LDR art stays crisp. This is the classic “emissive glow” setup: crank a light’sintensity, setthreshold≈ 1.2–1.5. The glow is built on a pyramid of half-size to 1/64-size images, as Unreal’s and Call of Duty’s are: it falls off round and soft with a long faint tail, andradiuswidens all of it. Keep a bright sky underthreshold, or every dark edge against it takes the sky’s glow.tonemapreceives true HDR input, so the ACES curve rolls off highlights instead of shaping already-clamped values. Fitted ACES (u_curve1) swaps the engine’s curve for the other ACES fit in wide use, the one three.js calls ACES Filmic: it mixes the channels before the curve, so a bright colour goes to white where the engine’s keeps its hue, and its shadows are deeper. A picture made for that curve wants it; three.js also multiplies the exposure by 1/0.6 first, which isu_exposure0.74 here.- Without a tonemap pass, over-range values simply clip at the final linear→sRGB encode — fine for subtle glow, harsh for large over-exposure.
In gamma mode (or without float-target support) the chain is LDR and behaves as
before; a threshold above ~0.75 then never fires.
Output transform
Section titled “Output transform”A scene lit in linear space can hold light brighter than a display can show. The output transform is the one curve the finished frame goes through on its way to the screen — once, after every effect — and it is a project setting, not an effect: Settings → Project → Rendering → Output transform.
| Transform | What it does | Use it for |
|---|---|---|
| None | Encodes only. Values above 1 clip. | Flat 2D art, UI, anything that must round-trip exactly. |
| ACES | A filmic shoulder: highlights roll off, shadows deepen. It desaturates as it goes, so a very bright red drifts toward cream. | Lit 3D scenes that want a filmic look. |
| Neutral | Khronos PBR Neutral: the same roll-off, but hue and saturation survive. A sunlit red stays red. | Product shots, stylised art, anything whose colours are the point. |
It applies to the editor viewport, to Play and to every export, and changing it
needs no reload. In code: outputTransform: 'none' | 'aces' | 'neutral'.
A look authored against the finished picture (a warm LUT from a colourist, a film emulation) belongs after the curve, and no effect in the
chain can be: they all run on scene values, before it. The Display LUT effect (displayLut) is the last pass’s own stage: the picture is
curved, encoded for the display, and then read off a 1024x32 table by the colour it will show: 32 slices along x, blue the slice, red along a slice and green up the picture (an image is read from its bottom).
It adds a texture read to the pass that was running anyway, not a pass, whatever the output transform. A table’s texture is data: no compression, no mips and no sRGB. An image of that shape (N slices of N by N, so 1024 by 32 for 32) is adopted with those settings on its own, in the editor and from the command line. In code, stack.setDisplayLut(textureHandle, amount).
Using a PostProcessVolume
Section titled “Using a PostProcessVolume”In the editor a volume’s effects are listed in the order they run, each with its switch and its parameters (colour parameters included), a fold to hide them, and a tag for what it is for (Lens, Colour, Light, Atmosphere, Anti-aliasing, Stylize); an effect that needs a compute shader says WebGPU only. The add menu groups the effects the same way.
Add a PostProcessVolume, enable effects, and set their parameters. Volumes
blend where they overlap, so you can drive effects by area (a “underwater”
volume) or fade them in over a transition.
| Property | Type | Default | Description |
|---|---|---|---|
effects |
list | [] |
{ type, enabled, uniforms, textures?, colors? } per effect — textures carries texture refs (LUTs, masks), colors colour params. |
isGlobal |
boolean | true |
Apply everywhere vs. only inside the volume shape. |
shape |
'box' | 'sphere' |
'box' |
Bounds shape for a local volume. |
size |
Vec2 | {5, 5} |
Half-extents of a local volume (a sphere uses x as its radius). An optional z is a box’s half-depth; 0 or absent is unbounded in depth. |
priority |
number | 0 |
Higher-priority volumes win where they overlap. |
weight |
number | 1 |
Blend weight, 0..1 (fade the whole volume). |
blendDistance |
number | 0 |
Falloff distance at the volume edge. |
Programmatic control
Section titled “Programmatic control”For a fixed camera pipeline in code, use the PostProcess resource. A stack starts
empty — add one pass per effect. Get the effect’s shader from the registry with
getEffectDef(type).factory(), then set its u_-prefixed uniforms and bind the
stack to a camera:
import { defineSystem, Query, Res, Camera, PostProcess, getEffectDef } from 'esengine';
const setup = defineSystem([Query(Camera), Res(PostProcess)], (q, pp) => { const grade = getEffectDef('colorGrade')!; for (const [camera] of q) { const stack = pp.createStack(); stack.addPass('colorGrade', grade.factory()) .setUniform('colorGrade', 'u_saturation', 1.3) .setUniform('colorGrade', 'u_contrast', 1.1); pp.bind(camera, stack); // pp.unbind(camera) to remove }});A multi-pass effect like bloom exposes def.multiPass; add each sub-pass
(for (const p of grade.multiPass!) stack.addPass(p.name, p.factory())). For
anything beyond a fixed pipeline, a PostProcessVolume is simpler — it resolves
multi-pass and texture params for you.
A sub-pass can read an EARLIER pass of its own effect, not only the one before it: declare
a texture param named u_pass_<name> (#pragma param u_pass_bloom_down_2 texture default(black))
and the chain binds the output of the pass called <name>, keeping it alive until this pass
has run. That is how bloom’s upsample adds back the downsample of its own size; a sub-pass
with scale below 1 draws at that fraction of the chain.
A sky of your own
Section titled “A sky of your own”defineSkyEffect turns one function you write — the sky’s radiance along a direction — into an effect a
PostProcessVolume carries like any other. It is drawn behind the scene, and with Light the Scene on, the engine
reads back a small panorama of it about once a second and makes it the scene’s environment, its diffuse light and
its reflections, as Sky Atmosphere’s is: a stylised sky lights the world with the light it shows.
import { defineSkyEffect } from 'esengine';
defineSkyEffect({ type: 'duskSky', label: 'Dusk Sky', colors: [{ name: 'u_horizon', label: 'Horizon', defaultValue: { r: 0.95, g: 0.55, b: 0.28, a: 1 } }], glsl: `vec3 skyRadiance(vec3 dir, vec3 sun, vec3 sunColor, float env) { return mix(u_horizon.rgb, vec3(0.05, 0.09, 0.14), smoothstep(0.0, 0.4, dir.y)); }`, wgsl: `fn skyRadiance(dir : vec3f, sun : vec3f, sunColor : vec3f, env : f32) -> vec3f { return mix(mc.u_horizon.rgb, vec3f(0.05, 0.09, 0.14), smoothstep(0.0, 0.4, dir.y)); }`,});sun is the first directional light’s direction, sunColor its colour times intensity, and env is 1 while the
panorama is drawn (leave a sun disc out then: the directional light is the sun’s direct light). Return linear
radiance. Params are uniforms (mc. in WGSL), the time is u_time.x, and textures brings tables the sky needs
(wrap: 'repeat' for noise).
A sky with clouds can shade the ground under them. Set groundShadow: true and write a second function beside the
first, float skyShadow(vec3 world, vec3 sun) (WGSL fn skyShadow(world : vec3f, sun : vec3f) -> f32): what is left
of the sun’s light at a world position, 1 for all of it. The engine draws it into the sun’s cloud shadow map before the scene,
as Sky Atmosphere’s Cloud Shadows does with its own clouds, and the first directional light is dimmed by it where each
surface is shaded; the sky’s own light and what a surface gives off are not. A floor of 0 is a shadow as dark as the sky’s
light leaves it. u_cloudShadowExtentKm (16 km by default) is how far the map reaches round the camera.
| Method | Description |
|---|---|
PostProcess.createStack() |
Create an empty effect stack. |
stack.addPass(name, shader) |
Add an effect pass; shader from getEffectDef(type).factory() (chainable). |
stack.setUniform(pass, uniform, value) |
Set a u_-prefixed parameter (chainable). |
stack.setTexture(pass, uniform, handle) |
Bind a texture parameter, e.g. a LUT (chainable). |
stack.setEnabled(name, on) |
Toggle an already-added pass (chainable). |
PostProcess.bind(camera, stack) / unbind(camera) |
Attach / remove a camera’s stack. |
getEffectDef(type) / getAllEffectDefs() / getEffectTypes() |
Look up effect definitions (shader factory + uniforms). |
Texture parameters (LUTs & masks)
Section titled “Texture parameters (LUTs & masks)”Some effects take a texture, not just scalars. lutGrade samples a color
lookup table — a 2D-packed 1024×32 PNG (32 slices of a 32³ cube) — so you can
author a whole grade in an image editor and drop it in. Add the pass, then bind the
texture with setTexture (or, on a PostProcessVolume, list it under the effect’s
textures: { u_lut: <ref> }):
stack.addPass('lutGrade', getEffectDef('lutGrade')!.factory()) .setTexture('lutGrade', 'u_lut', lutHandle) .setUniform('lutGrade', 'u_intensity', 1);In a package
Section titled “In a package”An effect’s definition (its name and parameters) is in every package; its shaders are most of the bytes, so they come in four groups that a package carries only when its content uses one:
| Group | Subpath | Effects |
|---|---|---|
| Basic | esengine/fx-basic |
blur, bloom, vignette, grayscale, colorGrade, lutGrade, chromaticAberration, tonemap, fxaa, sharpen, lensDistortion, pixelate, palette, outline, depthOutline, edgeOutline, filmGrain, motionBlur, lensFlare |
| Atmosphere | esengine/fx-atmosphere |
mist2d, rain2d, fog2d, skyAtmosphere, heightFog, distanceFog, rain |
| Lighting | esengine/fx-lighting |
ssao, gtao, ssr, ssgi, voxelGI, contactShadows, lightShafts, autoExposure, depthOfField, subsurface, taa |
| AgX | esengine/fx-agx |
agx (it carries Blender’s AgX tables, about 80 KB, so a package that uses bloom or a vignette and not AgX does not pay for them) |
The export reads the effects a PostProcessVolume names (and a Weather or TimeOfDay component, which drive the atmosphere group) and imports
the groups they need. An effect you add from a script — getEffectDef('bloom')!.factory() — leaves no trace in the content, so import its group
(import 'esengine/fx-basic') or set the module to Include in Project Settings; otherwise the effect says which group it needs when it is
first used. The editor, and any entry that is not lean, carries all four.
Best practices
Section titled “Best practices”- Order matters — passes run in the order you add them (or, on a volume, the
order of its
effects[]) and share the buffers, so a sensible chain is bloom → tonemap → color grade → vignette. - Use volumes for locality (an area’s mood) and the
PostProcessAPI for a fixed camera pipeline. - Fade with
weighton a volume for smooth transitions instead of toggling. - Keep the stack short on low-end/mobile — each pass is a full-screen draw.
See also
Section titled “See also”- Materials & Shaders — per-object shaders (a separate path).
- Camera — bind a stack per camera.