material-maker/addons/material_maker/nodes/normal_map.mmg
2019-12-30 11:47:54 +01:00

343 lines
5.3 KiB
Plaintext

{
"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": "switch",
"to_port": 1
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "switch",
"to_port": 0
},
{
"from": "switch",
"from_port": 0,
"to": "nm_convolution",
"to_port": 0
}
],
"label": "Normal Map",
"name": "normal_map",
"node_position": {
"x": 0,
"y": 0
},
"nodes": [
{
"name": "buffer",
"node_position": {
"x": -687.663818,
"y": 39.60614
},
"parameters": {
"lod": 0,
"size": 10
},
"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": -695.25,
"y": 175.25
},
"parameters": {
"size": 10
},
"type": "convolution"
},
{
"name": "nm_postprocess",
"node_position": {
"x": -693.25,
"y": 222.25
},
"parameters": {
"amount": 1.02,
"format": 0,
"size": 10,
"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": -718.910156,
"y": -118.916687
},
"parameters": {
"amount": 0.5,
"param0": 10,
"param1": 1.02,
"param2": 0,
"param3": 0,
"param4": 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"
},
{
"configurations": {
"False": [
{
"node": "switch",
"value": 0,
"widget": "source"
}
],
"True": [
{
"node": "switch",
"value": 1,
"widget": "source"
}
]
},
"label": "Buffer",
"linked_widgets": [
{
"node": "switch",
"widget": "source"
}
],
"name": "param4",
"type": "config_control"
}
]
},
{
"name": "gen_outputs",
"node_position": {
"x": -416.663818,
"y": 228.047363
},
"parameters": {
},
"ports": [
{
"name": "Normal",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_inputs",
"node_position": {
"x": -868.910156,
"y": 71.047363
},
"parameters": {
},
"ports": [
{
"name": "Bump",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "switch",
"node_position": {
"x": -673.5,
"y": 113.297363
},
"parameters": {
"choices": 2,
"outputs": 1,
"source": 1
},
"type": "switch"
}
],
"parameters": {
"amount": 0.5,
"param0": 10,
"param1": 1.02,
"param2": 0,
"param3": 0,
"param4": 1,
"size": 4
},
"type": "graph"
}