{
 "147:145": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision mediump float;\n\nuniform sampler2D u_image0;\nuniform int u_int0;      // Blend mode\nuniform int u_int1;      // Color tint\nuniform float u_float0;  // Intensity\nuniform float u_float1;  // Radius\nuniform float u_float2;  // Threshold\n\nin vec2 v_texCoord;\nout vec4 fragColor;\n\nconst int BLEND_ADD      = 0;\nconst int BLEND_SCREEN   = 1;\nconst int BLEND_SOFT     = 2;\nconst int BLEND_OVERLAY  = 3;\nconst int BLEND_LIGHTEN  = 4;\n\nconst float GOLDEN_ANGLE = 2.39996323;\nconst int MAX_SAMPLES = 48;\nconst vec3 LUMA = vec3(0.299, 0.587, 0.114);\n\nfloat hash(vec2 p) {\n    p = fract(p * vec2(123.34, 456.21));\n    p += dot(p, p + 45.32);\n    return fract(p.x * p.y);\n}\n\nvec3 hexToRgb(int h) {\n    return vec3(\n        float((h >> 16) & 255),\n        float((h >> 8) & 255),\n        float(h & 255)\n    ) * (1.0 / 255.0);\n}\n\nvec3 blend(vec3 base, vec3 glow, int mode) {\n    if (mode == BLEND_SCREEN) {\n        return 1.0 - (1.0 - base) * (1.0 - glow);\n    }\n    if (mode == BLEND_SOFT) {\n        return mix(\n            base - (1.0 - 2.0 * glow) * base * (1.0 - base),\n            base + (2.0 * glow - 1.0) * (sqrt(base) - base),\n            step(0.5, glow)\n        );\n    }\n    if (mode == BLEND_OVERLAY) {\n        return mix(\n            2.0 * base * glow,\n            1.0 - 2.0 * (1.0 - base) * (1.0 - glow),\n            step(0.5, base)\n        );\n    }\n    if (mode == BLEND_LIGHTEN) {\n        return max(base, glow);\n    }\n    return base + glow;\n}\n\nvoid main() {\n    vec4 original = texture(u_image0, v_texCoord);\n    \n    float intensity = u_float0 * 0.05;\n    float radius = u_float1 * u_float1 * 0.012;\n    \n    if (intensity < 0.001 || radius < 0.1) {\n        fragColor = original;\n        return;\n    }\n    \n    float threshold = 1.0 - u_float2 * 0.01;\n    float t0 = threshold - 0.15;\n    float t1 = threshold + 0.15;\n    \n    vec2 texelSize = 1.0 / vec2(textureSize(u_image0, 0));\n    float radius2 = radius * radius;\n    \n    float sampleScale = clamp(radius * 0.75, 0.35, 1.0);\n    int samples = int(float(MAX_SAMPLES) * sampleScale);\n    \n    float noise = hash(gl_FragCoord.xy);\n    float angleOffset = noise * GOLDEN_ANGLE;\n    float radiusJitter = 0.85 + noise * 0.3;\n    \n    float ca = cos(GOLDEN_ANGLE);\n    float sa = sin(GOLDEN_ANGLE);\n    vec2 dir = vec2(cos(angleOffset), sin(angleOffset));\n    \n    vec3 glow = vec3(0.0);\n    float totalWeight = 0.0;\n    \n    // Center tap\n    float centerMask = smoothstep(t0, t1, dot(original.rgb, LUMA));\n    glow += original.rgb * centerMask * 2.0;\n    totalWeight += 2.0;\n    \n    for (int i = 1; i < MAX_SAMPLES; i++) {\n        if (i >= samples) break;\n        \n        float fi = float(i);\n        float dist = sqrt(fi / float(samples)) * radius * radiusJitter;\n        \n        vec2 offset = dir * dist * texelSize;\n        vec3 c = texture(u_image0, v_texCoord + offset).rgb;\n        float mask = smoothstep(t0, t1, dot(c, LUMA));\n        \n        float w = 1.0 - (dist * dist) / (radius2 * 1.5);\n        w = max(w, 0.0);\n        w *= w;\n        \n        glow += c * mask * w;\n        totalWeight += w;\n        \n        dir = vec2(\n            dir.x * ca - dir.y * sa,\n            dir.x * sa + dir.y * ca\n        );\n    }\n    \n    glow *= intensity / max(totalWeight, 0.001);\n    \n    if (u_int1 > 0) {\n        glow *= hexToRgb(u_int1);\n    }\n    \n    vec3 result = blend(original.rgb, glow, u_int0);\n    result += (noise - 0.5) * (1.0 / 255.0);\n    \n    fragColor = vec4(clamp(result, 0.0, 1.0), original.a);\n}",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "147:34",
    0
   ],
   "floats.u_float1": [
    "147:35",
    0
   ],
   "floats.u_float2": [
    "147:33",
    0
   ],
   "ints.u_int0": [
    "147:146",
    1
   ],
   "ints.u_int1": [
    "147:32",
    0
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "147:34": {
  "inputs": {
   "value": 2
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "147:35": {
  "inputs": {
   "value": 29
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "147:33": {
  "inputs": {
   "value": 100
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "147:32": {
  "inputs": {
   "color": "#0a9299"
  },
  "class_type": "ColorToRGBInt",
  "_meta": {
   "title": "Color Picker"
  }
 },
 "147:146": {
  "inputs": {
   "choice": "screen"
  },
  "class_type": "CustomCombo",
  "_meta": {
   "title": "Custom Combo"
  }
 },
 "148:15": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\nuniform vec2 u_resolution;\nuniform float u_float0; // grain amount      [0.0 \u2013 1.0]   typical: 0.2\u20130.8\nuniform float u_float1; // grain size        [0.3 \u2013 3.0]   lower = finer grain\nuniform float u_float2; // color amount      [0.0 \u2013 1.0]   0 = monochrome, 1 = RGB grain\nuniform float u_float3; // luminance bias    [0.0 \u2013 1.0]   0 = uniform, 1 = shadows only\nuniform int   u_int0;   // noise mode        [0 or 1]      0 = smooth, 1 = grainy\n\nin vec2 v_texCoord;\nlayout(location = 0) out vec4 fragColor0;\n\n// High-quality integer hash (pcg-like)\nuint pcg(uint v) {\n    uint state = v * 747796405u + 2891336453u;\n    uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;\n    return (word >> 22u) ^ word;\n}\n\n// 2D -> 1D hash input\nuint hash2d(uvec2 p) {\n    return pcg(p.x + pcg(p.y));\n}\n\n// Hash to float [0, 1]\nfloat hashf(uvec2 p) {\n    return float(hash2d(p)) / float(0xffffffffu);\n}\n\n// Hash to float with offset (for RGB channels)\nfloat hashf(uvec2 p, uint offset) {\n    return float(pcg(hash2d(p) + offset)) / float(0xffffffffu);\n}\n\n// Convert uniform [0,1] to roughly Gaussian distribution\n// Using simple approximation: average of multiple samples\nfloat toGaussian(uvec2 p) {\n    float sum = hashf(p, 0u) + hashf(p, 1u) + hashf(p, 2u) + hashf(p, 3u);\n    return (sum - 2.0) * 0.7;  // Centered, scaled\n}\n\nfloat toGaussian(uvec2 p, uint offset) {\n    float sum = hashf(p, offset) + hashf(p, offset + 1u) \n              + hashf(p, offset + 2u) + hashf(p, offset + 3u);\n    return (sum - 2.0) * 0.7;\n}\n\n// Smooth noise with better interpolation\nfloat smoothNoise(vec2 p) {\n    vec2 i = floor(p);\n    vec2 f = fract(p);\n    \n    // Quintic interpolation (less banding than cubic)\n    f = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n    \n    uvec2 ui = uvec2(i);\n    float a = toGaussian(ui);\n    float b = toGaussian(ui + uvec2(1u, 0u));\n    float c = toGaussian(ui + uvec2(0u, 1u));\n    float d = toGaussian(ui + uvec2(1u, 1u));\n    \n    return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);\n}\n\nfloat smoothNoise(vec2 p, uint offset) {\n    vec2 i = floor(p);\n    vec2 f = fract(p);\n    \n    f = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n    \n    uvec2 ui = uvec2(i);\n    float a = toGaussian(ui, offset);\n    float b = toGaussian(ui + uvec2(1u, 0u), offset);\n    float c = toGaussian(ui + uvec2(0u, 1u), offset);\n    float d = toGaussian(ui + uvec2(1u, 1u), offset);\n    \n    return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);\n}\n\nvoid main() {\n    vec4 color = texture(u_image0, v_texCoord);\n    \n    // Luminance (Rec.709)\n    float luma = dot(color.rgb, vec3(0.2126, 0.7152, 0.0722));\n    \n    // Grain UV (resolution-independent)\n    vec2 grainUV = v_texCoord * u_resolution / max(u_float1, 0.01);\n    uvec2 grainPixel = uvec2(grainUV);\n    \n    float g;\n    vec3 grainRGB;\n    \n    if (u_int0 == 1) {\n        // Grainy mode: pure hash noise (no interpolation = no banding)\n        g = toGaussian(grainPixel);\n        grainRGB = vec3(\n            toGaussian(grainPixel, 100u),\n            toGaussian(grainPixel, 200u),\n            toGaussian(grainPixel, 300u)\n        );\n    } else {\n        // Smooth mode: interpolated with quintic curve\n        g = smoothNoise(grainUV);\n        grainRGB = vec3(\n            smoothNoise(grainUV, 100u),\n            smoothNoise(grainUV, 200u),\n            smoothNoise(grainUV, 300u)\n        );\n    }\n    \n    // Luminance weighting (less grain in highlights)\n    float lumWeight = mix(1.0, 1.0 - luma, clamp(u_float3, 0.0, 1.0));\n    \n    // Strength\n    float strength = u_float0 * 0.15;\n    \n    // Color vs monochrome grain\n    vec3 grainColor = mix(vec3(g), grainRGB, clamp(u_float2, 0.0, 1.0));\n    \n    color.rgb += grainColor * strength * lumWeight;\n    fragColor0 = vec4(clamp(color.rgb, 0.0, 1.0), color.a);\n}\n",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "148:17",
    0
   ],
   "floats.u_float1": [
    "148:18",
    0
   ],
   "floats.u_float2": [
    "148:19",
    0
   ],
   "floats.u_float3": [
    "148:20",
    0
   ],
   "ints.u_int0": [
    "148:21",
    1
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "148:21": {
  "inputs": {
   "choice": "Smooth"
  },
  "class_type": "CustomCombo",
  "_meta": {
   "title": "Custom Combo"
  }
 },
 "148:17": {
  "inputs": {
   "value": 0.75
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Grain amount"
  }
 },
 "148:18": {
  "inputs": {
   "value": 0.45
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Grain size"
  }
 },
 "148:19": {
  "inputs": {
   "value": 0.35
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Color amount"
  }
 },
 "148:20": {
  "inputs": {
   "value": 0.15
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Luminance bias"
  }
 },
 "160:16": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\nuniform vec2 u_resolution;\nuniform int u_int0;      // Mode\nuniform float u_float0;  // Amount (0 to 100)\n\nin vec2 v_texCoord;\nout vec4 fragColor;\n\nconst int MODE_LINEAR   = 0;\nconst int MODE_RADIAL   = 1;\nconst int MODE_BARREL   = 2;\nconst int MODE_SWIRL    = 3;\nconst int MODE_DIAGONAL = 4;\n\nconst float AMOUNT_SCALE = 0.0005;\nconst float RADIAL_MULT = 4.0;\nconst float BARREL_MULT = 8.0;\nconst float INV_SQRT2 = 0.70710678118;\n\nvoid main() {\n    vec2 uv = v_texCoord;\n    vec4 original = texture(u_image0, uv);\n\n    float amount = u_float0 * AMOUNT_SCALE;\n\n    if (amount < 0.000001) {\n        fragColor = original;\n        return;\n    }\n\n    // Aspect-corrected coordinates for circular effects\n    float aspect = u_resolution.x / u_resolution.y;\n    vec2 centered = uv - 0.5;\n    vec2 corrected = vec2(centered.x * aspect, centered.y);\n    float r = length(corrected);\n    vec2 dir = r > 0.0001 ? corrected / r : vec2(0.0);\n    vec2 offset = vec2(0.0);\n\n    if (u_int0 == MODE_LINEAR) {\n        // Horizontal shift (no aspect correction needed)\n        offset = vec2(amount, 0.0);\n    }\n    else if (u_int0 == MODE_RADIAL) {\n        // Outward from center, stronger at edges\n        offset = dir * r * amount * RADIAL_MULT;\n        offset.x /= aspect;  // Convert back to UV space\n    }\n    else if (u_int0 == MODE_BARREL) {\n        // Lens distortion simulation (r\u00b2 falloff)\n        offset = dir * r * r * amount * BARREL_MULT;\n        offset.x /= aspect;  // Convert back to UV space\n    }\n    else if (u_int0 == MODE_SWIRL) {\n        // Perpendicular to radial (rotational aberration)\n        vec2 perp = vec2(-dir.y, dir.x);\n        offset = perp * r * amount * RADIAL_MULT;\n        offset.x /= aspect;  // Convert back to UV space\n    }\n    else if (u_int0 == MODE_DIAGONAL) {\n        // 45\u00b0 offset (no aspect correction needed)\n        offset = vec2(amount, amount) * INV_SQRT2;\n    }\n    \n    float red = texture(u_image0, uv + offset).r;\n    float green = original.g;\n    float blue = texture(u_image0, uv - offset).b;\n    \n    fragColor = vec4(red, green, blue, original.a);\n}",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "160:158",
    0
   ],
   "ints.u_int0": [
    "160:159",
    1
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "160:158": {
  "inputs": {
   "value": 31
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "160:159": {
  "inputs": {
   "choice": "Linear"
  },
  "class_type": "CustomCombo",
  "_meta": {
   "title": "Custom Combo"
  }
 },
 "171:166": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\nuniform float u_float0; // temperature (-100 to 100)\nuniform float u_float1; // tint (-100 to 100)\nuniform float u_float2; // vibrance (-100 to 100)\nuniform float u_float3; // saturation (-100 to 100)\n\nin vec2 v_texCoord;\nout vec4 fragColor;\n\nconst float INPUT_SCALE = 0.01;\nconst float TEMP_TINT_PRIMARY = 0.3;\nconst float TEMP_TINT_SECONDARY = 0.15;\nconst float VIBRANCE_BOOST = 2.0;\nconst float SATURATION_BOOST = 2.0;\nconst float SKIN_PROTECTION = 0.5;\nconst float EPSILON = 0.001;\nconst vec3 LUMA_WEIGHTS = vec3(0.299, 0.587, 0.114);\n\nvoid main() {\n    vec4 tex = texture(u_image0, v_texCoord);\n    vec3 color = tex.rgb;\n    \n    // Scale inputs: -100/100 \u2192 -1/1\n    float temperature = u_float0 * INPUT_SCALE;\n    float tint = u_float1 * INPUT_SCALE;\n    float vibrance = u_float2 * INPUT_SCALE;\n    float saturation = u_float3 * INPUT_SCALE;\n    \n    // Temperature (warm/cool): positive = warm, negative = cool\n    color.r += temperature * TEMP_TINT_PRIMARY;\n    color.b -= temperature * TEMP_TINT_PRIMARY;\n    \n    // Tint (green/magenta): positive = green, negative = magenta\n    color.g += tint * TEMP_TINT_PRIMARY;\n    color.r -= tint * TEMP_TINT_SECONDARY;\n    color.b -= tint * TEMP_TINT_SECONDARY;\n    \n    // Single clamp after temperature/tint\n    color = clamp(color, 0.0, 1.0);\n    \n    // Vibrance with skin protection\n    if (vibrance != 0.0) {\n        float maxC = max(color.r, max(color.g, color.b));\n        float minC = min(color.r, min(color.g, color.b));\n        float sat = maxC - minC;\n        float gray = dot(color, LUMA_WEIGHTS);\n        \n        if (vibrance < 0.0) {\n            // Desaturate: -100 \u2192 gray\n            color = mix(vec3(gray), color, 1.0 + vibrance);\n        } else {\n            // Boost less saturated colors more\n            float vibranceAmt = vibrance * (1.0 - sat);\n            \n            // Branchless skin tone protection\n            float isWarmTone = step(color.b, color.g) * step(color.g, color.r);\n            float warmth = (color.r - color.b) / max(maxC, EPSILON);\n            float skinTone = isWarmTone * warmth * sat * (1.0 - sat);\n            vibranceAmt *= (1.0 - skinTone * SKIN_PROTECTION);\n            \n            color = mix(vec3(gray), color, 1.0 + vibranceAmt * VIBRANCE_BOOST);\n        }\n    }\n    \n    // Saturation\n    if (saturation != 0.0) {\n        float gray = dot(color, LUMA_WEIGHTS);\n        float satMix = saturation < 0.0\n            ? 1.0 + saturation                      // -100 \u2192 gray\n            : 1.0 + saturation * SATURATION_BOOST;  // +100 \u2192 3x boost\n        color = mix(vec3(gray), color, satMix);\n    }\n    \n    fragColor = vec4(clamp(color, 0.0, 1.0), tex.a);\n}",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "171:170",
    0
   ],
   "floats.u_float1": [
    "171:169",
    0
   ],
   "floats.u_float2": [
    "171:167",
    0
   ],
   "floats.u_float3": [
    "171:168",
    0
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "171:167": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Vibrance"
  }
 },
 "171:168": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Saturation"
  }
 },
 "171:169": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Tint"
  }
 },
 "171:170": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Temperature"
  }
 },
 "179:172": {
  "inputs": {
   "choice": "RGB"
  },
  "class_type": "CustomCombo",
  "_meta": {
   "title": "Channel"
  }
 },
 "179:173": {
  "inputs": {
   "value": 36
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Output Black"
  }
 },
 "179:174": {
  "inputs": {
   "value": 85
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Input Black"
  }
 },
 "179:175": {
  "inputs": {
   "value": 255
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Input White"
  }
 },
 "179:176": {
  "inputs": {
   "value": 4.33
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Gamma"
  }
 },
 "179:177": {
  "inputs": {
   "value": 201
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Output White"
  }
 },
 "179:178": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\n// Levels Adjustment\n// u_int0:   channel      (0=RGB, 1=R, 2=G, 3=B)         default: 0\n// u_float0: input black  (0-255)                        default: 0\n// u_float1: input white  (0-255)                        default: 255\n// u_float2: gamma        (0.01-9.99)                    default: 1.0\n// u_float3: output black (0-255)                        default: 0\n// u_float4: output white (0-255)                        default: 255\n\nuniform sampler2D u_image0;\nuniform int u_int0;\nuniform float u_float0;\nuniform float u_float1;\nuniform float u_float2;\nuniform float u_float3;\nuniform float u_float4;\n\nin vec2 v_texCoord;\nout vec4 fragColor;\n\nvec3 applyLevels(vec3 color, float inBlack, float inWhite, float gamma, float outBlack, float outWhite) {\n    float inRange = max(inWhite - inBlack, 0.0001);\n    vec3 result = clamp((color - inBlack) / inRange, 0.0, 1.0);\n    result = pow(result, vec3(1.0 / gamma));\n    result = mix(vec3(outBlack), vec3(outWhite), result);\n    return result;\n}\n\nfloat applySingleChannel(float value, float inBlack, float inWhite, float gamma, float outBlack, float outWhite) {\n    float inRange = max(inWhite - inBlack, 0.0001);\n    float result = clamp((value - inBlack) / inRange, 0.0, 1.0);\n    result = pow(result, 1.0 / gamma);\n    result = mix(outBlack, outWhite, result);\n    return result;\n}\n\nvoid main() {\n    vec4 texColor = texture(u_image0, v_texCoord);\n    vec3 color = texColor.rgb;\n    \n    float inBlack = u_float0 / 255.0;\n    float inWhite = u_float1 / 255.0;\n    float gamma = u_float2;\n    float outBlack = u_float3 / 255.0;\n    float outWhite = u_float4 / 255.0;\n    \n    vec3 result;\n    \n    if (u_int0 == 0) {\n        result = applyLevels(color, inBlack, inWhite, gamma, outBlack, outWhite);\n    }\n    else if (u_int0 == 1) {\n        result = color;\n        result.r = applySingleChannel(color.r, inBlack, inWhite, gamma, outBlack, outWhite);\n    }\n    else if (u_int0 == 2) {\n        result = color;\n        result.g = applySingleChannel(color.g, inBlack, inWhite, gamma, outBlack, outWhite);\n    }\n    else if (u_int0 == 3) {\n        result = color;\n        result.b = applySingleChannel(color.b, inBlack, inWhite, gamma, outBlack, outWhite);\n    }\n    else {\n        result = color;\n    }\n    \n    fragColor = vec4(result, texColor.a);\n}",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "179:174",
    0
   ],
   "floats.u_float1": [
    "179:175",
    0
   ],
   "floats.u_float2": [
    "179:176",
    0
   ],
   "floats.u_float3": [
    "179:173",
    0
   ],
   "floats.u_float4": [
    "179:177",
    0
   ],
   "ints.u_int0": [
    "179:172",
    1
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "165:3": {
  "inputs": {
   "choice": "HSL"
  },
  "class_type": "CustomCombo",
  "_meta": {
   "title": "Custom Combo"
  }
 },
 "165:2": {
  "inputs": {
   "choice": "Master"
  },
  "class_type": "CustomCombo",
  "_meta": {
   "title": "Custom Combo"
  }
 },
 "165:161": {
  "inputs": {
   "value": 50
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "165:162": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "165:163": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "165:164": {
  "inputs": {
   "value": 3.9
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "165:1": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\nuniform int u_int0;      // Mode: 0=Master, 1=Reds, 2=Yellows, 3=Greens, 4=Cyans, 5=Blues, 6=Magentas, 7=Colorize\nuniform int u_int1;      // Color Space: 0=HSL, 1=HSB/HSV\nuniform float u_float0;  // Hue (-180 to 180)\nuniform float u_float1;  // Saturation (-100 to 100)\nuniform float u_float2;  // Lightness/Brightness (-100 to 100)\nuniform float u_float3;  // Overlap (0 to 100) - feathering between adjacent color ranges\n\nin vec2 v_texCoord;\nout vec4 fragColor;\n\n// Color range modes\nconst int MODE_MASTER   = 0;\nconst int MODE_RED      = 1;\nconst int MODE_YELLOW   = 2;\nconst int MODE_GREEN    = 3;\nconst int MODE_CYAN     = 4;\nconst int MODE_BLUE     = 5;\nconst int MODE_MAGENTA  = 6;\nconst int MODE_COLORIZE = 7;\n\n// Color space modes\nconst int COLORSPACE_HSL = 0;\nconst int COLORSPACE_HSB = 1;\n\nconst float EPSILON = 0.0001;\n\n//=============================================================================\n// RGB <-> HSL Conversions\n//=============================================================================\n\nvec3 rgb2hsl(vec3 c) {\n    float maxC = max(max(c.r, c.g), c.b);\n    float minC = min(min(c.r, c.g), c.b);\n    float delta = maxC - minC;\n\n    float h = 0.0;\n    float s = 0.0;\n    float l = (maxC + minC) * 0.5;\n\n    if (delta > EPSILON) {\n        s = l < 0.5\n            ? delta / (maxC + minC)\n            : delta / (2.0 - maxC - minC);\n\n        if (maxC == c.r) {\n            h = (c.g - c.b) / delta + (c.g < c.b ? 6.0 : 0.0);\n        } else if (maxC == c.g) {\n            h = (c.b - c.r) / delta + 2.0;\n        } else {\n            h = (c.r - c.g) / delta + 4.0;\n        }\n        h /= 6.0;\n    }\n\n    return vec3(h, s, l);\n}\n\nfloat hue2rgb(float p, float q, float t) {\n    t = fract(t);\n    if (t < 1.0/6.0) return p + (q - p) * 6.0 * t;\n    if (t < 0.5)       return q;\n    if (t < 2.0/3.0)   return p + (q - p) * (2.0/3.0 - t) * 6.0;\n    return p;\n}\n\nvec3 hsl2rgb(vec3 hsl) {\n    if (hsl.y < EPSILON) return vec3(hsl.z);\n\n    float q = hsl.z < 0.5\n        ? hsl.z * (1.0 + hsl.y)\n        : hsl.z + hsl.y - hsl.z * hsl.y;\n    float p = 2.0 * hsl.z - q;\n\n    return vec3(\n        hue2rgb(p, q, hsl.x + 1.0/3.0),\n        hue2rgb(p, q, hsl.x),\n        hue2rgb(p, q, hsl.x - 1.0/3.0)\n    );\n}\n\nvec3 rgb2hsb(vec3 c) {\n    float maxC = max(max(c.r, c.g), c.b);\n    float minC = min(min(c.r, c.g), c.b);\n    float delta = maxC - minC;\n\n    float h = 0.0;\n    float s = (maxC > EPSILON) ? delta / maxC : 0.0;\n    float b = maxC;\n\n    if (delta > EPSILON) {\n        if (maxC == c.r) {\n            h = (c.g - c.b) / delta + (c.g < c.b ? 6.0 : 0.0);\n        } else if (maxC == c.g) {\n            h = (c.b - c.r) / delta + 2.0;\n        } else {\n            h = (c.r - c.g) / delta + 4.0;\n        }\n        h /= 6.0;\n    }\n\n    return vec3(h, s, b);\n}\n\nvec3 hsb2rgb(vec3 hsb) {\n    vec3 rgb = clamp(abs(mod(hsb.x * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);\n    return hsb.z * mix(vec3(1.0), rgb, hsb.y);\n}\n\n//=============================================================================\n// Color Range Weight Calculation\n//=============================================================================\n\nfloat hueDistance(float a, float b) {\n    float d = abs(a - b);\n    return min(d, 1.0 - d);\n}\n\nfloat getHueWeight(float hue, float center, float overlap) {\n    float baseWidth = 1.0 / 6.0;\n    float feather = baseWidth * overlap;\n\n    float d = hueDistance(hue, center);\n\n    float inner = baseWidth * 0.5;\n    float outer = inner + feather;\n\n    return 1.0 - smoothstep(inner, outer, d);\n}\n\nfloat getModeWeight(float hue, int mode, float overlap) {\n    if (mode == MODE_MASTER || mode == MODE_COLORIZE) return 1.0;\n\n    if (mode == MODE_RED) {\n        return max(\n            getHueWeight(hue, 0.0, overlap),\n            getHueWeight(hue, 1.0, overlap)\n        );\n    }\n\n    float center = float(mode - 1) / 6.0;\n    return getHueWeight(hue, center, overlap);\n}\n\n//=============================================================================\n// Adjustment Functions\n//=============================================================================\n\nfloat adjustLightness(float l, float amount) {\n    return amount > 0.0\n        ? l + (1.0 - l) * amount\n        : l + l * amount;\n}\n\nfloat adjustBrightness(float b, float amount) {\n    return clamp(b + amount, 0.0, 1.0);\n}\n\nfloat adjustSaturation(float s, float amount) {\n    return amount > 0.0\n        ? s + (1.0 - s) * amount\n        : s + s * amount;\n}\n\nvec3 colorize(vec3 rgb, float hue, float sat, float light) {\n    float lum = dot(rgb, vec3(0.299, 0.587, 0.114));\n    float l = adjustLightness(lum, light);\n\n    vec3 hsl = vec3(fract(hue), clamp(sat, 0.0, 1.0), clamp(l, 0.0, 1.0));\n    return hsl2rgb(hsl);\n}\n\n//=============================================================================\n// Main\n//=============================================================================\n\nvoid main() {\n    vec4 original = texture(u_image0, v_texCoord);\n\n    float hueShift   = u_float0 / 360.0;   // -180..180 -> -0.5..0.5\n    float satAmount  = u_float1 / 100.0;   // -100..100 -> -1..1\n    float lightAmount= u_float2 / 100.0;   // -100..100 -> -1..1\n    float overlap    = u_float3 / 100.0;   // 0..100 -> 0..1\n\n    vec3 result;\n\n    if (u_int0 == MODE_COLORIZE) {\n        result = colorize(original.rgb, hueShift, satAmount, lightAmount);\n        fragColor = vec4(result, original.a);\n        return;\n    }\n\n    vec3 hsx = (u_int1 == COLORSPACE_HSL)\n        ? rgb2hsl(original.rgb)\n        : rgb2hsb(original.rgb);\n\n    float weight = getModeWeight(hsx.x, u_int0, overlap);\n\n    if (u_int0 != MODE_MASTER && hsx.y < EPSILON) {\n        weight = 0.0;\n    }\n\n    if (weight > EPSILON) {\n        float h = fract(hsx.x + hueShift * weight);\n        float s = clamp(adjustSaturation(hsx.y, satAmount * weight), 0.0, 1.0);\n        float v = (u_int1 == COLORSPACE_HSL)\n            ? clamp(adjustLightness(hsx.z, lightAmount * weight), 0.0, 1.0)\n            : clamp(adjustBrightness(hsx.z, lightAmount * weight), 0.0, 1.0);\n\n        vec3 adjusted = vec3(h, s, v);\n        result = (u_int1 == COLORSPACE_HSL)\n            ? hsl2rgb(adjusted)\n            : hsb2rgb(adjusted);\n    } else {\n        result = original.rgb;\n    }\n\n    fragColor = vec4(result, original.a);\n}\n",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "165:164",
    0
   ],
   "floats.u_float1": [
    "165:163",
    0
   ],
   "floats.u_float2": [
    "165:162",
    0
   ],
   "floats.u_float3": [
    "165:161",
    0
   ],
   "ints.u_int0": [
    "165:2",
    1
   ],
   "ints.u_int1": [
    "165:3",
    1
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "29:23": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\n\nin vec2 v_texCoord;\nlayout(location = 0) out vec4 fragColor0;\nlayout(location = 1) out vec4 fragColor1;\nlayout(location = 2) out vec4 fragColor2;\nlayout(location = 3) out vec4 fragColor3;\n\nvoid main() {\n  vec4 color = texture(u_image0, v_texCoord);\n  // Output each channel as grayscale to separate render targets\n  fragColor0 = vec4(vec3(color.r), 1.0);  // Red channel\n  fragColor1 = vec4(vec3(color.g), 1.0);  // Green channel\n  fragColor2 = vec4(vec3(color.b), 1.0);  // Blue channel\n  fragColor3 = vec4(vec3(color.a), 1.0);  // Alpha channel\n}\n",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "180": {
  "inputs": {
   "image": "example.png"
  },
  "class_type": "LoadImage",
  "_meta": {
   "title": "Load Image"
  }
 },
 "182": {
  "inputs": {
   "images": [
    "144:143",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "183": {
  "inputs": {
   "images": [
    "147:145",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "184": {
  "inputs": {
   "images": [
    "148:15",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "187": {
  "inputs": {
   "images": [
    "179:178",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "188": {
  "inputs": {
   "images": [
    "160:16",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "189": {
  "inputs": {
   "images": [
    "171:166",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "190": {
  "inputs": {
   "images": [
    "165:1",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "193": {
  "inputs": {
   "images": [
    "29:23",
    3
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "194": {
  "inputs": {
   "images": [
    "29:23",
    2
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "191": {
  "inputs": {
   "images": [
    "29:23",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "192": {
  "inputs": {
   "images": [
    "29:23",
    1
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "10:4": {
  "inputs": {
   "curve": {
    "points": [
     [
      0.0,
      0.0
     ],
     [
      1.0,
      1.0
     ]
    ],
    "interpolation": "monotone_cubic"
   },
   "histogram": [
    "10:9",
    0
   ]
  },
  "class_type": "CurveEditor",
  "_meta": {
   "title": "RGB Master"
  }
 },
 "10:5": {
  "inputs": {
   "curve": {
    "points": [
     [
      0.0,
      0.0
     ],
     [
      1.0,
      1.0
     ]
    ],
    "interpolation": "monotone_cubic"
   },
   "histogram": [
    "10:9",
    2
   ]
  },
  "class_type": "CurveEditor",
  "_meta": {
   "title": "Red"
  }
 },
 "10:6": {
  "inputs": {
   "curve": {
    "points": [
     [
      0.0,
      0.0
     ],
     [
      1.0,
      1.0
     ]
    ],
    "interpolation": "monotone_cubic"
   },
   "histogram": [
    "10:9",
    3
   ]
  },
  "class_type": "CurveEditor",
  "_meta": {
   "title": "Green"
  }
 },
 "10:7": {
  "inputs": {
   "curve": {
    "points": [
     [
      0.0,
      0.0
     ],
     [
      1.0,
      1.0
     ]
    ],
    "interpolation": "monotone_cubic"
   },
   "histogram": [
    "10:9",
    4
   ]
  },
  "class_type": "CurveEditor",
  "_meta": {
   "title": "Blue"
  }
 },
 "10:8": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\nuniform sampler2D u_curve0;  // RGB master curve (256x1 LUT)\nuniform sampler2D u_curve1;  // Red channel curve\nuniform sampler2D u_curve2;  // Green channel curve\nuniform sampler2D u_curve3;  // Blue channel curve\n\nin vec2 v_texCoord;\nlayout(location = 0) out vec4 fragColor0;\n\n// GIMP-compatible curve lookup with manual linear interpolation.\n// Matches gimp_curve_map_value_inline() from gimpcurve-map.c:\n//   index = value * (n_samples - 1)\n//   f = fract(index)\n//   result = (1-f) * samples[floor] + f * samples[ceil]\n//\n// Uses texelFetch (NEAREST) to avoid GPU half-texel offset issues\n// that occur with texture() + GL_LINEAR on small 256x1 LUTs.\nfloat applyCurve(sampler2D curve, float value) {\n    value = clamp(value, 0.0, 1.0);\n\n    float pos = value * 255.0;\n    int lo = int(floor(pos));\n    int hi = min(lo + 1, 255);\n    float f = pos - float(lo);\n\n    float a = texelFetch(curve, ivec2(lo, 0), 0).r;\n    float b = texelFetch(curve, ivec2(hi, 0), 0).r;\n\n    return a + f * (b - a);\n}\n\nvoid main() {\n    vec4 color = texture(u_image0, v_texCoord);\n\n    // GIMP order: per-channel curves first, then RGB master curve.\n    // See gimp_curve_map_pixels() default case in gimpcurve-map.c:\n    //   dest = colors_curve( channel_curve( src ) )\n    float tmp_r = applyCurve(u_curve1, color.r);\n    float tmp_g = applyCurve(u_curve2, color.g);\n    float tmp_b = applyCurve(u_curve3, color.b);\n    color.r = applyCurve(u_curve0, tmp_r);\n    color.g = applyCurve(u_curve0, tmp_g);\n    color.b = applyCurve(u_curve0, tmp_b);\n\n    fragColor0 = vec4(color.rgb, color.a);\n}\n",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "curves.u_curve0": [
    "10:4",
    0
   ],
   "curves.u_curve1": [
    "10:5",
    0
   ],
   "curves.u_curve2": [
    "10:6",
    0
   ],
   "curves.u_curve3": [
    "10:7",
    0
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "10:9": {
  "inputs": {
   "image": [
    "180",
    0
   ]
  },
  "class_type": "ImageHistogram",
  "_meta": {
   "title": "Image Histogram"
  }
 },
 "181": {
  "inputs": {
   "images": [
    "10:8",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "157:149": {
  "inputs": {
   "value": -100
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Shadows Red"
  }
 },
 "157:150": {
  "inputs": {
   "value": 47
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Shadows Green"
  }
 },
 "157:151": {
  "inputs": {
   "value": 6
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Shadows Blue"
  }
 },
 "157:152": {
  "inputs": {
   "value": -6
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Midtones Red"
  }
 },
 "157:153": {
  "inputs": {
   "value": 7
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Midtones Green"
  }
 },
 "157:154": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Midtones Blue"
  }
 },
 "157:155": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Highlights Red"
  }
 },
 "157:11": {
  "inputs": {
   "value": 0
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Highlights Green"
  }
 },
 "157:12": {
  "inputs": {
   "value": 58
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Highlights Blue"
  }
 },
 "157:13": {
  "inputs": {
   "value": true
  },
  "class_type": "PrimitiveBoolean",
  "_meta": {
   "title": "Preserve Luminosity"
  }
 },
 "157:156": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\nuniform float u_float0; // shadows red (-100 to 100)\nuniform float u_float1; // shadows green (-100 to 100)\nuniform float u_float2; // shadows blue (-100 to 100)\nuniform float u_float3; // midtones red (-100 to 100)\nuniform float u_float4; // midtones green (-100 to 100)\nuniform float u_float5; // midtones blue (-100 to 100)\nuniform float u_float6; // highlights red (-100 to 100)\nuniform float u_float7; // highlights green (-100 to 100)\nuniform float u_float8; // highlights blue (-100 to 100)\nuniform bool u_bool0;   // preserve luminosity\n\nin vec2 v_texCoord;\nout vec4 fragColor;\n\nvec3 rgb2hsl(vec3 c) {\n    float maxC = max(c.r, max(c.g, c.b));\n    float minC = min(c.r, min(c.g, c.b));\n    float l = (maxC + minC) * 0.5;\n    if (maxC == minC) return vec3(0.0, 0.0, l);\n    float d = maxC - minC;\n    float s = l > 0.5 ? d / (2.0 - maxC - minC) : d / (maxC + minC);\n    float h;\n    if (maxC == c.r) {\n        h = (c.g - c.b) / d + (c.g < c.b ? 6.0 : 0.0);\n    } else if (maxC == c.g) {\n        h = (c.b - c.r) / d + 2.0;\n    } else {\n        h = (c.r - c.g) / d + 4.0;\n    }\n    h /= 6.0;\n    return vec3(h, s, l);\n}\n\nfloat hue2rgb(float p, float q, float t) {\n    if (t < 0.0) t += 1.0;\n    if (t > 1.0) t -= 1.0;\n    if (t < 1.0 / 6.0) return p + (q - p) * 6.0 * t;\n    if (t < 1.0 / 2.0) return q;\n    if (t < 2.0 / 3.0) return p + (q - p) * (2.0 / 3.0 - t) * 6.0;\n    return p;\n}\n\nvec3 hsl2rgb(vec3 hsl) {\n    float h = hsl.x, s = hsl.y, l = hsl.z;\n    if (s == 0.0) return vec3(l);\n    float q = l < 0.5 ? l * (1.0 + s) : l + s - l * s;\n    float p = 2.0 * l - q;\n    return vec3(\n        hue2rgb(p, q, h + 1.0 / 3.0),\n        hue2rgb(p, q, h),\n        hue2rgb(p, q, h - 1.0 / 3.0)\n    );\n}\n\nvoid main() {\n    vec4 tex = texture(u_image0, v_texCoord);\n    vec3 color = tex.rgb;\n\n    // Build shadows/midtones/highlights vectors (scale -100..100 to -1..1)\n    vec3 shadows = vec3(u_float0, u_float1, u_float2) * 0.01;\n    vec3 midtones = vec3(u_float3, u_float4, u_float5) * 0.01;\n    vec3 highlights = vec3(u_float6, u_float7, u_float8) * 0.01;\n\n    // GIMP: HSL lightness for weight calculation\n    float maxC = max(color.r, max(color.g, color.b));\n    float minC = min(color.r, min(color.g, color.b));\n    float lightness = (maxC + minC) * 0.5;\n\n    // GIMP weight curves: linear ramps with constants a=0.25, b=0.333, scale=0.7\n    const float a = 0.25;\n    const float b = 0.333;\n    const float scale = 0.7;\n\n    float sw = clamp((lightness - b) / -a + 0.5, 0.0, 1.0) * scale;\n    float mw = clamp((lightness - b) / a + 0.5, 0.0, 1.0) *\n               clamp((lightness + b - 1.0) / -a + 0.5, 0.0, 1.0) * scale;\n    float hw = clamp((lightness + b - 1.0) / a + 0.5, 0.0, 1.0) * scale;\n\n    color += sw * shadows + mw * midtones + hw * highlights;\n\n    if (u_bool0) {\n        vec3 hsl = rgb2hsl(clamp(color, 0.0, 1.0));\n        hsl.z = lightness;\n        color = hsl2rgb(hsl);\n    }\n\n    fragColor = vec4(clamp(color, 0.0, 1.0), tex.a);\n}",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "157:149",
    0
   ],
   "floats.u_float1": [
    "157:150",
    0
   ],
   "floats.u_float2": [
    "157:151",
    0
   ],
   "floats.u_float3": [
    "157:152",
    0
   ],
   "floats.u_float4": [
    "157:153",
    0
   ],
   "floats.u_float5": [
    "157:154",
    0
   ],
   "floats.u_float6": [
    "157:155",
    0
   ],
   "floats.u_float7": [
    "157:11",
    0
   ],
   "floats.u_float8": [
    "157:12",
    0
   ],
   "bools.u_bool0": [
    "157:13",
    0
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 },
 "186": {
  "inputs": {
   "images": [
    "157:156",
    0
   ]
  },
  "class_type": "PreviewImage",
  "_meta": {
   "title": "Preview Image"
  }
 },
 "144:30": {
  "inputs": {
   "value": 13
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "144:31": {
  "inputs": {
   "value": 51
  },
  "class_type": "PrimitiveFloat",
  "_meta": {
   "title": "Float"
  }
 },
 "144:143": {
  "inputs": {
   "fragment_shader": "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_image0;\nuniform float u_float0; // Brightness slider -100..100\nuniform float u_float1; // Contrast slider -100..100\n\nin vec2 v_texCoord;\nout vec4 fragColor;\n\nconst float MID_GRAY = 0.18;  // 18% reflectance\n\n// sRGB gamma 2.2 approximation\nvec3 srgbToLinear(vec3 c) {\n    return pow(max(c, 0.0), vec3(2.2));\n}\n\nvec3 linearToSrgb(vec3 c) {\n    return pow(max(c, 0.0), vec3(1.0/2.2));\n}\n\nfloat mapBrightness(float b) {\n    return clamp(b / 100.0, -1.0, 1.0);\n}\n\nfloat mapContrast(float c) {\n    return clamp(c / 100.0 + 1.0, 0.0, 2.0);\n}\n\nvoid main() {\n    vec4 orig = texture(u_image0, v_texCoord);\n\n    float brightness = mapBrightness(u_float0);\n    float contrast   = mapContrast(u_float1);\n\n    vec3 lin = srgbToLinear(orig.rgb);\n\n    lin = (lin - MID_GRAY) * contrast + brightness + MID_GRAY;\n\n    // Convert back to sRGB\n    vec3 result = linearToSrgb(clamp(lin, 0.0, 1.0));\n\n    fragColor = vec4(result, orig.a);\n}\n",
   "size_mode": "from_input",
   "images.image0": [
    "180",
    0
   ],
   "floats.u_float0": [
    "144:30",
    0
   ],
   "floats.u_float1": [
    "144:31",
    0
   ]
  },
  "class_type": "GLSLShader",
  "_meta": {
   "title": "GLSL Shader"
  }
 }
}