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

70 lines
1.4 KiB
Plaintext

{
"name": "mirror",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"direction": 0,
"offset": 0
},
"shader_model": {
"code": "",
"global": "vec2 uvmirror_h(vec2 uv, float offset) {\n\treturn vec2(max(0, abs(uv.x-0.5)-0.5*offset)+0.5, uv.y);\n}\nvec2 uvmirror_v(vec2 uv, float offset) {\n\treturn vec2(uv.x, max(0, abs(uv.y-0.5)-0.5*offset)+0.5);\n}",
"inputs": [
{
"default": "vec4($uv, 0, 1)",
"label": "",
"longdesc": "The input image",
"name": "i",
"shortdesc": "Input",
"type": "rgba"
}
],
"instance": "",
"longdesc": "A node that mirrors its input while applying an offset from the center",
"name": "Mirror",
"outputs": [
{
"longdesc": "Shows the mirrored image",
"rgba": "$i(uvmirror_$direction($uv, $offset))",
"shortdesc": "Output",
"type": "rgba"
}
],
"parameters": [
{
"default": 0,
"label": "",
"longdesc": "The mirror direction (horizontal or vertical)",
"name": "direction",
"shortdesc": "Direction",
"type": "enum",
"values": [
{
"name": "Horizontal",
"value": "h"
},
{
"name": "Vertical",
"value": "v"
}
]
},
{
"control": "None",
"default": 0,
"label": "",
"longdesc": "The offset from the center",
"max": 1,
"min": 0,
"name": "offset",
"shortdesc": "Offset",
"step": 0.005,
"type": "float"
}
],
"shortdesc": "Mirror"
},
"type": "shader"
}