Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Module rendering/post-processing/mega/shader.glsl

    Mega-shader: single-pass post-processing fragment shader.

    Fuses chromatic lens distortion, detector noise, EOG, tone mapping, and vignette into one fullscreen pass. Each effect is gated behind an #ifdef USE_* define so a recompile is needed only when an effect is toggled on/off — value tweaks just update uniforms.

    Pre-stages owned by the host:

    • Bloom pyramid renders into uBloomTexture (see BloomChain). The mega-shader samples bloom at the SAME (chromatic-aberrated) UVs as the scene so bloom is effectively additively-blended into the HDR buffer BEFORE chromatic lens distortion samples from it.
    • FXAA is a separate post-pass after the mega-shader, since edge detection needs neighbor reads of the final LDR pixels.

    Operation order:

    1. Bloom additively mixed into the HDR scene (per-channel at distorted UVs when lens distortion is on)
    2. Lens distortion (sampling lookup)
    3. Detector noise
    4. EOG (Exposure-Offset-Gamma)
    5. Tone mapping (mode-switched via LUXAR_TONE_MAPPING_MODE shader-define; values are Luxar-internal IDs 1..6, NOT THREE's enum values — see toneMappingModeDefine in the material file for the mapping. NoToneMapping aliases to Linear so it clamps to [0,1].)
    6. Vignette
    7. sRGB encoding (final write; matches outputColorSpace = sRGB)
    MEGA_VERTEX_SHADER
    MEGA_FRAGMENT_SHADER
    MEGA_SOURCE