Two Routes
- Direct. The scene is drawn straight onto its destination: the game window, the Web page's canvas or an editor view.
- Through the scene color target. The scene is drawn into an offscreen image, the scene color target, which holds color and depth at the destination's size in pixels. A final pass then draws the target's color onto the destination and applies the effects.
Which Route a Scene Takes
| Scene | Color Space | Effect that changes the picture | Route |
|---|---|---|---|
| 3D | either | either | scene color target |
| 2D | Linear | either | scene color target |
| 2D | Gamma | yes | scene color target |
| 2D | Gamma | no | direct |
An effect can change the picture when all three of these hold:
- The effect is enabled in the scene's profile or in a temporary runtime layer.
- Its values change something. An effect at Intensity 0, Color
Adjustments at their neutral values, or Tonemapping with Mode set
to
Nonechanges nothing and does not count. - The camera that draws the view has Post Processing ticked.
A Linear project draws every scene through the target so that the scene is lit and blended in linear light. See Gamma and Linear color space.
A 2D scene of a Gamma project drawn through the target with no effect gives the same pixels as the same scene drawn directly.
Whether a scene is 2D or 3D comes from the dimension stored in its scene file. A scene file that stores no dimension is treated as 3D.
What the Effects Reach
These are drawn into the scene color target, in this order:
- The scene background.
- For a 3D scene, the shadows, then the skybox.
- The scene renderers, including backdrop sprites. For a 2D scene, this includes 2D lighting and shadows.
The final pass follows. UI canvases and the diagnostics overlay are drawn after the final pass, so no effect touches them. Bloom does not glow from UI, Vignette does not darken it, and Tonemapping and Color Adjustments leave its colors as they are.
What the Final Pass Does
| Color Space | No effect on | An effect on |
|---|---|---|
| Gamma | Copies the target onto the destination. No shader runs. | Reads the scene color, adds Bloom and Lens Flare on display values, converts the color to linear, applies Vignette, Color Adjustments, Tonemapping and Film Grain, and encodes the result for the display. |
| Linear | Encodes the target's linear color for an sRGB display. | Applies every effect on linear values, then encodes the result for the display. |
Alpha passes through unchanged in every case.
Vignette, Color Adjustments, Tonemapping and Film Grain work on linear color in both color spaces, so a profile's values for those effects give the same result in a Gamma project and a Linear project.
The display encode writes values between 0 and 1. Scene color above 1 clips to white unless Tonemapping brings it into range first.
Order of the Effects
The final pass is one shader and one draw. Its steps always run in this order:
- Peripheral Warp and Chromatic Aberration, applied when the scene color is read.
- Bloom.
- Lens Flare.
- Vignette.
- Color Adjustments: Post Exposure, Contrast, Color Filter, Saturation.
- Tonemapping.
- Film Grain.
- The display encode.
The Inspector lists the effects in a different order. That order has no effect on the order above.
When an Effect Adds Work
An effect's step is part of the final pass only when the effect is enabled and its values change the picture:
| Effect | The step runs when the effect is enabled and |
|---|---|
| Tonemapping | Mode is Neutral or ACES |
| Color Adjustments | at least one field differs from its default |
| Bloom | Intensity is above 0 |
| Vignette | Intensity is above 0 |
| Film Grain | Intensity is above 0 |
| Chromatic Aberration | Intensity is above 0 |
| Lens Flare | Intensity is above 0, and Ghost Count or Halo Radius is above 0 |
| Peripheral Warp | Intensity is above 0, and Ripple Amplitude or Chromatic Separation is above 0 |
A step that does not run adds no work. Each combination of steps is compiled into a shader the first time a frame needs it, and kept.
Bloom and Lens Flare read an image built before the final pass, the bloom chain. It is drawn only when one of the two runs. See Post-processing limitations and costs.
Target Format
| Color Space | Format asked for | Holds |
|---|---|---|
| Gamma | RGBA8 | 8 bits per channel, display values from 0 to 1 |
| Linear | RGBA16F | 16-bit float per channel, linear values, including values above 1 |
When the device cannot render to an RGBA16F target, the target is built as RGBA8 and this warning is logged once:
Scene colour target format: RGBA8. RGBA16F was requested and this device does not complete a framebuffer with it.
When the device gives the requested format, one information line names it,
for example Scene colour target format: RGBA16F.
Target Size
The target has the destination's size in pixels. On a high-DPI window that is larger than the size scenes and UI are laid out in. The target is built again when the size or the format changes. A scene on the direct route releases the target's memory.
In the Editor
The Scene view, the Game view and the camera preview each have their own scene color target and draw with the open project's Color Space.
In the Scene view, the grid, collider outlines, the selected particle system's shape gizmo and selection outlines belong to the editor. With no effect on, they are drawn with the scene. With an effect on, they are drawn after the final pass and tested against the scene's depth, so the effects leave them alone and nearer scene objects still hide them. The UI preview, UI outlines and light icons are drawn last in both cases.