{ "name": "adjust_hsv", "node_position": { "x": 0, "y": 0 }, "parameters": { "hue": 0, "saturation": 1, "value": 1 }, "shader_model": { "code": "", "global": "vec3 rgb_to_hsv(vec3 c) {\n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\tvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\n\tvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\n\n\tfloat d = q.x - min(q.w, q.y);\n\tfloat e = 1.0e-10;\n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\nvec3 hsv_to_rgb(vec3 c) {\n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n", "inputs": [ { "default": "vec4($uv.x, $uv.y, 0.0, 1.0)", "label": "", "longdesc": "The input image", "name": "in", "shortdesc": "Input", "type": "rgba" } ], "instance": "vec4 $(name)_f(vec4 c) {\n\tvec3 hsv = rgb_to_hsv(c.rgb);\n\treturn vec4(hsv_to_rgb(vec3(fract(hsv.x+$(hue)), clamp(hsv.y*$(saturation), 0.0, 1.0), clamp(hsv.z*$(value), 0.0, 1.0))), c.a);\n}", "longdesc": "A node that adjusts the Hue, Saturation and Value of its input", "name": "AdjustHSV", "outputs": [ { "longdesc": "Shows the image with adjusted Hue, Saturation and Value", "rgba": "$(name)_f($in($(uv)))", "shortdesc": "Output", "type": "rgba" } ], "parameters": [ { "control": "None", "default": 0, "label": "Hue", "longdesc": "The Hue adjustment", "max": 0.5, "min": -0.5, "name": "hue", "shortdesc": "Hue", "step": 0, "type": "float" }, { "control": "None", "default": 1, "label": "Saturation", "longdesc": "The Saturation adjustment", "max": 2, "min": 0, "name": "saturation", "shortdesc": "Saturation", "step": 0, "type": "float" }, { "control": "None", "default": 1, "label": "Value", "longdesc": "The Value adjustment", "max": 2, "min": 0, "name": "value", "shortdesc": "Value", "step": 0, "type": "float" } ], "shortdesc": "Adjust HSV" }, "type": "shader" }