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

70 lines
1.4 KiB
Plaintext
Raw Normal View History

2019-10-27 14:36:16 +01:00
{
"name": "mirror",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"direction": 0,
2020-09-29 22:27:10 +02:00
"offset": 0
2019-10-27 14:36:16 +01:00
},
"shader_model": {
2020-09-29 22:27:10 +02:00
"code": "",
2019-10-27 14:36:16 +01:00
"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": "",
2020-09-29 22:27:10 +02:00
"longdesc": "The input image",
2019-10-27 14:36:16 +01:00
"name": "i",
2020-09-29 22:27:10 +02:00
"shortdesc": "Input",
2019-10-27 14:36:16 +01:00
"type": "rgba"
}
],
"instance": "",
2020-09-29 22:27:10 +02:00
"longdesc": "A node that mirrors its input while applying an offset from the center",
2019-10-27 14:36:16 +01:00
"name": "Mirror",
"outputs": [
{
2020-09-29 22:27:10 +02:00
"longdesc": "Shows the mirrored image",
2019-10-27 14:36:16 +01:00
"rgba": "$i(uvmirror_$direction($uv, $offset))",
2020-09-29 22:27:10 +02:00
"shortdesc": "Output",
2019-10-27 14:36:16 +01:00
"type": "rgba"
}
],
"parameters": [
{
"default": 0,
"label": "",
2020-09-29 22:27:10 +02:00
"longdesc": "The mirror direction (horizontal or vertical)",
2019-10-27 14:36:16 +01:00
"name": "direction",
2020-09-29 22:27:10 +02:00
"shortdesc": "Direction",
2019-10-27 14:36:16 +01:00
"type": "enum",
"values": [
{
"name": "Horizontal",
"value": "h"
},
{
"name": "Vertical",
"value": "v"
}
]
},
{
2020-09-29 22:27:10 +02:00
"control": "None",
2019-10-27 14:36:16 +01:00
"default": 0,
"label": "",
2020-09-29 22:27:10 +02:00
"longdesc": "The offset from the center",
2019-10-27 14:36:16 +01:00
"max": 1,
"min": 0,
"name": "offset",
2020-09-29 22:27:10 +02:00
"shortdesc": "Offset",
2019-10-27 14:36:16 +01:00
"step": 0.005,
2020-09-29 22:27:10 +02:00
"type": "float"
2019-10-27 14:36:16 +01:00
}
2020-09-29 22:27:10 +02:00
],
"shortdesc": "Mirror"
},
"type": "shader"
2019-10-27 14:36:16 +01:00
}