Compiler1 min read
PostFX Module
Post-processing helpers for gamma correction and tone mapping.
Reading Time
1 min
Word Count
85
Sections
9
Try It Live
Turn the guide into code
Take the key idea from this page into the playground and validate it in a real shader instead of leaving it as theory.
Open PlaygroundPost-processing helpers for gamma correction and tone mapping.
Import
bwsl
import PostFX
This module has no module imports.
Usage Examples
Final HDR Resolve
Use PostFX in fullscreen passes that convert HDR lighting buffers into display-ready color.
bwsl
import PostFX
float3 hdr = sample(resources.sceneColor, resources.linearSampler, input.uv).rgb;
float bloom = sample(resources.bloom, resources.linearSampler, input.uv).r;
float3 exposed = hdr * resources.exposure + bloom * resources.bloomTint;
float3 mapped = PostFX::ACESFilm(exposed);
float3 display = PostFX::linearToSRGB(mapped);
output.color = float4(display, 1.0);
Simple Debug Tone Map
Use Reinhard helpers for debug views or tools where predictable compression of bright values matters more than filmic contrast.
bwsl
import PostFX
float3 hdrDebug = sample(resources.debugTarget, resources.pointSampler, input.uv).rgb;
float3 mapped = PostFX::reinhardExtendedToneMap(hdrDebug, resources.whitePoint);
// Keep overlays in display space after tone mapping the scene value.
float3 overlay = sample(resources.overlay, resources.pointSampler, input.uv).rgb;
float3 color = lerp(PostFX::linearToSRGB(mapped), overlay, resources.overlayAlpha);
output.color = float4(color, 1.0);
Constants
None.
Structs
No structs found.
Enums
No enums found.
Functions
gammaCorrect
Gamma correction
bwsl
gammaCorrect :: (float3 color) -> float3
inverseGammaCorrect
bwsl
inverseGammaCorrect :: (float3 color) -> float3
linearToSRGB
bwsl
linearToSRGB :: (float3 color) -> float3
sRGBToLinear
bwsl
sRGBToLinear :: (float3 color) -> float3
ACESFilm
ACES Tone Mapping
bwsl
ACESFilm :: (float3 x) -> float3
reinhardToneMap
bwsl
reinhardToneMap :: (float3 color) -> float3
reinhardExtendedToneMap
bwsl
reinhardExtendedToneMap :: (float3 color, float maxWhite) -> float3
Source
Generated from compiler-reference/modules/PostFX.bwsl.