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

58 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-10-27 14:36:16 +01:00
{
"name": "weave",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"columns": 8,
"rows": 8,
"width": 0.85
},
"shader_model": {
"global": "float weave(vec2 uv, vec2 count, float width) {\n uv *= count;\n\tfloat c = (sin(3.1415926*(uv.x+floor(uv.y)))*0.5+0.5)*step(abs(fract(uv.y)-0.5), width*0.5);\n\tc = max(c, (sin(3.1415926*(1.0+uv.y+floor(uv.x)))*0.5+0.5)*step(abs(fract(uv.x)-0.5), width*0.5));\n\treturn c;\n}",
"inputs": [
],
"instance": "",
"name": "Weave",
"outputs": [
{
"f": "weave($uv, vec2($columns, $rows), $width)",
"type": "f"
}
],
"parameters": [
{
"default": 4,
"label": "",
"max": 32,
"min": 2,
"name": "columns",
"step": 1,
"type": "float",
"widget": "spinbox"
},
{
"default": 4,
"label": "",
"max": 32,
"min": 2,
"name": "rows",
"step": 1,
"type": "float",
"widget": "spinbox"
},
{
"default": 0.8,
"label": "",
"max": 1,
"min": 0,
"name": "width",
"step": 0.05,
"type": "float"
}
]
},
"type": "shader"
}