mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
{
|
|
"name": "adjust_hsv",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"parameters": {
|
|
"hue": 0,
|
|
"saturation": 1,
|
|
"value": 1
|
|
},
|
|
"shader_model": {
|
|
"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": "",
|
|
"name": "in",
|
|
"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}",
|
|
"name": "AdjustHSV",
|
|
"outputs": [
|
|
{
|
|
"rgba": "$(name)_f($in($(uv)))"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "Hue",
|
|
"max": 0.5,
|
|
"min": -0.5,
|
|
"name": "hue",
|
|
"step": 0,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 1,
|
|
"label": "Saturation",
|
|
"max": 2,
|
|
"min": 0,
|
|
"name": "saturation",
|
|
"step": 0,
|
|
"type": "float"
|
|
},
|
|
{
|
|
"default": 1,
|
|
"label": "Value",
|
|
"max": 2,
|
|
"min": 0,
|
|
"name": "value",
|
|
"step": 0,
|
|
"type": "float"
|
|
}
|
|
]
|
|
}
|
|
} |