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

EnabledboolMaster switch for this component.
SettingsPostProcessSettingsAll tunables — see the groups below.
Globalbooltrue (default): applies everywhere. false: a local volume.
PriorityfloatThe enabled global with the highest priority is the base; local volumes are applied lowest first.
BlendDistancefloatMetres outside a local box over which it blends in. 0 = hard edge.
Overridesuint32 (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.ValuefloatLinear exposure multiplier before tonemap. 1 = neutral.
Color.ContrastfloatContrast around mid-grey. 1 = neutral.
Color.SaturationfloatColour saturation. 1 = neutral, 0 = greyscale.
Exposure.Tonemapint0 = none, 1 = Reinhard, 2 = ACES. Maps HDR → displayable range.
Color.VignettefloatEdge darkening, 0 (off) → 1 (full).
Color.VignetteRadiusfloatUV distance from centre where darkening begins.

Bloom

Bloom.EnabledboolBright-pass + separable blur, added back over the image.
Bloom.ThresholdfloatHDR luma above which pixels bleed. Below 1 blooms bright LDR too.
Bloom.IntensityfloatHow strongly the blurred highlights are added back.

Anti-aliasing

AA.FXAAboolLuma-edge-directed blend on the final image. Cheap, no extra target.

SSAO

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.EnabledboolEnable the occlusion pass.
SSAO.RadiusfloatSample hemisphere radius in view-space units.
SSAO.IntensityfloatOcclusion strength (power curve).
SSAO.BiasfloatDepth bias to stop self-occlusion acne.

Volumetric fog

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.EnabledboolEnable height fog + in-scatter.
Fog.DensityfloatBase extinction at the fog plane (thicker = more opaque).
Fog.HeightFallofffloatHow fast density decays upward from FogHeight (0 = uniform).
Fog.HeightfloatWorld Y where full density sits; fog thins above it.
Fog.ScatterIntensityfloatStrength of the sun in-scatter glow.
Fog.AnisotropyfloatHG phase g in [0, 0.95): forward-scatter sharpness of the glow.
Fog.ColorVec3Ambient fog tint (away from the sun).
Fog.SunColorVec3In-scatter tint (toward the sun).

God-rays

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.EnabledboolEnable shadow-sampled light shafts.
GodRays.StepsintMarch samples along the eye ray (more = smoother, costlier). Clamped 4–64.

SSR

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.EnabledboolEnable screen-space reflections.
SSR.IntensityfloatOverall reflection blend strength.
SSR.MaxDistancefloatView-space march length.
SSR.ThicknessfloatView-Z hit tolerance (surface thickness).
SSR.MaxStepsintLinear 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

EnabledboolGłówny przełącznik komponentu.
SettingsPostProcessSettingsWszystkie parametry — zob. grupy niżej.
Globalbooltrue (domyślnie): działa wszędzie. false: lokalny wolumen.
PriorityfloatBazą jest włączony globalny o najwyższym priorytecie; lokalne nakładane są od najniższego.
BlendDistancefloatIle metrów poza pudełkiem lokalny wolumen się wtapia. 0 = ostra granica.
Overridesuint32 (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.ValuefloatLiniowy mnożnik ekspozycji przed tonemapem. 1 = neutralnie.
Color.ContrastfloatKontrast wokół średniej szarości. 1 = neutralnie.
Color.SaturationfloatNasycenie kolorów. 1 = neutralnie, 0 = skala szarości.
Exposure.Tonemapint0 = brak, 1 = Reinhard, 2 = ACES. Mapuje HDR na zakres wyświetlalny.
Color.VignettefloatPrzyciemnienie krawędzi, 0 (wył.) → 1 (pełne).
Color.VignetteRadiusfloatOdległość UV od środka, od której zaczyna się przyciemnienie.

Bloom

Bloom.EnabledboolWyodrębnienie jasnych miejsc + rozmycie separowalne, dodane z powrotem do obrazu.
Bloom.ThresholdfloatLuminancja HDR, powyżej której piksele „przeciekają”. Poniżej 1 rozświetla też jasne LDR.
Bloom.IntensityfloatJak mocno rozmyte jasne miejsca są dodawane.

Antyaliasing

AA.FXAAboolMieszanie kierowane krawędziami luminancji na końcowym obrazie. Tanie, bez dodatkowego celu.

SSAO

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.EnabledboolWłącza pass okluzji.
SSAO.RadiusfloatPromień półkuli próbek w jednostkach przestrzeni widoku.
SSAO.IntensityfloatSiła okluzji (krzywa potęgowa).
SSAO.BiasfloatPrzesunięcie głębi przeciw samozasłanianiu.

Mgła wolumetryczna

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.EnabledboolWłącza mgłę wysokościową + rozpraszanie.
Fog.DensityfloatBazowe wygaszanie na wysokości mgły (gęściej = bardziej nieprzejrzyście).
Fog.HeightFallofffloatJak szybko gęstość spada w górę od FogHeight (0 = jednolita).
Fog.HeightfloatWysokość Y w świecie z pełną gęstością; powyżej mgła rzednie.
Fog.ScatterIntensityfloatSiła poświaty rozpraszania słońca.
Fog.AnisotropyfloatParametr fazy HG g w [0, 0.95): ostrość poświaty w przód.
Fog.ColorVec3Odcień mgły otoczenia (z dala od słońca).
Fog.SunColorVec3Odcień rozpraszania (w stronę słońca).

God-rays

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.EnabledboolWłącza snopy światła próbkujące cienie.
GodRays.StepsintPróbki wzdłuż promienia oka (więcej = gładziej, drożej). Zakres 4–64.

SSR

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.EnabledboolWłącza odbicia w przestrzeni ekranu.
SSR.IntensityfloatOgólna siła mieszania odbić.
SSR.MaxDistancefloatDługość marszu w przestrzeni widoku.
SSR.ThicknessfloatTolerancja trafienia w Z widoku (grubość powierzchni).
SSR.MaxStepsintLiniowe 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.