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

316 lines
5.7 KiB
Plaintext

{
"connections": [
{
"from": "gen_inputs",
"from_port": 0,
"to": "buffer",
"to_port": 0
},
{
"from": "buffer",
"from_port": 0,
"to": "transform_3",
"to_port": 0
},
{
"from": "transform_3",
"from_port": 0,
"to": "blurx_convolution",
"to_port": 0
},
{
"from": "blurx_convolution",
"from_port": 0,
"to": "transform_3_2",
"to_port": 0
},
{
"from": "transform_3_2",
"from_port": 1,
"to": "gen_outputs",
"to_port": 0
}
],
"label": "Directional Blur",
"name": "directional_blur",
"node_position": {
"x": 0,
"y": 0
},
"nodes": [
{
"convolution_params": {
"input_type": "rgba",
"matrix_function": "exp(-0.5*(pow(x/sigma, 2.0)))/(6.28318530718 *sigma*sigma)",
"normalized": true,
"output_type": "rgba",
"parameters": [
{
"max": 50,
"min": 0.05,
"name": "sigma",
"type": "float"
}
],
"x": 50,
"y": 0
},
"name": "blurx_convolution",
"node_position": {
"x": -412.5,
"y": -99.5
},
"parameters": {
"sigma": 50,
"size": 9
},
"type": "convolution"
},
{
"name": "buffer",
"node_position": {
"x": -410.25,
"y": -271.75
},
"parameters": {
"lod": 0,
"size": 9
},
"type": "buffer"
},
{
"name": "gen_parameters",
"node_position": {
"x": -436.666626,
"y": -413.666656
},
"parameters": {
"param0": 9,
"param1": 50,
"param2": 45
},
"type": "remote",
"widgets": [
{
"label": "Grid size:",
"linked_widgets": [
{
"node": "buffer",
"widget": "size"
},
{
"node": "blurx_convolution",
"widget": "size"
}
],
"name": "param0",
"type": "linked_control"
},
{
"label": "Sigma:",
"linked_widgets": [
{
"node": "blurx_convolution",
"widget": "sigma"
}
],
"name": "param1",
"type": "linked_control"
},
{
"label": "Angle:",
"linked_widgets": [
{
"node": "transform_3",
"widget": "rotate"
},
{
"node": "transform_3_2",
"widget": "rotate"
}
],
"name": "param2",
"type": "linked_control"
}
]
},
{
"name": "gen_inputs",
"node_position": {
"x": -738.666626,
"y": -190.392853
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_outputs",
"node_position": {
"x": -45.452393,
"y": -195.392853
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "transform_3",
"node_position": {
"x": -409.653931,
"y": -193.871338
},
"parameters": {
"repeat": true,
"rotate": 45,
"scale": 1.5,
"scale_x": 1,
"scale_y": 1,
"translate_x": 0,
"translate_y": 0
},
"shader_model": {
"code": "",
"global": "vec2 db_rotate(vec2 uv, float rotate, float scale) {\n \tvec2 rv;\n\tuv -= vec2(0.5);\n\trv.x = cos(rotate)*uv.x + sin(rotate)*uv.y;\n\trv.y = -sin(rotate)*uv.x + cos(rotate)*uv.y;\n\trv *= scale;\n\trv += vec2(0.5);\n\treturn fract(rv);\n}",
"inputs": [
{
"default": "vec4($uv, 0.0, 1.0)",
"label": "",
"name": "i",
"type": "rgba"
},
{
"default": "1.0",
"label": "",
"name": "r",
"type": "f"
}
],
"instance": "",
"name": "DBRotate",
"outputs": [
{
"rgba": "$i(db_rotate($uv, $rotate*0.01745329251*(2.0*$r($uv)-1.0), $scale))",
"type": "rgba"
},
{
"rgba": "$i(db_rotate($uv, -$rotate*0.01745329251*(2.0*$r($uv)-1.0), 1.0/$scale))",
"type": "rgba"
}
],
"parameters": [
{
"default": 0,
"label": "Rotate:",
"max": 720,
"min": -720,
"name": "rotate",
"step": 0.005,
"type": "float",
"widget": "spinbox"
},
{
"default": 1,
"label": "Label",
"max": 2,
"min": 0.1,
"name": "scale",
"step": 0.01,
"type": "float",
"widget": "spinbox"
}
]
},
"type": "shader"
},
{
"name": "transform_3_2",
"node_position": {
"x": -407.388733,
"y": -24.678955
},
"parameters": {
"repeat": true,
"rotate": 45,
"scale": 1.5,
"scale_x": 1,
"scale_y": 1,
"translate_x": 0,
"translate_y": 0
},
"shader_model": {
"code": "",
"global": "vec2 db_rotate(vec2 uv, float rotate, float scale) {\n \tvec2 rv;\n\tuv -= vec2(0.5);\n\trv.x = cos(rotate)*uv.x + sin(rotate)*uv.y;\n\trv.y = -sin(rotate)*uv.x + cos(rotate)*uv.y;\n\trv *= scale;\n\trv += vec2(0.5);\n\treturn fract(rv);\n}",
"inputs": [
{
"default": "vec4($uv, 0.0, 1.0)",
"label": "",
"name": "i",
"type": "rgba"
},
{
"default": "1.0",
"label": "",
"name": "r",
"type": "f"
}
],
"instance": "",
"name": "DBRotate",
"outputs": [
{
"rgba": "$i(db_rotate($uv, $rotate*0.01745329251*(2.0*$r($uv)-1.0), $scale))",
"type": "rgba"
},
{
"rgba": "$i(db_rotate($uv, -$rotate*0.01745329251*(2.0*$r($uv)-1.0), 1.0/$scale))",
"type": "rgba"
}
],
"parameters": [
{
"default": 0,
"label": "Rotate:",
"max": 720,
"min": -720,
"name": "rotate",
"step": 0.005,
"type": "float",
"widget": "spinbox"
},
{
"default": 1,
"label": "Label",
"max": 2,
"min": 0.1,
"name": "scale",
"step": 0.01,
"type": "float",
"widget": "spinbox"
}
]
},
"type": "shader"
}
],
"parameters": {
"param0": 9,
"param1": 50,
"param2": 45
},
"type": "graph"
}