/** SkSL： split wall regions by texture boundary, then paint the regions (preserve original image luminance and texture, overlay paintColorMap) */
export declare const REGION_PAINT_SKSL = "\nuniform shader originTex;\nuniform shader paintColorTex;\nuniform shader lowFreqTex;\nuniform shader highFreqTex;\n\nuniform float colorBaseOpacity;\nuniform float lLightOpacity;\nuniform float textureOpacity;\nuniform float showOrigin;\n\nfloat luminance(half3 c) {\n  return dot(c, half3(0.2126, 0.7152, 0.0722));\n}\n\nhalf3 setLuminance(float lum, half3 base) {\n  float diff = lum - luminance(base);\n  return base + diff;\n}\n\nhalf3 luminosityBlend(half3 base, half3 blend) {\n  return setLuminance(luminance(blend), base);\n}\n\nhalf3 overlayBlend(half3 base, half3 blend) {\n  half3 low = 2.0 * base * blend;\n  half3 high = 1.0 - 2.0 * (1.0 - base) * (1.0 - blend);\n  return mix(low, high, step(half3(0.5), base));\n}\n\nhalf4 main(float2 coord) {\n  half4 origin = originTex.eval(coord);\n  if (showOrigin > 0.5) {\n    return origin;\n  }\n\n  half4 paintEntry = paintColorTex.eval(coord);\n  // The paintColorMap uses Unpremul alpha: painted pixels \u2192 (R,G,B,255),\n  // transparent pixels \u2192 (0,0,0,0). GPU bilinear sampling interpolates\n  // straight-alpha values, so at boundaries rgb = trueColor * sampled.a\n  // (contaminated with black from the transparent neighbour).\n  //\n  // Unpremultiply to recover the true paint color:\n  //   trueColor = sampled.rgb / sampled.a\n  // This eliminates dark fringing at region boundaries.\n  float pa = paintEntry.a + 0.0001;\n  paintEntry.rgb /= pa;\n\n  // Gate sub-pixel alpha to kill residual sampling noise.\n  // Thresholds are deliberately low (\u22481.3\u20133.8 in byte space) because\n  // post-unpremul the RGB is correct at any alpha \u2265 0 \u2014 we only need\n  // to suppress samples that contribute negligibly to the final blend.\n  // Using *= preserves the smooth edge; higher-alpha samples pass through.\n  paintEntry.a *= smoothstep(0.005, 0.015, paintEntry.a);\n\n  half3 paintRgb = paintEntry.rgb;\n  half lowL = lowFreqTex.eval(coord).r;\n  half highL = highFreqTex.eval(coord).r;\n\n  half3 base = paintRgb * colorBaseOpacity;\n  half3 lit = luminosityBlend(base, half3(lowL));\n  half3 withLight = mix(base, lit, lLightOpacity);\n  half3 tex = overlayBlend(withLight, half3(highL));\n  half3 finalRgb = mix(withLight, tex, textureOpacity);\n\n  // Soft edge blend using the (feathered) alpha from the paint color map as coverage.\n  half3 blended = mix(origin.rgb, finalRgb, paintEntry.a);\n  return half4(blended, 1.0);\n}\n";
