Added workflow and 2D SDF node templates

This commit is contained in:
Rodolphe Suescun 2020-01-03 16:06:54 +01:00
parent 53cdb893af
commit 44a71faccc
5 changed files with 1181 additions and 0 deletions

View File

@ -0,0 +1,54 @@
{
"name": "mwf_create_map",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"angle": 0,
"height": 1
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "f"
}
],
"instance": "",
"name": "Create Map",
"outputs": [
{
"rgb": "vec3($height*$in($uv), $angle*0.00277777777+0.5, rand(vec2($seed)))",
"type": "rgb"
}
],
"parameters": [
{
"control": "None",
"default": 1,
"label": "Height",
"max": 1,
"min": 0,
"name": "height",
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0,
"label": "Angle",
"max": 180,
"min": -180,
"name": "angle",
"step": 0.1,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,74 @@
{
"name": "mwf_map",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
},
"shader_model": {
"code": "float $(name_uv)_angle = 6.28318530718*($map($uv).y-0.5);\nvec2 $(name_uv)_uv = matmap_uv($uv, $(name_uv)_angle, $map($uv).z);\n",
"global": "vec2 matmap_uv(vec2 uv, float angle, float seed) {\n\tuv -= vec2(0.5);\n\tvec2 rv;\n\trv.x = uv.x*cos(angle)+uv.y*sin(angle);\n\trv.y = -uv.x*sin(angle)+uv.y*cos(angle);\n\treturn fract(rv + rand2(vec2(seed)));\n}\n\nvec3 matmap_rotate_nm(vec3 input, float angle) {\n\tvec2 uv = input.xy - vec2(0.5);\n\tvec2 rv;\n\trv.x = uv.x*cos(angle)+uv.y*sin(angle);\n\trv.y = -uv.x*sin(angle)+uv.y*cos(angle);\n\treturn vec3(rv + vec2(0.5), input.z);\n}\n",
"inputs": [
{
"default": "vec3(0.0)",
"label": "Map",
"name": "map",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Albedo",
"name": "mat1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "ORM",
"name": "mat2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Emission",
"name": "mat3",
"type": "rgb"
},
{
"default": "vec3(0.5, 0.5, 1.0)",
"label": "Normal",
"name": "mat4",
"type": "rgb"
}
],
"instance": "",
"name": "Apply Map",
"outputs": [
{
"f": "$map($uv).x",
"type": "f"
},
{
"rgb": "$mat1($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "$mat2($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "$mat3($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "matmap_rotate_nm($mat4($(name_uv)_uv), -$(name_uv)_angle)",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
}

View File

@ -0,0 +1,104 @@
{
"name": "mwf_mix",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
},
"shader_model": {
"code": "float $(name_uv)_a1 = step($h1($uv), $h2($uv));",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "Height 1",
"name": "h1",
"type": "f"
},
{
"default": "vec3(0.0)",
"label": "Color 1",
"name": "c1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "ORM 1",
"name": "orm1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Emission 1",
"name": "em1",
"type": "rgb"
},
{
"default": "vec3(0.5, 0.5, 1.0)",
"label": "Normal 1",
"name": "nm1",
"type": "rgb"
},
{
"default": "0.0",
"label": "Height 2",
"name": "h2",
"type": "f"
},
{
"default": "vec3(0.0)",
"label": "Color 2",
"name": "c2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "ORM 2",
"name": "orm2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Emission 2",
"name": "em2",
"type": "rgb"
},
{
"default": "vec3(0.5, 0.5, 1.0)",
"label": "Normal 2",
"name": "nm2",
"type": "rgb"
}
],
"instance": "",
"name": "MWF Mix",
"outputs": [
{
"f": "max($h1($uv), $h2($uv))",
"type": "f"
},
{
"rgb": "mix($c1($uv), $c2($uv), $(name_uv)_a1)",
"type": "rgb"
},
{
"rgb": "mix($orm1($uv), $orm2($uv), $(name_uv)_a1)",
"type": "rgb"
},
{
"rgb": "mix($em1($uv), $em2($uv), $(name_uv)_a1)",
"type": "rgb"
},
{
"rgb": "mix($nm1($uv), $nm2($uv), $(name_uv)_a1)",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
}

View File

@ -0,0 +1,887 @@
{
"connections": [
{
"from": "colorize_3",
"from_port": 0,
"to": "gen_outputs",
"to_port": 6
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "colorize_3",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "gaussian_blur",
"to_port": 0
},
{
"from": "gaussian_blur",
"from_port": 0,
"to": "gen_outputs",
"to_port": 5
},
{
"from": "gen_inputs",
"from_port": 2,
"to": "decompose",
"to_port": 0
},
{
"from": "decompose",
"from_port": 1,
"to": "gen_outputs",
"to_port": 2
},
{
"from": "decompose",
"from_port": 2,
"to": "gen_outputs",
"to_port": 1
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "normal_map",
"to_port": 0
},
{
"from": "blend_2",
"from_port": 0,
"to": "gen_outputs",
"to_port": 4
},
{
"from": "normal_map",
"from_port": 0,
"to": "blend_2",
"to_port": 1
},
{
"from": "gen_inputs",
"from_port": 1,
"to": "gen_outputs",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 3,
"to": "gen_outputs",
"to_port": 3
},
{
"from": "brightness_contrast",
"from_port": 0,
"to": "blend_2",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 4,
"to": "brightness_contrast",
"to_port": 0
}
],
"label": "Map Output",
"name": "mwf_output",
"node_position": {
"x": 0,
"y": 0
},
"nodes": [
{
"connections": [
{
"from": "nm_convolution",
"from_port": 0,
"to": "nm_postprocess",
"to_port": 0
},
{
"from": "nm_postprocess",
"from_port": 0,
"to": "gen_outputs",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "buffer",
"to_port": 0
},
{
"from": "buffer",
"from_port": 0,
"to": "nm_convolution",
"to_port": 0
}
],
"label": "Normal Map",
"name": "normal_map",
"node_position": {
"x": -1164.637451,
"y": 573.842468
},
"nodes": [
{
"name": "buffer",
"node_position": {
"x": -691.663818,
"y": 98.60614
},
"parameters": {
"lod": 0,
"size": 11
},
"type": "buffer"
},
{
"convolution_params": {
"input_type": "f",
"matrix": [
[
[
-1,
-1,
0
],
[
0,
-2,
0
],
[
1,
-1,
0
]
],
[
[
-2,
0,
0
],
0,
[
2,
0,
0
]
],
[
[
-1,
1,
0
],
[
0,
2,
0
],
[
1,
1,
0
]
]
],
"output_type": "rgb",
"x": 1,
"y": 1
},
"name": "nm_convolution",
"node_position": {
"x": -689.25,
"y": 175.25
},
"parameters": {
"size": 11
},
"type": "convolution"
},
{
"name": "nm_postprocess",
"node_position": {
"x": -689.25,
"y": 228.25
},
"parameters": {
"amount": 1,
"format": 0,
"size": 11,
"type": 0
},
"shader_model": {
"code": "",
"global": "vec3 process_normal_default(vec3 v, float multiplier) {\n\treturn 0.5*normalize(v.xyz*multiplier+vec3(0.0, 0.0, -1.0))+vec3(0.5);\n}\n\nvec3 process_normal_opengl(vec3 v, float multiplier) {\n\treturn 0.5*normalize(v.xyz*multiplier+vec3(0.0, 0.0, 1.0))+vec3(0.5);\n}\n\nvec3 process_normal_directx(vec3 v, float multiplier) {\n\treturn 0.5*normalize(v.xyz*vec3(1.0, -1.0, 1.0)*multiplier+vec3(0.0, 0.0, 1.0))+vec3(0.5);\n}\n",
"inputs": [
{
"default": "vec3(0.0)",
"label": "",
"name": "in",
"type": "rgb"
}
],
"instance": "",
"name": "NormalMapPostProcess",
"outputs": [
{
"rgb": "process_normal_$format($in($uv).xyz, $amount*$size/128.0)",
"type": "rgb"
}
],
"parameters": [
{
"default": 0,
"label": "",
"name": "format",
"type": "enum",
"values": [
{
"name": "Default",
"value": "default"
},
{
"name": "OpenGL",
"value": "opengl"
},
{
"name": "DirectX",
"value": "directx"
}
]
},
{
"default": 9,
"first": 4,
"label": "",
"last": 11,
"name": "size",
"type": "size"
},
{
"default": 1,
"label": "",
"max": 2,
"min": 0,
"name": "amount",
"step": 0.005,
"type": "float"
}
]
},
"type": "shader"
},
{
"name": "gen_parameters",
"node_position": {
"x": -696.910156,
"y": -29.916687
},
"parameters": {
"amount": 0.5,
"param0": 11,
"param1": 1,
"param2": 0,
"param3": 1,
"size": 4
},
"type": "remote",
"widgets": [
{
"label": "",
"linked_widgets": [
{
"node": "nm_postprocess",
"widget": "format"
}
],
"name": "param2",
"type": "linked_control"
},
{
"label": "",
"linked_widgets": [
{
"node": "buffer",
"widget": "size"
},
{
"node": "nm_convolution",
"widget": "size"
},
{
"node": "nm_postprocess",
"widget": "size"
}
],
"name": "param0",
"type": "linked_control"
},
{
"label": "",
"linked_widgets": [
{
"node": "nm_postprocess",
"widget": "amount"
}
],
"name": "param1",
"type": "linked_control"
}
]
},
{
"name": "gen_outputs",
"node_position": {
"x": -425.663818,
"y": 163.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_inputs",
"node_position": {
"x": -843.910156,
"y": 178.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
}
],
"parameters": {
"amount": 0.5,
"param0": 11,
"param1": 1,
"param2": 0,
"param3": 1,
"size": 4
},
"type": "graph"
},
{
"name": "colorize_3",
"node_position": {
"x": -939.637451,
"y": 871.842407
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 1,
"g": 1,
"pos": 0,
"r": 1
},
{
"a": 1,
"b": 0,
"g": 0,
"pos": 1,
"r": 0
}
],
"type": "Gradient"
}
},
"type": "colorize"
},
{
"connections": [
{
"from": "buffer",
"from_port": 0,
"to": "blurx_convolution",
"to_port": 0
},
{
"from": "buffer_2",
"from_port": 0,
"to": "blurx_convolution_2",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "buffer",
"to_port": 0
},
{
"from": "blend",
"from_port": 0,
"to": "colorize",
"to_port": 0
},
{
"from": "blurx_convolution",
"from_port": 0,
"to": "buffer_2",
"to_port": 0
},
{
"from": "blurx_convolution_2",
"from_port": 0,
"to": "blend",
"to_port": 1
},
{
"from": "buffer",
"from_port": 0,
"to": "blend",
"to_port": 0
},
{
"from": "colorize",
"from_port": 0,
"to": "_2",
"to_port": 0
},
{
"from": "_2",
"from_port": 0,
"to": "gen_outputs",
"to_port": 0
}
],
"label": "Occlusion",
"name": "gaussian_blur",
"node_position": {
"x": -994.845825,
"y": 786.968262
},
"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": -407.5,
"y": -192.5
},
"parameters": {
"sigma": 50,
"size": 10
},
"type": "convolution"
},
{
"name": "buffer_2",
"node_position": {
"x": -404.875,
"y": -116.625
},
"parameters": {
"lod": 0,
"size": 10
},
"type": "buffer"
},
{
"convolution_params": {
"input_type": "rgba",
"matrix_function": "exp(-0.5*(pow(y/sigma, 2.0)))/(6.28318530718 *sigma*sigma)",
"normalized": true,
"output_type": "rgba",
"parameters": [
{
"max": 50,
"min": 0.05,
"name": "sigma",
"type": "float"
}
],
"x": 0,
"y": 50
},
"name": "blurx_convolution_2",
"node_position": {
"x": -407.125,
"y": -44.375
},
"parameters": {
"sigma": 50,
"size": 10
},
"type": "convolution"
},
{
"name": "buffer",
"node_position": {
"x": -408.25,
"y": -265.75
},
"parameters": {
"lod": 0,
"size": 10
},
"type": "buffer"
},
{
"name": "gen_parameters",
"node_position": {
"x": -447.666626,
"y": -370.666656
},
"parameters": {
"param0": 10,
"param1": 50,
"param2": 1
},
"type": "remote",
"widgets": [
{
"label": "Grid size:",
"linked_widgets": [
{
"node": "buffer",
"widget": "size"
},
{
"node": "blurx_convolution",
"widget": "size"
},
{
"node": "buffer_2",
"widget": "size"
},
{
"node": "blurx_convolution_2",
"widget": "size"
}
],
"name": "param0",
"type": "linked_control"
},
{
"label": "Strength",
"linked_widgets": [
{
"node": "_2",
"widget": "g"
}
],
"name": "param2",
"type": "linked_control"
}
]
},
{
"name": "gen_inputs",
"node_position": {
"x": -585.666626,
"y": -112.392853
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_outputs",
"node_position": {
"x": 55.547607,
"y": -133.392853
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "blend",
"node_position": {
"x": -420.79895,
"y": 27.16272
},
"parameters": {
"amount": 1,
"blend_type": 11
},
"type": "blend"
},
{
"name": "colorize",
"node_position": {
"x": -167.79895,
"y": -178.83728
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 1,
"g": 1,
"pos": 0,
"r": 1
},
{
"a": 1,
"b": 0,
"g": 0,
"pos": 1,
"r": 0
}
],
"type": "Gradient"
}
},
"type": "colorize"
},
{
"name": "_2",
"node_position": {
"x": -134.403687,
"y": -110.29187
},
"parameters": {
"g": 1
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "f"
}
],
"instance": "",
"name": "",
"outputs": [
{
"f": "pow($in($uv), $g)",
"type": "f"
}
],
"parameters": [
{
"default": 1,
"label": "",
"max": 2,
"min": 0,
"name": "g",
"step": 0.1,
"type": "float"
}
]
},
"type": "shader"
}
],
"parameters": {
"param0": 10,
"param1": 50,
"param2": 1
},
"type": "graph"
},
{
"name": "decompose",
"node_position": {
"x": -924.371338,
"y": 570.25
},
"parameters": {
},
"type": "decompose"
},
{
"name": "blend_2",
"node_position": {
"x": -931.305542,
"y": 677.328491
},
"parameters": {
"amount": 1,
"blend_type": 4
},
"type": "blend"
},
{
"name": "gen_inputs",
"node_position": {
"x": -1336.805542,
"y": 597.758606
},
"parameters": {
},
"ports": [
{
"name": "Height",
"type": "f"
},
{
"name": "Albedo",
"type": "rgb"
},
{
"name": "ORM",
"type": "rgb"
},
{
"name": "Emission",
"type": "rgb"
},
{
"name": "Normal",
"type": "rgb"
}
],
"type": "ios"
},
{
"name": "gen_outputs",
"node_position": {
"x": -635.305542,
"y": 597.758606
},
"parameters": {
},
"ports": [
{
"name": "Albedo",
"type": "rgb"
},
{
"name": "Metallic",
"type": "f"
},
{
"name": "Roughness",
"type": "f"
},
{
"name": "Emission",
"type": "rgb"
},
{
"name": "Normal",
"type": "rgb"
},
{
"name": "Occlusion",
"type": "f"
},
{
"name": "Depth",
"type": "f"
}
],
"type": "ios"
},
{
"name": "gen_parameters",
"node_position": {
"x": -1100.881836,
"y": 438.25
},
"parameters": {
"param0": 1,
"param1": 10,
"param2": 1
},
"type": "remote",
"widgets": [
{
"label": "Occlusion",
"linked_widgets": [
{
"node": "gaussian_blur",
"widget": "param2"
}
],
"name": "param2",
"type": "linked_control"
},
{
"label": "Mat Normal",
"linked_widgets": [
{
"node": "blend_2",
"widget": "amount"
}
],
"name": "param0",
"type": "linked_control"
}
]
},
{
"name": "brightness_contrast",
"node_position": {
"x": -1178.223877,
"y": 677.062317
},
"parameters": {
"brightness": 0,
"contrast": 1,
"steps": 6
},
"type": "brightness_contrast"
}
],
"parameters": {
"param0": 1,
"param1": 10,
"param2": 1
},
"type": "graph"
}

View File

@ -0,0 +1,62 @@
{
"name": "sdelongation",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"k": 0.15,
"op": 0,
"r": 0.08,
"w": 0.28,
"x": 0,
"y": 0
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "sdf2d"
}
],
"instance": "",
"name": "sdElongation",
"outputs": [
{
"sdf2d": "$in($uv-clamp($uv-vec2(0.5), -vec2($x, $y), vec2($x, $y)))",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Rect1.x",
"default": 0,
"label": "X",
"max": 1,
"min": 0,
"name": "x",
"step": 0.01,
"type": "float"
},
{
"control": "Rect1.y",
"default": 0,
"label": "Y",
"max": 1,
"min": 0,
"name": "y",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}