material-maker/addons/material_maker/nodes/weave.mmg
2019-11-22 07:50:17 +01:00

57 lines
1.0 KiB
Plaintext

{
"name": "weave",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"columns": 4,
"rows": 4,
"width": 0.85
},
"shader_model": {
"code": "",
"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": "Size X",
"max": 32,
"min": 2,
"name": "columns",
"step": 1,
"type": "float"
},
{
"default": 4,
"label": "Size Y",
"max": 32,
"min": 2,
"name": "rows",
"step": 1,
"type": "float"
},
{
"default": 0.8,
"label": "Width",
"max": 1,
"min": 0,
"name": "width",
"step": 0.05,
"type": "float"
}
]
},
"type": "shader"
}