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:
Tone mapping (mode-switched on config.toneMappingMode)
Vignette
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.
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:
config.toneMappingMode)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 viadefinesfor 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.