material-maker/addons/material_maker/nodes/splatter_base.mmg
2019-11-22 23:07:34 +01:00

80 lines
1.6 KiB
Plaintext

{
"name": "splatter_base",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"name": 0.5,
"offx": 0,
"offy": 0,
"repeat": 8,
"scale": 1.64,
"size": 1
},
"shader_model": {
"code": "vec4 $(name_uv)_xyzw = splatter($uv, $repeat, $scale, vec2($offx, $offy));",
"global": "vec4 splatter(vec2 uv, float repeat, float scale, vec2 offset) {\n\tvec2 center = (floor(uv*repeat-offset)+0.5+offset)/repeat;\n\tvec2 tmp = (uv-center)*repeat*2.0;\n\tvec2 src_uv;\n\tsrc_uv.x = tmp.x*cos(center.x)+tmp.y*sin(center.x);\n\tsrc_uv.y = tmp.x*sin(center.x)-tmp.y*cos(center.x);\n\tsrc_uv /= scale;\n\tsrc_uv += 0.5;\n\treturn vec4(src_uv, center);\n}",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "f"
},
{
"default": "1.0",
"label": "",
"name": "mask",
"type": "f"
}
],
"instance": "",
"name": "Splatter",
"outputs": [
{
"f": "$in($(name_uv)_xyzw.xy)*$mask($(name_uv)_xyzw.zw)",
"type": "f"
}
],
"parameters": [
{
"default": 4,
"label": "Repeat",
"max": 128,
"min": 2,
"name": "repeat",
"step": 1,
"type": "float"
},
{
"default": 1,
"label": "Scale",
"max": 2,
"min": 0,
"name": "scale",
"step": 0.01,
"type": "float"
},
{
"default": 0.5,
"label": "Offset X",
"max": 1,
"min": 0,
"name": "offx",
"step": 0.1,
"type": "float"
},
{
"default": 0.5,
"label": "Offset Y",
"max": 1,
"min": 0,
"name": "offy",
"step": 0.1,
"type": "float"
}
]
},
"type": "shader"
}