Updated noise node and added color_noise

This commit is contained in:
Rodolphe Suescun 2019-11-02 22:56:14 +01:00
parent 2c606a2b1e
commit 3bd0cf228a
2 changed files with 47 additions and 4 deletions

View File

@ -0,0 +1,37 @@
{
"name": "color_noise",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"density": 0.5,
"size": 9
},
"shader_model": {
"code": "",
"global": "vec3 color_dots(vec2 uv, float size, int seed) {\n\tvec2 seed2 = rand2(vec2(float(seed), 1.0-float(seed)));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\treturn rand3(seed2+point_pos);\n}",
"inputs": [
],
"instance": "",
"name": "Color Noise",
"outputs": [
{
"rgb": "color_dots($(uv), 1.0/$(size), $(seed))",
"type": "rgb"
}
],
"parameters": [
{
"default": 8,
"first": 2,
"label": "Grid Size:",
"last": 12,
"name": "size",
"type": "size"
}
]
},
"type": "shader"
}

View File

@ -6,15 +6,20 @@
}, },
"parameters": { "parameters": {
"density": 0.5, "density": 0.5,
"size": 8 "size": 9
}, },
"shader_model": { "shader_model": {
"code": "",
"global": "float dots(vec2 uv, float size, float density, int seed) {\n\tvec2 seed2 = rand2(vec2(float(seed), 1.0-float(seed)));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\tfloat color = step(rand(seed2+point_pos), density);\n return color;\n}", "global": "float dots(vec2 uv, float size, float density, int seed) {\n\tvec2 seed2 = rand2(vec2(float(seed), 1.0-float(seed)));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\tfloat color = step(rand(seed2+point_pos), density);\n return color;\n}",
"inputs": [
],
"instance": "\n\t\tfloat $(name)_f(vec2 uv) {\n\t\t\treturn dots(uv, 1.0/$(size), $(density), $(seed));\n\t\t}", "instance": "\n\t\tfloat $(name)_f(vec2 uv) {\n\t\t\treturn dots(uv, 1.0/$(size), $(density), $(seed));\n\t\t}",
"name": "Noise", "name": "Noise",
"outputs": [ "outputs": [
{ {
"f": "$(name)_f($(uv))" "f": "$(name)_f($(uv))",
"type": "f"
} }
], ],
"parameters": [ "parameters": [
@ -22,7 +27,7 @@
"default": 8, "default": 8,
"first": 2, "first": 2,
"label": "Grid Size:", "label": "Grid Size:",
"last": 8, "last": 12,
"name": "size", "name": "size",
"type": "size" "type": "size"
}, },
@ -36,5 +41,6 @@
"type": "float" "type": "float"
} }
] ]
} },
"type": "shader"
} }