mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-15 02:01:09 +01:00
Turn more .mmg files into comments.
This commit is contained in:
parent
ea795998cf
commit
c54948d81a
@ -267,6 +267,13 @@ static func ThickLine(uv : Vector2, posA : Vector2, posB : Vector2, radiusInv :
|
|||||||
|
|
||||||
return finalGray;
|
return finalGray;
|
||||||
|
|
||||||
|
#vec3 color_dots(vec2 uv, float size, float seed) {
|
||||||
|
# vec2 seed2 = rand2(vec2(seed, 1.0-seed));
|
||||||
|
# uv /= size;
|
||||||
|
# vec2 point_pos = floor(uv)+vec2(0.5);
|
||||||
|
# return rand3(seed2+point_pos);
|
||||||
|
#}
|
||||||
|
|
||||||
static func color_dots(uv : Vector2, size : float, pseed : int) -> Vector3:
|
static func color_dots(uv : Vector2, size : float, pseed : int) -> Vector3:
|
||||||
var seed2 : Vector2 = rand2(Vector2(float(pseed), 1.0 - float(pseed)));
|
var seed2 : Vector2 = rand2(Vector2(float(pseed), 1.0 - float(pseed)));
|
||||||
uv /= size;
|
uv /= size;
|
||||||
|
@ -3,6 +3,58 @@ extends Reference
|
|||||||
|
|
||||||
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||||
|
|
||||||
|
#----------------------
|
||||||
|
#perlin.mmg
|
||||||
|
|
||||||
|
#Outputs:
|
||||||
|
|
||||||
|
#Output - (float) - Shows a greyscale value noise
|
||||||
|
#perlin($(uv), vec2($(scale_x), $(scale_y)), int($(iterations)), $(persistence), $(seed))
|
||||||
|
|
||||||
|
#Inputs:
|
||||||
|
#scale, vector2, default: 4, min: 1, max: 32, step: 1
|
||||||
|
#iterations, float, min: 0, max: 10, default: 3, step:1
|
||||||
|
#persistence, float, min: 0, max: 1, default: 0.5, step:0.05
|
||||||
|
|
||||||
|
#----------------------
|
||||||
|
#perlin_color.mmg
|
||||||
|
|
||||||
|
#Outputs:
|
||||||
|
|
||||||
|
#Output - (rgb) - Shows a color value noise
|
||||||
|
#perlin_color($(uv), vec2($(scale_x), $(scale_y)), int($(iterations)), $(persistence), $(seed))
|
||||||
|
|
||||||
|
#Inputs:
|
||||||
|
#scale, vector2, default: 4, min: 1, max: 32, step: 1
|
||||||
|
#iterations, float, min: 0, max: 10, default: 3, step:1
|
||||||
|
#persistence, float, min: 0, max: 1, default: 0.5, step:0.05
|
||||||
|
|
||||||
|
|
||||||
|
#float perlin(vec2 uv, vec2 size, int iterations, float persistence, float seed) {
|
||||||
|
# vec2 seed2 = rand2(vec2(seed, 1.0-seed));
|
||||||
|
# float rv = 0.0;
|
||||||
|
# float coef = 1.0;
|
||||||
|
# float acc = 0.0;
|
||||||
|
#
|
||||||
|
# for (int i = 0; i < iterations; ++i) {
|
||||||
|
# vec2 step = vec2(1.0)/size;
|
||||||
|
# vec2 xy = floor(uv*size);
|
||||||
|
#
|
||||||
|
# float f0 = rand(seed2+mod(xy, size));
|
||||||
|
# float f1 = rand(seed2+mod(xy+vec2(1.0, 0.0), size));
|
||||||
|
# float f2 = rand(seed2+mod(xy+vec2(0.0, 1.0), size));
|
||||||
|
# float f3 = rand(seed2+mod(xy+vec2(1.0, 1.0), size));
|
||||||
|
#
|
||||||
|
# vec2 mixval = smoothstep(0.0, 1.0, fract(uv*size));
|
||||||
|
# rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y);
|
||||||
|
# acc += coef;
|
||||||
|
# size *= 2.0;
|
||||||
|
# coef *= persistence;
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# return rv / acc;
|
||||||
|
#}
|
||||||
|
|
||||||
static func perlin(uv : Vector2, size : Vector2, iterations : int, persistence : float, pseed : int) -> float:
|
static func perlin(uv : Vector2, size : Vector2, iterations : int, persistence : float, pseed : int) -> float:
|
||||||
var seed2 : Vector2 = Commons.rand2(Vector2(float(pseed), 1.0-float(pseed)));
|
var seed2 : Vector2 = Commons.rand2(Vector2(float(pseed), 1.0-float(pseed)));
|
||||||
var rv : float = 0.0;
|
var rv : float = 0.0;
|
||||||
@ -26,6 +78,30 @@ static func perlin(uv : Vector2, size : Vector2, iterations : int, persistence :
|
|||||||
|
|
||||||
return rv / acc;
|
return rv / acc;
|
||||||
|
|
||||||
|
#vec3 perlin_color(vec2 uv, vec2 size, int iterations, float persistence, float seed) {
|
||||||
|
# vec2 seed2 = rand2(vec2(seed, 1.0-seed));
|
||||||
|
# vec3 rv = vec3(0.0);
|
||||||
|
# float coef = 1.0;
|
||||||
|
# float acc = 0.0;
|
||||||
|
#
|
||||||
|
# for (int i = 0; i < iterations; ++i) {
|
||||||
|
# vec2 step = vec2(1.0)/size;
|
||||||
|
# vec2 xy = floor(uv*size);
|
||||||
|
# vec3 f0 = rand3(seed2+mod(xy, size));
|
||||||
|
# vec3 f1 = rand3(seed2+mod(xy+vec2(1.0, 0.0), size));
|
||||||
|
# vec3 f2 = rand3(seed2+mod(xy+vec2(0.0, 1.0), size));
|
||||||
|
# vec3 f3 = rand3(seed2+mod(xy+vec2(1.0, 1.0), size));
|
||||||
|
# vec2 mixval = smoothstep(0.0, 1.0, fract(uv*size));
|
||||||
|
#
|
||||||
|
# rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y);
|
||||||
|
# acc += coef;
|
||||||
|
# size *= 2.0;
|
||||||
|
# coef *= persistence;
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# return rv / acc;
|
||||||
|
#}
|
||||||
|
|
||||||
static func perlinc(uv : Vector2, size : Vector2, iterations : int, persistence : float, pseed : int) -> Color:
|
static func perlinc(uv : Vector2, size : Vector2, iterations : int, persistence : float, pseed : int) -> Color:
|
||||||
var f : float = perlin(uv, size, iterations, persistence, pseed)
|
var f : float = perlin(uv, size, iterations, persistence, pseed)
|
||||||
|
|
||||||
|
@ -8,6 +8,24 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
|||||||
#voronoi_1, 2, 3, 4 -> different outputs
|
#voronoi_1, 2, 3, 4 -> different outputs
|
||||||
#TODO make a set which takes color as input so all 4 variants can be calculated easily
|
#TODO make a set which takes color as input so all 4 variants can be calculated easily
|
||||||
|
|
||||||
|
#Outputs:
|
||||||
|
|
||||||
|
#vec4 $(name_uv)_xyzw = voronoi($uv, vec2($scale_x, $scale_y), vec2($stretch_y, $stretch_x), $intensity, $randomness, $seed);
|
||||||
|
|
||||||
|
#Nodes - float - A greyscale pattern based on the distance to cell centers
|
||||||
|
#$(name_uv)_xyzw.z
|
||||||
|
|
||||||
|
#Borders - float - A greyscale pattern based on the distance to borders
|
||||||
|
#$(name_uv)_xyzw.w
|
||||||
|
|
||||||
|
#Random color - rgb - A color pattern that assigns a random color to each cell
|
||||||
|
#rand3(fract(floor($(name_uv)_xyzw.xy)/vec2($scale_x, $scale_y)))
|
||||||
|
|
||||||
|
#Fill - rgba - An output that should be plugged into a Fill companion node
|
||||||
|
#vec4(fract(($(name_uv)_xyzw.xy-1.0)/vec2($scale_x, $scale_y)), vec2(2.0)/vec2($scale_x, $scale_y))
|
||||||
|
|
||||||
|
#Inputs:
|
||||||
|
|
||||||
#scale, min: 1, max: 32, step: 1, default: 4
|
#scale, min: 1, max: 32, step: 1, default: 4
|
||||||
#stretch, min: 0.01, max: 1, step: 0.01, default: 1
|
#stretch, min: 0.01, max: 1, step: 0.01, default: 1
|
||||||
#intensity, min: 0, max: 1, step: 0.01, default: 0.75
|
#intensity, min: 0, max: 1, step: 0.01, default: 0.75
|
||||||
|
44
game/addons/mat_maker_gd/nodes/common/noises.gd
Normal file
44
game/addons/mat_maker_gd/nodes/common/noises.gd
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
tool
|
||||||
|
extends Reference
|
||||||
|
|
||||||
|
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||||
|
|
||||||
|
#----------------------
|
||||||
|
#color_noise.mmg
|
||||||
|
|
||||||
|
#Outputs:
|
||||||
|
|
||||||
|
#Output - (rgb) - Shows the noise pattern
|
||||||
|
#color_dots($(uv), 1.0/$(size), $(seed))
|
||||||
|
|
||||||
|
#Inputs:
|
||||||
|
#size, float, default: 8, min: 2, max: 12, step: 1
|
||||||
|
|
||||||
|
#----------------------
|
||||||
|
#noise.mmg
|
||||||
|
|
||||||
|
#Outputs:
|
||||||
|
|
||||||
|
#float $(name)_f(vec2 uv) {
|
||||||
|
# return dots(uv, 1.0/$(size), $(density), $(seed));
|
||||||
|
#}
|
||||||
|
|
||||||
|
#Output - (float) - Shows the noise pattern
|
||||||
|
#$(name)_f($(uv))
|
||||||
|
|
||||||
|
#Inputs:
|
||||||
|
#grid_size, float, default: 4, min: 2, max: 12, step: 1
|
||||||
|
#density, float, default: 0.5, min: 0, max: 1, step: 0.01
|
||||||
|
|
||||||
|
|
||||||
|
#float dots(vec2 uv, float size, float density, float seed) {
|
||||||
|
# vec2 seed2 = rand2(vec2(seed, 1.0-seed));
|
||||||
|
# uv /= size;
|
||||||
|
# vec2 point_pos = floor(uv)+vec2(0.5);
|
||||||
|
# float color = step(rand(seed2+point_pos), density);
|
||||||
|
# return color;
|
||||||
|
#}
|
||||||
|
|
||||||
|
static func dots(uv : Vector2, size : float, density : float, pseed : float) -> float:
|
||||||
|
return 0.0
|
||||||
|
|
@ -165,7 +165,7 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
|||||||
#width, float, min: 0, max: 1, default: 0.8, step:0.05 (universal input)
|
#width, float, min: 0, max: 1, default: 0.8, step:0.05 (universal input)
|
||||||
|
|
||||||
#----------------------
|
#----------------------
|
||||||
#weave.mmg
|
#weave2.mmg
|
||||||
|
|
||||||
#code
|
#code
|
||||||
#vec3 $(name_uv) = weave2($uv, vec2($columns, $rows), $stitch, $width_x*$width_map($uv), $width_y*$width_map($uv));
|
#vec3 $(name_uv) = weave2($uv, vec2($columns, $rows), $stitch, $width_x*$width_map($uv), $width_y*$width_map($uv));
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "color_noise",
|
|
||||||
"node_position": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"parameters": {
|
|
||||||
"size": 9
|
|
||||||
},
|
|
||||||
"shader_model": {
|
|
||||||
"code": "",
|
|
||||||
"global": "vec3 color_dots(vec2 uv, float size, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\treturn rand3(seed2+point_pos);\n}",
|
|
||||||
"inputs": [
|
|
||||||
|
|
||||||
],
|
|
||||||
"instance": "",
|
|
||||||
"longdesc": "Generates a grid made of random color squares",
|
|
||||||
"name": "Color Noise",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"longdesc": "Shows the noise pattern",
|
|
||||||
"rgb": "color_dots($(uv), 1.0/$(size), $(seed))",
|
|
||||||
"shortdesc": "Output",
|
|
||||||
"type": "rgb"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"default": 8,
|
|
||||||
"first": 2,
|
|
||||||
"label": "Grid Size:",
|
|
||||||
"last": 12,
|
|
||||||
"longdesc": "The grid size",
|
|
||||||
"name": "size",
|
|
||||||
"shortdesc": "Size",
|
|
||||||
"type": "size"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"shortdesc": "Color Noise"
|
|
||||||
},
|
|
||||||
"type": "shader"
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "noise",
|
|
||||||
"node_position": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"parameters": {
|
|
||||||
"density": 0.5,
|
|
||||||
"size": 4
|
|
||||||
},
|
|
||||||
"shader_model": {
|
|
||||||
"code": "",
|
|
||||||
"global": "float dots(vec2 uv, float size, float density, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-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}",
|
|
||||||
"longdesc": "Generates a grid made of black and white squares",
|
|
||||||
"name": "Noise",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"f": "$(name)_f($(uv))",
|
|
||||||
"longdesc": "Shows the noise pattern",
|
|
||||||
"shortdesc": "Output",
|
|
||||||
"type": "f"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"default": 8,
|
|
||||||
"first": 2,
|
|
||||||
"label": "Grid Size:",
|
|
||||||
"last": 12,
|
|
||||||
"longdesc": "The grid size",
|
|
||||||
"name": "size",
|
|
||||||
"shortdesc": "Size",
|
|
||||||
"type": "size"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 0.5,
|
|
||||||
"label": "Density:",
|
|
||||||
"longdesc": "The density of white squares",
|
|
||||||
"max": 1,
|
|
||||||
"min": 0,
|
|
||||||
"name": "density",
|
|
||||||
"shortdesc": "Density",
|
|
||||||
"step": 0.01,
|
|
||||||
"type": "float"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"shortdesc": "Noise pattern"
|
|
||||||
},
|
|
||||||
"type": "shader"
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "noise_color",
|
|
||||||
"node_position": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"parameters": {
|
|
||||||
"size": 9
|
|
||||||
},
|
|
||||||
"shader_model": {
|
|
||||||
"code": "",
|
|
||||||
"global": "vec3 color_dots(vec2 uv, float size, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\treturn rand3(seed2+point_pos);\n}",
|
|
||||||
"inputs": [
|
|
||||||
|
|
||||||
],
|
|
||||||
"instance": "",
|
|
||||||
"longdesc": "Generates a grid made of random color squares",
|
|
||||||
"name": "Color Noise",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"longdesc": "Shows the noise pattern",
|
|
||||||
"rgb": "color_dots($(uv), 1.0/$(size), $(seed))",
|
|
||||||
"shortdesc": "Output",
|
|
||||||
"type": "rgb"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"default": 8,
|
|
||||||
"first": 2,
|
|
||||||
"label": "Grid Size:",
|
|
||||||
"last": 12,
|
|
||||||
"longdesc": "The grid size",
|
|
||||||
"name": "size",
|
|
||||||
"shortdesc": "Size",
|
|
||||||
"type": "size"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"shortdesc": "Color Noise"
|
|
||||||
},
|
|
||||||
"type": "shader"
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "perlin",
|
|
||||||
"node_position": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"parameters": {
|
|
||||||
"iterations": 3,
|
|
||||||
"persistence": 0.5,
|
|
||||||
"scale_x": 4,
|
|
||||||
"scale_y": 4
|
|
||||||
},
|
|
||||||
"shader_model": {
|
|
||||||
"code": "",
|
|
||||||
"global": "float perlin(vec2 uv, vec2 size, int iterations, float persistence, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n float rv = 0.0;\n float coef = 1.0;\n float acc = 0.0;\n for (int i = 0; i < iterations; ++i) {\n \tvec2 step = vec2(1.0)/size;\n\t\tvec2 xy = floor(uv*size);\n float f0 = rand(seed2+mod(xy, size));\n float f1 = rand(seed2+mod(xy+vec2(1.0, 0.0), size));\n float f2 = rand(seed2+mod(xy+vec2(0.0, 1.0), size));\n float f3 = rand(seed2+mod(xy+vec2(1.0, 1.0), size));\n vec2 mixval = smoothstep(0.0, 1.0, fract(uv*size));\n rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y);\n acc += coef;\n size *= 2.0;\n coef *= persistence;\n }\n \n return rv / acc;\n}\n",
|
|
||||||
"inputs": [
|
|
||||||
|
|
||||||
],
|
|
||||||
"instance": "",
|
|
||||||
"longdesc": "Generates several octaves of greyscale value noise",
|
|
||||||
"name": "Value Noise",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"f": "perlin($(uv), vec2($(scale_x), $(scale_y)), int($(iterations)), $(persistence), $(seed))",
|
|
||||||
"longdesc": "Shows a greyscale value noise",
|
|
||||||
"shortdesc": "Output",
|
|
||||||
"type": "f"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 4,
|
|
||||||
"label": "Scale X",
|
|
||||||
"longdesc": "The scale along the X axis",
|
|
||||||
"max": 32,
|
|
||||||
"min": 1,
|
|
||||||
"name": "scale_x",
|
|
||||||
"shortdesc": "Scale.x",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 4,
|
|
||||||
"label": "Scale Y",
|
|
||||||
"longdesc": "The scale along the Y axis",
|
|
||||||
"max": 32,
|
|
||||||
"min": 1,
|
|
||||||
"name": "scale_y",
|
|
||||||
"shortdesc": "Scale.y",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 3,
|
|
||||||
"label": "Iterations",
|
|
||||||
"longdesc": "The number of octaves (higher values might affect performance)",
|
|
||||||
"max": 10,
|
|
||||||
"min": 1,
|
|
||||||
"name": "iterations",
|
|
||||||
"shortdesc": "Octaves",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 0.5,
|
|
||||||
"label": "Persistence",
|
|
||||||
"longdesc": "The persistence between two consecutive octaves",
|
|
||||||
"max": 1,
|
|
||||||
"min": 0,
|
|
||||||
"name": "persistence",
|
|
||||||
"shortdesc": "Persistence",
|
|
||||||
"step": 0.05,
|
|
||||||
"type": "float"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"shortdesc": "Value Noise"
|
|
||||||
},
|
|
||||||
"type": "shader"
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "perlin_color",
|
|
||||||
"node_position": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"parameters": {
|
|
||||||
"iterations": 3,
|
|
||||||
"persistence": 0.5,
|
|
||||||
"scale_x": 4,
|
|
||||||
"scale_y": 4
|
|
||||||
},
|
|
||||||
"shader_model": {
|
|
||||||
"code": "",
|
|
||||||
"global": "vec3 perlin_color(vec2 uv, vec2 size, int iterations, float persistence, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n vec3 rv = vec3(0.0);\n float coef = 1.0;\n float acc = 0.0;\n for (int i = 0; i < iterations; ++i) {\n \tvec2 step = vec2(1.0)/size;\n\t\tvec2 xy = floor(uv*size);\n vec3 f0 = rand3(seed2+mod(xy, size));\n vec3 f1 = rand3(seed2+mod(xy+vec2(1.0, 0.0), size));\n vec3 f2 = rand3(seed2+mod(xy+vec2(0.0, 1.0), size));\n vec3 f3 = rand3(seed2+mod(xy+vec2(1.0, 1.0), size));\n vec2 mixval = smoothstep(0.0, 1.0, fract(uv*size));\n rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y);\n acc += coef;\n size *= 2.0;\n coef *= persistence;\n }\n \n return rv / acc;\n}\n",
|
|
||||||
"inputs": [
|
|
||||||
|
|
||||||
],
|
|
||||||
"instance": "",
|
|
||||||
"longdesc": "Generates several octaves of color value noise",
|
|
||||||
"name": "Color Value Noise",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"longdesc": "Shows a color value noise",
|
|
||||||
"rgb": "perlin_color($(uv), vec2($(scale_x), $(scale_y)), int($(iterations)), $(persistence), $(seed))",
|
|
||||||
"shortdesc": "Output",
|
|
||||||
"type": "rgb"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 4,
|
|
||||||
"label": "Scale X",
|
|
||||||
"longdesc": "The scale along the X axis",
|
|
||||||
"max": 32,
|
|
||||||
"min": 1,
|
|
||||||
"name": "scale_x",
|
|
||||||
"shortdesc": "Scale.x",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 4,
|
|
||||||
"label": "Scale Y",
|
|
||||||
"longdesc": "The scale along the Y axis",
|
|
||||||
"max": 32,
|
|
||||||
"min": 1,
|
|
||||||
"name": "scale_y",
|
|
||||||
"shortdesc": "Scale.y",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 3,
|
|
||||||
"label": "Iterations",
|
|
||||||
"longdesc": "The number of octaves (higher values might affect performance)",
|
|
||||||
"max": 10,
|
|
||||||
"min": 1,
|
|
||||||
"name": "iterations",
|
|
||||||
"shortdesc": "Octaves",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 0.5,
|
|
||||||
"label": "Persistence",
|
|
||||||
"longdesc": "The persistence between two consecutive octaves",
|
|
||||||
"max": 1,
|
|
||||||
"min": 0,
|
|
||||||
"name": "persistence",
|
|
||||||
"shortdesc": "Persistence",
|
|
||||||
"step": 0.05,
|
|
||||||
"type": "float"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"shortdesc": "Color Value Noise"
|
|
||||||
},
|
|
||||||
"type": "shader"
|
|
||||||
}
|
|
@ -1,127 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "voronoi",
|
|
||||||
"node_position": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"parameters": {
|
|
||||||
"intensity": 1,
|
|
||||||
"randomness": 0.85,
|
|
||||||
"scale_x": 4,
|
|
||||||
"scale_y": 5,
|
|
||||||
"stretch_x": 1,
|
|
||||||
"stretch_y": 1
|
|
||||||
},
|
|
||||||
"shader_model": {
|
|
||||||
"code": "vec4 $(name_uv)_xyzw = voronoi($uv, vec2($scale_x, $scale_y), vec2($stretch_y, $stretch_x), $intensity, $randomness, $seed);",
|
|
||||||
"global": "// Based on https://www.shadertoy.com/view/ldl3W8\n// The MIT License\n// Copyright © 2013 Inigo Quilez\nvec3 iq_voronoi(vec2 x, vec2 size, vec2 stretch, float randomness, vec2 seed) {\n vec2 n = floor(x);\n vec2 f = fract(x);\n\n\tvec2 mg, mr, mc;\n float md = 8.0;\n for (int j=-1; j<=1; j++)\n for (int i=-1; i<=1; i++) {\n vec2 g = vec2(float(i),float(j));\n\t\tvec2 o = randomness*rand2(seed + mod(n + g + size, size));\n\t\tvec2 c = g + o;\n vec2 r = c - f;\n\t\tvec2 rr = r*stretch;\n float d = dot(rr,rr);\n\n if (d<md) {\n\t\t\tmc = c;\n md = d;\n mr = r;\n mg = g;\n }\n }\n\n md = 8.0;\n for (int j=-2; j<=2; j++)\n for (int i=-2; i<=2; i++) {\n vec2 g = mg + vec2(float(i),float(j));\n\t\tvec2 o = randomness*rand2(seed + mod(n + g + size, size));\n vec2 r = g + o - f;\n\t\tvec2 rr = (mr-r)*stretch;\n if (dot(rr,rr)>0.00001)\n \t\tmd = min(md, dot(0.5*(mr+r)*stretch, normalize((r-mr)*stretch)));\n }\n\n return vec3(md, mc+n);\n}\n\nvec4 voronoi(vec2 uv, vec2 size, vec2 stretch, float intensity, float randomness, float seed) {\n uv *= size;\n\tvec3 v = iq_voronoi(uv, size, stretch, randomness, rand2(vec2(seed, 1.0-seed)));\n\treturn vec4(v.yz, intensity*length((uv-v.yz)*stretch), v.x);\n}\n",
|
|
||||||
"inputs": [
|
|
||||||
|
|
||||||
],
|
|
||||||
"instance": "",
|
|
||||||
"longdesc": "Generates several images from a tileable voronoi noise",
|
|
||||||
"name": "Voronoi",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"f": "$(name_uv)_xyzw.z",
|
|
||||||
"longdesc": "A greyscale pattern based on the distance to cell centers",
|
|
||||||
"shortdesc": "Nodes",
|
|
||||||
"type": "f"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"f": "$(name_uv)_xyzw.w",
|
|
||||||
"longdesc": "A greyscale pattern based on the distance to borders",
|
|
||||||
"shortdesc": "Borders",
|
|
||||||
"type": "f"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"longdesc": "A color pattern that assigns a random color to each cell",
|
|
||||||
"rgb": "rand3(fract(floor($(name_uv)_xyzw.xy)/vec2($scale_x, $scale_y)))",
|
|
||||||
"shortdesc": "Random color",
|
|
||||||
"type": "rgb"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"longdesc": "An output that should be plugged into a Fill companion node",
|
|
||||||
"rgba": "vec4(fract(($(name_uv)_xyzw.xy-1.0)/vec2($scale_x, $scale_y)), vec2(2.0)/vec2($scale_x, $scale_y))",
|
|
||||||
"shortdesc": "Fill",
|
|
||||||
"type": "rgba"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 4,
|
|
||||||
"label": "Scale X",
|
|
||||||
"longdesc": "The scale along the X axis",
|
|
||||||
"max": 32,
|
|
||||||
"min": 1,
|
|
||||||
"name": "scale_x",
|
|
||||||
"shortdesc": "Scale.x",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 4,
|
|
||||||
"label": "Scale Y",
|
|
||||||
"longdesc": "The scale along the Y axis",
|
|
||||||
"max": 32,
|
|
||||||
"min": 1,
|
|
||||||
"name": "scale_y",
|
|
||||||
"shortdesc": "Scale.y",
|
|
||||||
"step": 1,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 1,
|
|
||||||
"label": "Stretch X",
|
|
||||||
"longdesc": "The stretch factor along the X axis",
|
|
||||||
"max": 1,
|
|
||||||
"min": 0.01,
|
|
||||||
"name": "stretch_x",
|
|
||||||
"shortdesc": "Stretch.x",
|
|
||||||
"step": 0.01,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 1,
|
|
||||||
"label": "Stretch Y",
|
|
||||||
"longdesc": "The stretch factor along the Y axis",
|
|
||||||
"max": 1,
|
|
||||||
"min": 0.01,
|
|
||||||
"name": "stretch_y",
|
|
||||||
"shortdesc": "Stretch.y",
|
|
||||||
"step": 0.01,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 0.75,
|
|
||||||
"label": "Intensity",
|
|
||||||
"longdesc": "A value factor for greyscale outputs",
|
|
||||||
"max": 1,
|
|
||||||
"min": 0,
|
|
||||||
"name": "intensity",
|
|
||||||
"shortdesc": "Intensity",
|
|
||||||
"step": 0.01,
|
|
||||||
"type": "float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"control": "None",
|
|
||||||
"default": 1,
|
|
||||||
"label": "Randomness",
|
|
||||||
"longdesc": "The randomness of cell centers positions",
|
|
||||||
"max": 1,
|
|
||||||
"min": 0,
|
|
||||||
"name": "randomness",
|
|
||||||
"shortdesc": "Randomness",
|
|
||||||
"step": 0.01,
|
|
||||||
"type": "float"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"shortdesc": "Voronoi Noise"
|
|
||||||
},
|
|
||||||
"type": "shader"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user