declare const _default: "\n uniform sharpness: f32;\n\n // reversible LDR <-> HDR tone mapping, as CAS needs LDR input\n #ifdef CAS_HDR\n #include \"reversibleTonemapPS\"\n fn toSDR(c: vec3f) -> vec3f { return reversibleTonemap(c); }\n fn toHDR(c: vec3f) -> vec3f { return reversibleTonemapInverse(c); }\n #else\n fn toSDR(c: vec3f) -> vec3f { return c; }\n fn toHDR(c: vec3f) -> vec3f { return c; }\n #endif\n\n fn applyCas(scene: vec4f, uv: vec2f) -> vec4f {\n let x = uniform.sceneTextureSize.z;\n let y = uniform.sceneTextureSize.w;\n\n // sample 4 neighbors around the already sampled pixel, and convert it to SDR\n let a: half3 = half3(toSDR(textureSampleLevel(sceneTexture, sceneTextureSampler, uv + vec2f(0.0, -y), 0.0).rgb));\n let b: half3 = half3(toSDR(textureSampleLevel(sceneTexture, sceneTextureSampler, uv + vec2f(-x, 0.0), 0.0).rgb));\n let c: half3 = half3(toSDR(scene.rgb));\n let d: half3 = half3(toSDR(textureSampleLevel(sceneTexture, sceneTextureSampler, uv + vec2f(x, 0.0), 0.0).rgb));\n let e: half3 = half3(toSDR(textureSampleLevel(sceneTexture, sceneTextureSampler, uv + vec2f(0.0, y), 0.0).rgb));\n\n // apply the sharpening\n let min_g = min(a.g, min(b.g, min(c.g, min(d.g, e.g))));\n let max_g = max(a.g, max(b.g, max(c.g, max(d.g, e.g))));\n let sharpening_amount = sqrt(min(half(1.0) - max_g, min_g) / max(max_g, half(1e-4)));\n let w = sharpening_amount * half(uniform.sharpness);\n var res = (w * (a + b + d + e) + c) / (half(4.0) * w + half(1.0));\n\n // remove negative colors\n res = max(res, half3(0.0));\n\n // convert back to HDR, keeping the scene alpha\n return vec4f(toHDR(vec3f(res)), scene.a);\n }\n"; export default _default;