mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
Added splatter and 2D fBm
This commit is contained in:
parent
86e5e68039
commit
8d4eb23483
@ -10,7 +10,7 @@
|
||||
"corner": 0,
|
||||
"mortar": 0.1,
|
||||
"pattern": 0,
|
||||
"repeat": 147,
|
||||
"repeat": 2,
|
||||
"round": 0,
|
||||
"row_offset": 0.5,
|
||||
"rows": 6
|
||||
|
@ -5,18 +5,23 @@
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"edge": 0.2,
|
||||
"radius": 1,
|
||||
"shape": 0,
|
||||
"sides": 3
|
||||
"edge": 0.5,
|
||||
"radius": 0.9,
|
||||
"shape": 1,
|
||||
"sides": 6
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float shape_circle(vec2 uv, float sides, float size, float edge) {\n uv = 2.0*uv-1.0;\n\tedge = max(edge, 1.0e-8);\n float distance = length(uv);\n return clamp((1.0-distance/size)/edge, 0.0, 1.0);\n}\n\nfloat shape_polygon(vec2 uv, float sides, float size, float edge) {\n uv = 2.0*uv-1.0;\n\tedge = max(edge, 1.0e-8);\n float angle = atan(uv.x, uv.y)+3.14159265359;\n float slice = 6.28318530718/sides;\n return clamp((size-cos(floor(0.5+angle/slice)*slice-angle)*length(uv))/(edge*size), 0.0, 1.0);\n}\n\nfloat shape_star(vec2 uv, float sides, float size, float edge) {\n uv = 2.0*uv-1.0;\n\tedge = max(edge, 1.0e-8);\n float angle = atan(uv.x, uv.y);\n float slice = 6.28318530718/sides;\n return clamp((size-cos(floor(1.5+angle/slice-2.0*step(0.5*slice, mod(angle, slice)))*slice-angle)*length(uv))/(edge*size), 0.0, 1.0);\n}\n\nfloat shape_curved_star(vec2 uv, float sides, float size, float edge) {\n uv = 2.0*uv-1.0;\n\tedge = max(edge, 1.0e-8);\n float angle = 2.0*(atan(uv.x, uv.y)+3.14159265359);\n float slice = 6.28318530718/sides;\n return clamp((size-cos(floor(0.5+0.5*angle/slice)*2.0*slice-angle)*length(uv))/(edge*size), 0.0, 1.0);\n}\n\nfloat shape_rays(vec2 uv, float sides, float size, float edge) {\n uv = 2.0*uv-1.0;\n\tedge = 0.5*max(edge, 1.0e-8)*size;\n\tfloat slice = 6.28318530718/sides;\n float angle = mod(atan(uv.x, uv.y)+3.14159265359, slice)/slice;\n return clamp(min((size-angle)/edge, angle/edge), 0.0, 1.0);\n}\n\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Shape",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "shape_$(shape)($(uv), $(sides), $(radius), $(edge))"
|
||||
"f": "shape_$(shape)($(uv), $(sides), $(radius), $(edge))",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
@ -49,6 +54,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 3,
|
||||
"label": "",
|
||||
"max": 32,
|
||||
@ -58,23 +64,26 @@
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "radius",
|
||||
"step": 0,
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.2,
|
||||
"label": "",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "edge",
|
||||
"step": 0,
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
87
addons/material_maker/nodes/splatter.mmg
Normal file
87
addons/material_maker/nodes/splatter.mmg
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "splatter",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"count": 25,
|
||||
"rotate": 0,
|
||||
"scale": 0,
|
||||
"select_inputs": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "float splatter_$(name)(vec2 uv, int count, vec2 seed) {\n\tfloat c = 0.0;\n\tfor (int i = 0; i < count; ++i) {\n\t\tseed = rand2(seed);\n\t\tvec2 pv = fract(uv - seed);\n\t\tseed = rand2(seed);\n\t\tpv -= vec2(0.5);\n\t\tfloat angle = (seed.x * 2.0 - 1.0) * $rotate;\n\t\tfloat ca = cos(angle);\n\t\tfloat sa = sin(angle);\n\t\tpv = vec2(ca*pv.x+sa*pv.y, -sa*pv.x+ca*pv.y);\n\t\tpv *= (seed.y-0.5)*2.0*$scale+1.0;\n\t\tpv += vec2(0.5);\n\t\t$select_inputs\n\t\tc = max(c, $in(pv));\n\t}\n\treturn c;\n}",
|
||||
"name": "Splatter",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "splatter_$(name)($uv, int($count), vec2($seed))",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 10,
|
||||
"label": "Count",
|
||||
"max": 100,
|
||||
"min": 1,
|
||||
"name": "count",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Inputs",
|
||||
"name": "select_inputs",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "1",
|
||||
"value": " "
|
||||
},
|
||||
{
|
||||
"name": "4",
|
||||
"value": "pv = clamp(0.5*(pv+floor(rand2(seed)*2.0)), vec2(0.0), vec2(1.0));"
|
||||
},
|
||||
{
|
||||
"name": "16",
|
||||
"value": "pv = clamp(0.25*(pv+floor(rand2(seed)*4.0)), vec2(0.0), vec2(1.0));"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rotate",
|
||||
"max": 180,
|
||||
"min": 0,
|
||||
"name": "rotate",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Scale",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "scale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
87
addons/material_maker/nodes/splatter_color.mmg
Normal file
87
addons/material_maker/nodes/splatter_color.mmg
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "splatter_color",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"count": 25,
|
||||
"rotate": 0,
|
||||
"scale": 0,
|
||||
"select_inputs": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 splatter_$(name)(vec2 uv, int count, vec2 seed) {\n\tvec4 c = vec4(0.0);\n\tfor (int i = 0; i < count; ++i) {\n\t\tseed = rand2(seed);\n\t\tvec2 pv = fract(uv - seed);\n\t\tseed = rand2(seed);\n\t\tpv -= vec2(0.5);\n\t\tfloat angle = (seed.x * 2.0 - 1.0) * $rotate;\n\t\tfloat ca = cos(angle);\n\t\tfloat sa = sin(angle);\n\t\tpv = vec2(ca*pv.x+sa*pv.y, -sa*pv.x+ca*pv.y);\n\t\tpv *= (seed.y-0.5)*2.0*$scale+1.0;\n\t\tpv += vec2(0.5);\n\t\t$select_inputs\n\t\tvec4 n = $in(pv);\n\t\tfloat a = (1.0-c.a)*(1.0*n.a);\n\t\tc = mix(c, n, n.a);\n\t}\n\treturn c;\n}",
|
||||
"name": "Color Splatter",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "splatter_$(name)($uv, int($count), vec2($seed))",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 10,
|
||||
"label": "Count",
|
||||
"max": 100,
|
||||
"min": 1,
|
||||
"name": "count",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Inputs",
|
||||
"name": "select_inputs",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "1",
|
||||
"value": " "
|
||||
},
|
||||
{
|
||||
"name": "4",
|
||||
"value": "pv = clamp(0.5*(pv+floor(rand2(seed)*2.0)), vec2(0.0), vec2(1.0));"
|
||||
},
|
||||
{
|
||||
"name": "16",
|
||||
"value": "pv = clamp(0.25*(pv+floor(rand2(seed)*4.0)), vec2(0.0), vec2(1.0));"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rotate",
|
||||
"max": 180,
|
||||
"min": 0,
|
||||
"name": "rotate",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Scale",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "scale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -2217,6 +2217,20 @@
|
||||
"tree_item": "Noise/Color",
|
||||
"type": "color_noise"
|
||||
},
|
||||
{
|
||||
"collapsed": true,
|
||||
"icon": "noise_fbm",
|
||||
"name": "fbm",
|
||||
"parameters": {
|
||||
"iterations": 5,
|
||||
"noise": 0,
|
||||
"persistence": 0.5,
|
||||
"scale_x": 2,
|
||||
"scale_y": 2
|
||||
},
|
||||
"tree_item": "Noise/FBM",
|
||||
"type": "fbm"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"tree_item": "Filter"
|
||||
@ -2567,6 +2581,32 @@
|
||||
"tree_item": "Transform/CustomUV",
|
||||
"type": "custom_uv"
|
||||
},
|
||||
{
|
||||
"collapsed": true,
|
||||
"icon": "transform_splatter",
|
||||
"name": "splatter",
|
||||
"parameters": {
|
||||
"count": 25,
|
||||
"rotate": 0,
|
||||
"scale": 0,
|
||||
"select_inputs": 0
|
||||
},
|
||||
"tree_item": "Transform/Splatter",
|
||||
"type": "splatter"
|
||||
},
|
||||
{
|
||||
"collapsed": true,
|
||||
"icon": "transform_splatter_color",
|
||||
"name": "splatter_color",
|
||||
"parameters": {
|
||||
"count": 25,
|
||||
"rotate": 0,
|
||||
"scale": 0,
|
||||
"select_inputs": 0
|
||||
},
|
||||
"tree_item": "Transform/Splatter/Color",
|
||||
"type": "splatter_color"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"tree_item": "Workflow"
|
||||
|
BIN
material_maker/library/base/noise_fbm.png
Normal file
BIN
material_maker/library/base/noise_fbm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
material_maker/library/base/transform_splatter.png
Normal file
BIN
material_maker/library/base/transform_splatter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
material_maker/library/base/transform_splatter_color.png
Normal file
BIN
material_maker/library/base/transform_splatter_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in New Issue
Block a user