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

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

    Mega-shader TSL factory — NodeMaterial counterpart to the GLSL3 fragment in shader.glsl.ts.

    The mega-shader fuses post-processing into a single pass. The TSL port mirrors the GLSL operation order so the two backends produce pixel-identical output for any given configuration:

    1. Sample HDR scene (+ optional bloom)
    2. Lens distortion (chromatic + radial), per-channel sampling
    3. Detector noise (Bob Jenkins hash + Anscombe Poisson + Gaussian)
    4. EOG (Exposure → Offset → Gamma)
    5. Tone mapping (mode-switched on config.toneMappingMode)
    6. Vignette
    7. sRGB encoding (final write)

    Feature toggles live in MegaTSLConfig as JS-side flags rather than uniform-bool nodes. This matches the existing GLSL3 semantics where flipping USE_BLOOM (etc.) triggers a recompile via the #define-driven shader cache. The consumer (MegaShaderMaterial) treats both backends symmetrically: recompile via defines for WebGL, re-call the factory for WebGPU.

    Tone mapping uses the dedicated functions from three/tsl (linearToneMapping, reinhardToneMapping, etc.) rather than the GLSL <tonemapping_pars_fragment> include. The mapping from Luxar's internal IDs (1..6) to TSL functions is in applyToneMapping.

    MegaTSLConfig
    LuxarToneMappingMode
    megaWebGPUFactory