PostProcessComponent struct in Thread
Drives the fullscreen post-process pass — the last thing the renderer does before the
image reaches the screen. One enabled component in the scene supplies the settings; the
renderer uses the first it finds (conventionally attached to the camera). Everything is
computed in a single fullscreen pass over the HDR scene target: colour grading, bloom,
FXAA, SSAO, volumetric fog, god-rays and screen-space reflections.
HDR pipeline. The scene renders into an
RGBA16F target, so highlights can exceed 1.0 and bloom/tonemap have real
range to work with. With default settings the grade is a no-op (Exposure/Contrast/
Saturation = 1, no tonemap) — enabling the component changes nothing until you turn a
feature on.
Grouped settings. PostProcessSettings holds one nested struct
per effect — Exposure, Color, Bloom, AA, SSAO, SSGI,
SSR, Fog, GodRays, Clouds (with Clouds.Layer2),
LensFlare, MotionBlur, DepthOfField — the same sections the inspector shows. Each
effect's switch is its Enabled. Scene files keep the flat keys they always had (FogDensity,
CloudSteps…), so nothing needs converting.
Properties
| Enabled | bool | Master switch for this component. |
| Settings | PostProcessSettings | All tunables — see the groups below. |
| Global | bool | true (default): applies everywhere. false: a local volume. |
| Priority | float | The enabled global with the highest priority is the base; local volumes are applied lowest first. |
| BlendDistance | float | Metres outside a local box over which it blends in. 0 = hard edge. |
| Overrides | uint32 (PostGroup bits) | Which groups a local volume sets. Saved by name ([Fog, Exposure]). |
Volumes
A scene can have one global post-process and any number of local ones: a cave that darkens the
exposure and thickens the fog, a hut without god rays. A local volume is its entity's box — a unit cube through the
Transform, so Scale is the box's size. Where the camera is inside it, the volume's settings replace the
global ones for the groups it Overrides; outside, they blend in over BlendDistance. Numbers and
colours ease; switches (an effect's Enabled, the tonemap) flip halfway. In the inspector each section of a
local volume has an amber override box, and editing a section ticks it. PostProcessVolumes::Resolve is the
function every pass uses to pick the settings.
Colour grading & tone
| Exposure.Value | float | Linear exposure multiplier before tonemap. 1 = neutral. |
| Color.Contrast | float | Contrast around mid-grey. 1 = neutral. |
| Color.Saturation | float | Colour saturation. 1 = neutral, 0 = greyscale. |
| Exposure.Tonemap | int | 0 = none, 1 = Reinhard, 2 = ACES. Maps HDR → displayable range. |
| Color.Vignette | float | Edge darkening, 0 (off) → 1 (full). |
| Color.VignetteRadius | float | UV distance from centre where darkening begins. |
Bloom
| Bloom.Enabled | bool | Bright-pass + separable blur, added back over the image. |
| Bloom.Threshold | float | HDR luma above which pixels bleed. Below 1 blooms bright LDR too. |
| Bloom.Intensity | float | How strongly the blurred highlights are added back. |
Anti-aliasing
| AA.FXAA | bool | Luma-edge-directed blend on the final image. Cheap, no extra target. |
SSAO ambient occlusion
Screen-space ambient occlusion, reconstructed from scene depth (view position + normal
in one self-consistent space, robust to backend handedness). Darkens creases and contact
shadows. Needs the depth buffer, which the renderer binds automatically when SSAO is on.
| SSAO.Enabled | bool | Enable the occlusion pass. |
| SSAO.Radius | float | Sample hemisphere radius in view-space units. |
| SSAO.Intensity | float | Occlusion strength (power curve). |
| SSAO.Bias | float | Depth bias to stop self-occlusion acne. |
Volumetric fog height fog + sun
Analytic exponential height fog with sun in-scatter (Henyey-Greenstein phase), integrated
along the eye ray. World position is rebuilt from depth via the camera's inverse
view-projection, so it is handedness-proof. Applied to the whole image (including the sky),
so the horizon hazes and the sun glows through the fog — that glow feeds bloom.
| Fog.Enabled | bool | Enable height fog + in-scatter. |
| Fog.Density | float | Base extinction at the fog plane (thicker = more opaque). |
| Fog.HeightFalloff | float | How fast density decays upward from FogHeight (0 = uniform). |
| Fog.Height | float | World Y where full density sits; fog thins above it. |
| Fog.ScatterIntensity | float | Strength of the sun in-scatter glow. |
| Fog.Anisotropy | float | HG phase g in [0, 0.95): forward-scatter sharpness of the glow. |
| Fog.Color | Vec3 | Ambient fog tint (away from the sun). |
| Fog.SunColor | Vec3 | In-scatter tint (toward the sun). |
God-rays fog phase 2 · DX only
Ray-marches the eye ray and samples the sun's shadow map, so light shafts appear where
the sun reaches through gaps in geometry. Only active when Fog.Enabled is on,
GodRays.Enabled is set, and the directional light casts shadows. Without a sun
shadow map the fog stays phase-1 analytic.
| GodRays.Enabled | bool | Enable shadow-sampled light shafts. |
| GodRays.Steps | int | March samples along the eye ray (more = smoother, costlier). Clamped 4–64. |
SSR screen-space reflections
Reflects the eye ray off the depth-reconstructed normal and marches the depth buffer for a
hit, sampling scene colour there and weighting it by Fresnel (Schlick) — reflections
strengthen at grazing angles, like a wet floor. No G-buffer needed. Best on large smooth
surfaces; fades at screen edges and on misses. Fine geometry can shimmer at edges (a
dedicated normal buffer is the phase-2 fix).
| SSR.Enabled | bool | Enable screen-space reflections. |
| SSR.Intensity | float | Overall reflection blend strength. |
| SSR.MaxDistance | float | View-space march length. |
| SSR.Thickness | float | View-Z hit tolerance (surface thickness). |
| SSR.MaxSteps | int | Linear march samples (more = longer/cleaner, costlier). Clamped 8–96. |
Example
auto& pp = camera.AddComponent<Thread::PostProcessComponent>();
auto& s = pp.Settings;
s.Exposure.Tonemap = 2; // ACES
s.Exposure.Value = 1.1f;
s.Bloom.Enabled = true;
s.Bloom.Intensity = 0.5f;
s.SSAO.Enabled = true;
s.Fog.Enabled = true; // + GodRays (DX) if the sun casts shadows
s.SSR.Enabled = true; // reflective floors/water
See the Render Pipeline manual page for how the pass
sits after the scene render and shadow pass.
PostProcessComponent struct w Thread
Steruje pełnoekranowym passem post-processingu — ostatnią rzeczą, którą renderer robi, zanim obraz
trafi na ekran. Ustawienia daje jeden włączony komponent w scenie; renderer używa pierwszego, który
znajdzie (zwyczajowo na kamerze). Wszystko liczy się w jednym pełnoekranowym passie nad celem HDR
sceny: korekcja kolorów, bloom, FXAA, SSAO, mgła wolumetryczna, god-rays i odbicia w przestrzeni
ekranu.
Potok HDR. Scena renderuje się do celu RGBA16F, więc
jasne miejsca mogą przekraczać 1.0, a bloom i tonemapping mają prawdziwy zakres do pracy. Przy
ustawieniach domyślnych korekcja nic nie zmienia (Exposure/Contrast/Saturation = 1, bez tonemapu) —
włączenie komponentu niczego nie zmienia, dopóki nie włączysz jakiejś funkcji.
Ustawienia w grupach. PostProcessSettings ma jedną zagnieżdżoną
strukturę na efekt — Exposure, Color, Bloom, AA, SSAO, SSGI,
SSR, Fog, GodRays, Clouds (z Clouds.Layer2),
LensFlare, MotionBlur, DepthOfField — te same sekcje, które pokazuje inspektor.
Włącznikiem efektu jest jego Enabled. Pliki scen mają te same płaskie klucze co zawsze
(FogDensity, CloudSteps…), więc niczego nie trzeba konwertować.
Właściwości
| Enabled | bool | Główny przełącznik komponentu. |
| Settings | PostProcessSettings | Wszystkie parametry — zob. grupy niżej. |
| Global | bool | true (domyślnie): działa wszędzie. false: lokalny wolumen. |
| Priority | float | Bazą jest włączony globalny o najwyższym priorytecie; lokalne nakładane są od najniższego. |
| BlendDistance | float | Ile metrów poza pudełkiem lokalny wolumen się wtapia. 0 = ostra granica. |
| Overrides | uint32 (bity PostGroup) | Które grupy ustawia lokalny wolumen. Zapisywane nazwami ([Fog, Exposure]). |
Wolumeny
Scena może mieć jeden globalny post-process i dowolnie wiele lokalnych: jaskinię, która przyciemnia
ekspozycję i zagęszcza mgłę, chatę bez promieni słońca. Lokalny wolumen to pudełko jego encji — sześcian jednostkowy
przez Transform, więc Scale to jego rozmiar. Gdy kamera jest w środku, ustawienia wolumenu zastępują
globalne w grupach z Overrides; na zewnątrz wtapiają się na odległości BlendDistance. Liczby
i kolory przechodzą płynnie, przełączniki (Enabled efektu, tonemap) zmieniają się w połowie. W
inspektorze każda sekcja lokalnego wolumenu ma bursztynowe pole nadpisania, a edycja sekcji je zaznacza.
PostProcessVolumes::Resolve to funkcja, przez którą każdy pass wybiera ustawienia.
Korekcja kolorów i ton
| Exposure.Value | float | Liniowy mnożnik ekspozycji przed tonemapem. 1 = neutralnie. |
| Color.Contrast | float | Kontrast wokół średniej szarości. 1 = neutralnie. |
| Color.Saturation | float | Nasycenie kolorów. 1 = neutralnie, 0 = skala szarości. |
| Exposure.Tonemap | int | 0 = brak, 1 = Reinhard, 2 = ACES. Mapuje HDR na zakres wyświetlalny. |
| Color.Vignette | float | Przyciemnienie krawędzi, 0 (wył.) → 1 (pełne). |
| Color.VignetteRadius | float | Odległość UV od środka, od której zaczyna się przyciemnienie. |
Bloom
| Bloom.Enabled | bool | Wyodrębnienie jasnych miejsc + rozmycie separowalne, dodane z powrotem do obrazu. |
| Bloom.Threshold | float | Luminancja HDR, powyżej której piksele „przeciekają”. Poniżej 1 rozświetla też jasne LDR. |
| Bloom.Intensity | float | Jak mocno rozmyte jasne miejsca są dodawane. |
Antyaliasing
| AA.FXAA | bool | Mieszanie kierowane krawędziami luminancji na końcowym obrazie. Tanie, bez dodatkowego celu. |
SSAO ambient occlusion
Okluzja otoczenia w przestrzeni ekranu, odtwarzana z głębi sceny (pozycja widoku + normalna w
jednej spójnej przestrzeni, odporne na skrętność backendu). Przyciemnia zagłębienia i cienie
kontaktowe. Potrzebuje bufora głębi, który renderer podpina sam, gdy SSAO jest włączone.
| SSAO.Enabled | bool | Włącza pass okluzji. |
| SSAO.Radius | float | Promień półkuli próbek w jednostkach przestrzeni widoku. |
| SSAO.Intensity | float | Siła okluzji (krzywa potęgowa). |
| SSAO.Bias | float | Przesunięcie głębi przeciw samozasłanianiu. |
Mgła wolumetryczna mgła wysokościowa + słońce
Analityczna wykładnicza mgła wysokościowa z rozpraszaniem światła słońca (faza Henyeya-Greensteina),
całkowana wzdłuż promienia oka. Pozycja w świecie jest odtwarzana z głębi przez odwrotność
view-projection kamery, więc jest odporna na skrętność. Działa na cały obraz (razem z niebem), więc
horyzont się zamglewa, a słońce prześwieca przez mgłę — ta poświata zasila bloom.
| Fog.Enabled | bool | Włącza mgłę wysokościową + rozpraszanie. |
| Fog.Density | float | Bazowe wygaszanie na wysokości mgły (gęściej = bardziej nieprzejrzyście). |
| Fog.HeightFalloff | float | Jak szybko gęstość spada w górę od FogHeight (0 = jednolita). |
| Fog.Height | float | Wysokość Y w świecie z pełną gęstością; powyżej mgła rzednie. |
| Fog.ScatterIntensity | float | Siła poświaty rozpraszania słońca. |
| Fog.Anisotropy | float | Parametr fazy HG g w [0, 0.95): ostrość poświaty w przód. |
| Fog.Color | Vec3 | Odcień mgły otoczenia (z dala od słońca). |
| Fog.SunColor | Vec3 | Odcień rozpraszania (w stronę słońca). |
God-rays mgła faza 2
Marszuje wzdłuż promienia oka i próbkuje mapę cieni słońca, więc snopy światła pojawiają się tam,
gdzie słońce przechodzi przez szczeliny w geometrii. Działa tylko, gdy Fog.Enabled jest włączone,
GodRays.Enabled ustawione i światło kierunkowe rzuca cienie. Bez mapy cieni słońca mgła
zostaje analityczna (faza 1).
| GodRays.Enabled | bool | Włącza snopy światła próbkujące cienie. |
| GodRays.Steps | int | Próbki wzdłuż promienia oka (więcej = gładziej, drożej). Zakres 4–64. |
SSR odbicia w przestrzeni ekranu
Odbija promień oka od normalnej odtworzonej z głębi i marszuje bufor głębi w poszukiwaniu
trafienia, próbkując tam kolor sceny z wagą Fresnela (Schlick) — odbicia mocnieją pod ostrym kątem,
jak na mokrej podłodze. Nie wymaga G-bufora. Najlepsze na dużych gładkich powierzchniach; zanika na
krawędziach ekranu i przy chybieniach. Drobna geometria może migotać na krawędziach (poprawką w fazie
2 jest osobny bufor normalnych).
| SSR.Enabled | bool | Włącza odbicia w przestrzeni ekranu. |
| SSR.Intensity | float | Ogólna siła mieszania odbić. |
| SSR.MaxDistance | float | Długość marszu w przestrzeni widoku. |
| SSR.Thickness | float | Tolerancja trafienia w Z widoku (grubość powierzchni). |
| SSR.MaxSteps | int | Liniowe próbki marszu (więcej = dalej/czyściej, drożej). Zakres 8–96. |
Przykład
auto& pp = camera.AddComponent<Thread::PostProcessComponent>();
auto& s = pp.Settings;
s.Exposure.Tonemap = 2; // ACES
s.Exposure.Value = 1.1f;
s.Bloom.Enabled = true;
s.Bloom.Intensity = 0.5f;
s.SSAO.Enabled = true;
s.Fog.Enabled = true; // + GodRays, jeśli słońce rzuca cienie
s.SSR.Enabled = true; // odbijające podłogi/woda
Jak ten pass ustawia się po renderze sceny i passie cieni, opisuje strona
Potok renderowania.