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

47 lines
944 B
Plaintext
Raw Normal View History

{
"name": "sdcirclerepeat",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"c": 6
},
"seed_value": 44955,
"shader_model": {
"code": "",
"global": "vec2 circle_repeat_transform_2d(vec2 p, float count) {\n\tfloat r = 6.28/count;\n\tfloat pa = atan(p.x, p.y);\n\tfloat a = mod(pa+0.5*r, r)-0.5*r;\n\tvec2 rv;\n\tfloat c = cos(a-pa);\n\tfloat s = sin(a-pa);\n\trv.x = p.x*c+p.y*s;\n\trv.y = -p.x*s+p.y*c;\n\treturn rv;\n}\n",
"includes": [
""
],
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "sdf2d"
}
],
"instance": "",
"name": "Circle Repeat",
"outputs": [
{
"sdf2d": "$in(circle_repeat_transform_2d($uv-vec2(0.5), $c)+vec2(0.5))",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 4,
"label": "",
"max": 32,
"min": 1,
"name": "c",
"step": 1,
"type": "float"
}
]
},
"type": "shader"
}