mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
148 lines
3.0 KiB
Plaintext
148 lines
3.0 KiB
Plaintext
{
|
|
"name": "pattern",
|
|
"node_position": {
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"parameters": {
|
|
"mix": 0,
|
|
"x_scale": 4,
|
|
"x_wave": 0,
|
|
"y_scale": 4,
|
|
"y_wave": 0
|
|
},
|
|
"shader_model": {
|
|
"code": "",
|
|
"global": "float wave_constant(float x) {\n\treturn 1.0;\n}\n\nfloat wave_sine(float x) {\n\treturn 0.5-0.5*cos(3.14159265359*2.0*x);\n}\n\nfloat wave_triangle(float x) {\n\tx = fract(x);\n\treturn min(2.0*x, 2.0-2.0*x);\n}\n\nfloat wave_sawtooth(float x) {\n\treturn fract(x);\n}\n\nfloat wave_square(float x) {\n\treturn (fract(x) < 0.5) ? 0.0 : 1.0;\n}\n\nfloat wave_bounce(float x) {\n\tx = 2.0*(fract(x)-0.5);\n\treturn sqrt(1.0-x*x);\n}\n\nfloat mix_mul(float x, float y) {\n\treturn x*y;\n}\n\nfloat mix_add(float x, float y) {\n\treturn min(x+y, 1.0);\n}\n\nfloat mix_max(float x, float y) {\n\treturn max(x, y);\n}\n\nfloat mix_min(float x, float y) {\n\treturn min(x, y);\n}\n\nfloat mix_xor(float x, float y) {\n\treturn min(x+y, 2.0-x-y);\n}\n\nfloat mix_pow(float x, float y) {\n\treturn pow(x, y);\n}",
|
|
"inputs": [
|
|
|
|
],
|
|
"instance": "float $(name)_fct(vec2 uv) {\n\treturn mix_$(mix)(wave_$(x_wave)($(x_scale)*uv.x), wave_$(y_wave)($(y_scale)*uv.y));\n}",
|
|
"name": "Pattern",
|
|
"outputs": [
|
|
{
|
|
"f": "$(name)_fct($(uv))",
|
|
"type": "f"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"default": 0,
|
|
"label": "Combiner",
|
|
"name": "mix",
|
|
"type": "enum",
|
|
"values": [
|
|
{
|
|
"name": "Multiply",
|
|
"value": "mul"
|
|
},
|
|
{
|
|
"name": "Add",
|
|
"value": "add"
|
|
},
|
|
{
|
|
"name": "Max",
|
|
"value": "max"
|
|
},
|
|
{
|
|
"name": "Min",
|
|
"value": "min"
|
|
},
|
|
{
|
|
"name": "Xor",
|
|
"value": "xor"
|
|
},
|
|
{
|
|
"name": "Pow",
|
|
"value": "pow"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"default": 5,
|
|
"label": "X",
|
|
"name": "x_wave",
|
|
"type": "enum",
|
|
"values": [
|
|
{
|
|
"name": "Sine",
|
|
"value": "sine"
|
|
},
|
|
{
|
|
"name": "Triangle",
|
|
"value": "triangle"
|
|
},
|
|
{
|
|
"name": "Square",
|
|
"value": "square"
|
|
},
|
|
{
|
|
"name": "Sawtooth",
|
|
"value": "sawtooth"
|
|
},
|
|
{
|
|
"name": "Constant",
|
|
"value": "constant"
|
|
},
|
|
{
|
|
"name": "Bounce",
|
|
"value": "bounce"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"default": 4,
|
|
"label": "2:",
|
|
"max": 32,
|
|
"min": 0,
|
|
"name": "x_scale",
|
|
"step": 1,
|
|
"type": "float",
|
|
"widget": "spinbox"
|
|
},
|
|
{
|
|
"default": 5,
|
|
"label": "Y",
|
|
"name": "y_wave",
|
|
"type": "enum",
|
|
"values": [
|
|
{
|
|
"name": "Sine",
|
|
"value": "sine"
|
|
},
|
|
{
|
|
"name": "Triangle",
|
|
"value": "triangle"
|
|
},
|
|
{
|
|
"name": "Square",
|
|
"value": "square"
|
|
},
|
|
{
|
|
"name": "Sawtooth",
|
|
"value": "sawtooth"
|
|
},
|
|
{
|
|
"name": "Constant",
|
|
"value": "constant"
|
|
},
|
|
{
|
|
"name": "Bounce",
|
|
"value": "bounce"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"default": 4,
|
|
"label": "3:",
|
|
"max": 32,
|
|
"min": 0,
|
|
"name": "y_scale",
|
|
"step": 1,
|
|
"type": "float",
|
|
"widget": "spinbox"
|
|
}
|
|
]
|
|
},
|
|
"type": "shader"
|
|
} |