mirror of
https://github.com/Relintai/mat_maker_gd.git
synced 2025-04-30 10:57:56 +02:00
54 lines
1.2 KiB
Plaintext
54 lines
1.2 KiB
Plaintext
{
|
|
"name": "distance_pass_1",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"parameters": {
|
|
"d": 0.1,
|
|
"s": 9
|
|
},
|
|
"seed_value": 8258,
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "",
|
|
"inputs": [
|
|
{
|
|
"default": "0.0",
|
|
"function": true,
|
|
"label": "",
|
|
"name": "in",
|
|
"type": "f"
|
|
}
|
|
],
|
|
"instance": "vec3 $(name)_distance_h(vec2 uv) {\n\tvec2 e = vec2(1.0/$s, 0.0);\n\tint steps = int($s*$d);\n\tfloat rv = 0.0;\n\tvec2 source_uv;\n\tfor (int i = 0; i < steps; ++i) {\n\t\tsource_uv = uv+float(i)*e;\n\t\tif ($in(source_uv) > 0.5) {\n\t\t\trv = 1.0-float(i)*e.x/$d;\n\t\t\tbreak;\n\t\t}\n\t\tsource_uv = uv-float(i)*e;\n\t\tif ($in(source_uv) > 0.5) {\n\t\t\trv = 1.0-float(i)*e.x/$d;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn vec3(rv, source_uv);\n}\n",
|
|
"name": "Distance pass 1",
|
|
"outputs": [
|
|
{
|
|
"rgb": "$(name)_distance_h($uv)",
|
|
"type": "rgb"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 9,
|
|
"first": 6,
|
|
"label": "",
|
|
"last": 12,
|
|
"name": "s",
|
|
"type": "size"
|
|
},
|
|
{
|
|
"control": "None",
|
|
"default": 0.5,
|
|
"label": "",
|
|
"max": 1,
|
|
"min": 0,
|
|
"name": "d",
|
|
"step": 0.01,
|
|
"type": "float"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
} |