material-maker/addons/material_maker/nodes/kaleidoscope.mmg

64 lines
1.5 KiB
Plaintext

{
"name": "kaleidoscope",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"count": 5,
"offset": 0
},
"shader_model": {
"code": "",
"global": "vec2 kal_rotate(vec2 uv, float count, float offset) {\n\tfloat pi = 3.14159265359;\n\toffset *= pi/180.0;\n\toffset += pi*(1.0/count+0.5);\n\tuv -= vec2(0.5);\n\tfloat l = length(uv);\n\tfloat a = mod(atan(uv.y, uv.x)+offset, 2.0*pi/count)-offset;\n\treturn vec2(0.5)+l*vec2(cos(a), sin(a));\n}",
"inputs": [
{
"default": "vec4($uv, 0, 1)",
"label": "",
"longdesc": "The input image",
"name": "i",
"shortdesc": "Input",
"type": "rgba"
}
],
"instance": "",
"longdesc": "Replicated an angle of the input image several times around the center.",
"name": "Kaleidoscope",
"outputs": [
{
"longdesc": "Shows the transformed image",
"rgba": "$i(kal_rotate($uv, $count, $offset))",
"shortdesc": "Output",
"type": "rgba"
}
],
"parameters": [
{
"control": "None",
"default": 0,
"label": "",
"longdesc": "The number of replications of an angle of the input",
"max": 10,
"min": 2,
"name": "count",
"shortdesc": "Count",
"step": 1,
"type": "float"
},
{
"control": "None",
"default": 0,
"label": "",
"longdesc": "The angular offset of the replicated angle of the input",
"max": 180,
"min": -180,
"name": "offset",
"shortdesc": "Offset",
"step": 0.1,
"type": "float"
}
],
"shortdesc": "Kaleidoscope"
},
"type": "shader"
}