mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Processed a 4 more mmg files.
This commit is contained in:
parent
c54948d81a
commit
c9fe275357
@ -187,6 +187,33 @@ const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
#stitch, float, min: 0, max: 10, default: 1, step:1
|
||||
#width_map, float, default: 1, (does not need input val (label)) (universal input)
|
||||
|
||||
#----------------------
|
||||
#truchet.mmg
|
||||
|
||||
#Outputs:
|
||||
|
||||
#line: $shape = 1
|
||||
#circle: $shape = 2
|
||||
|
||||
#Output (float) - Shows a greyscale image of the truchet pattern.
|
||||
#truchet$shape($uv*$size, vec2(float($seed)))
|
||||
|
||||
#Inputs:
|
||||
#shape, enum, default: 0, values: line, circle
|
||||
#size, float, default: 4, min: 2, max: 64, step: 1
|
||||
|
||||
#----------------------
|
||||
#truchet_generic.mmg
|
||||
|
||||
#Outputs:
|
||||
|
||||
#Output (color)
|
||||
#$in(truchet_generic_uv($uv*$size, vec2(float($seed))))
|
||||
|
||||
#Inputs:
|
||||
#in, color, default: color(1.0)
|
||||
#size, float, default: 4, min: 2, max: 64, step: 1
|
||||
|
||||
enum CombinerAxisType {
|
||||
SINE,
|
||||
TRIANGLE,
|
||||
@ -253,26 +280,48 @@ static func pattern(uv : Vector2, x_scale : float, y_scale : float, ct : int, ca
|
||||
return Commons.mix_pow(x, y);
|
||||
|
||||
return 0.0
|
||||
|
||||
|
||||
static func truchet1c(uv : Vector2, pseed : Vector2) -> Color:
|
||||
var f : float = truchet1(uv, pseed)
|
||||
return Color(f, f, f, 1);
|
||||
|
||||
#float truchet1(vec2 uv, vec2 seed) {
|
||||
# vec2 i = floor(uv);
|
||||
# vec2 f = fract(uv)-vec2(0.5);
|
||||
#
|
||||
# return 1.0-abs(abs((2.0*step(rand(i+seed), 0.5)-1.0)*f.x+f.y)-0.5);
|
||||
#}
|
||||
|
||||
static func truchet1(uv : Vector2, pseed : Vector2) -> float:
|
||||
var i : Vector2 = Commons.floorv2(uv);
|
||||
var f : Vector2 = Commons.fractv2(uv) - Vector2(0.5, 0.5);
|
||||
|
||||
return 1.0 - abs(abs((2.0*Commons.step(Commons.rand(i+pseed), 0.5)-1.0)*f.x+f.y)-0.5);
|
||||
|
||||
static func truchet2c(uv : Vector2, pseed : Vector2) -> Color:
|
||||
var f : float = truchet2(uv, pseed)
|
||||
return Color(f, f, f, 1);
|
||||
|
||||
#float truchet2(vec2 uv, vec2 seed) {
|
||||
# vec2 i = floor(uv);
|
||||
# vec2 f = fract(uv);
|
||||
# float random = step(rand(i+seed), 0.5);
|
||||
#
|
||||
# f.x *= 2.0*random-1.0;
|
||||
# f.x += 1.0-random;
|
||||
#
|
||||
# return 1.0-min(abs(length(f)-0.5), abs(length(1.0-f)-0.5));
|
||||
#}
|
||||
|
||||
static func truchet2(uv : Vector2, pseed : Vector2) -> float:
|
||||
var i : Vector2 = Commons.floorv2(uv);
|
||||
var f : Vector2 = Commons.fractv2(uv);
|
||||
var random : float = Commons.step(Commons.rand(i+pseed), 0.5);
|
||||
|
||||
f.x *= 2.0 * random-1.0;
|
||||
f.x += 1.0 - random;
|
||||
|
||||
return 1.0 - min(abs(f.length() - 0.5), abs((Vector2(1, 1) - f).length() - 0.5));
|
||||
|
||||
static func weavec(uv : Vector2, count : Vector2, width : float) -> Color:
|
||||
@ -948,3 +997,15 @@ static func brick2(uv : Vector2, bmin : Vector2, bmax : Vector2, mortar : float,
|
||||
|
||||
static func bricks_uneven(uv : Vector2, iterations : int, min_size : float, randomness : float, pseed : float) -> Color:
|
||||
return Color()
|
||||
|
||||
|
||||
#vec2 truchet_generic_uv(vec2 uv, vec2 seed) {
|
||||
# vec2 i = floor(uv);
|
||||
# vec2 f = fract(uv);
|
||||
# vec2 invert = step(rand2(seed+i), vec2(0.5));
|
||||
#
|
||||
# return f*(vec2(1.0)-invert)+(vec2(1.0)-f)*invert;
|
||||
#}
|
||||
|
||||
static func truchet_generic_uv(uv : Vector2, pseed : float) -> Vector2:
|
||||
return Vector2()
|
||||
|
@ -3,6 +3,42 @@ extends Reference
|
||||
|
||||
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
|
||||
#----------------------
|
||||
#sphere.mmg
|
||||
|
||||
#Outputs:
|
||||
|
||||
#Output - (float) - A heightmap of the specified sphere
|
||||
#sphere($uv, vec2($cx, $cy), $r)
|
||||
|
||||
#Inputs:
|
||||
#center, vector2, default: 0.5, min: 0, max: 1, step: 0.01
|
||||
#radius, float, min: 0, max: 1, default: 0.5, step:0.01
|
||||
|
||||
#----------------------
|
||||
#shape.mmg
|
||||
|
||||
#Outputs:
|
||||
|
||||
#Output - (float) - Shows a white shape on a black background
|
||||
#shape_$(shape)($(uv), $(sides), $(radius)*$radius_map($uv), $(edge)*$edge_map($uv))
|
||||
|
||||
#Inputs:
|
||||
#shape, enum, default: 0, values: circle, ploygon, star, curved_star, rays
|
||||
#sides, int, min: 2, max: 32, default: 3, step:1
|
||||
#radius, float, min: 0, max: 1, default: 1, step:0.01 (universal input)
|
||||
#edge, float, min: 0, max: 1, default: 0.2, step:0.01 (universal input)
|
||||
|
||||
|
||||
#float sphere(vec2 uv, vec2 c, float r) {
|
||||
# uv -= c;
|
||||
# uv /= r;
|
||||
# return 2.0*r*sqrt(max(0.0, 1.0-dot(uv, uv)));
|
||||
#}
|
||||
|
||||
static func sphere(uv : Vector2, c : Vector2, r : float) -> float:
|
||||
return 0.0
|
||||
|
||||
#float shape_circle(vec2 uv, float sides, float size, float edge) {
|
||||
# uv = 2.0*uv-1.0;
|
||||
# edge = max(edge, 1.0e-8);
|
||||
|
@ -1,115 +0,0 @@
|
||||
{
|
||||
"name": "shape",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"edge": 0.1,
|
||||
"radius": 0.85,
|
||||
"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((1.0-(cos(floor(0.5+angle/slice)*slice-angle)*length(uv))/size)/edge, 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((1.0-(cos(floor(angle*sides/6.28318530718-0.5+2.0*step(fract(angle*sides/6.28318530718), 0.5))*slice-angle)*length(uv))/size)/edge, 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((1.0-cos(floor(0.5+0.5*angle/slice)*2.0*slice-angle)*length(uv)/size)/edge, 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": [
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "3:",
|
||||
"longdesc": "An input map that affects the shape size",
|
||||
"name": "radius_map",
|
||||
"shortdesc": "Size map",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "An input map that affects the edge width",
|
||||
"name": "edge_map",
|
||||
"shortdesc": "Edge map",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Draws a white shape on a black background",
|
||||
"name": "Shape",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "shape_$(shape)($(uv), $(sides), $(radius)*$radius_map($uv), $(edge)*$edge_map($uv))",
|
||||
"longdesc": "Shows a white shape on a black background",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The type of shape drawn by this node",
|
||||
"name": "shape",
|
||||
"shortdesc": "Shape",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Circle",
|
||||
"value": "circle"
|
||||
},
|
||||
{
|
||||
"name": "Polygon",
|
||||
"value": "polygon"
|
||||
},
|
||||
{
|
||||
"name": "Star",
|
||||
"value": "star"
|
||||
},
|
||||
{
|
||||
"name": "Curved star",
|
||||
"value": "curved_star"
|
||||
},
|
||||
{
|
||||
"name": "Rays",
|
||||
"value": "rays"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 3,
|
||||
"label": "",
|
||||
"longdesc": "The number of sides of the generated shape (unused for Circle)",
|
||||
"max": 32,
|
||||
"min": 2,
|
||||
"name": "sides",
|
||||
"shortdesc": "Sides count",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"longdesc": "The size of the generated shape",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "radius",
|
||||
"shortdesc": "Shape size",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.2,
|
||||
"label": "",
|
||||
"longdesc": "The edge width of the generated shape",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "edge",
|
||||
"shortdesc": "Edge width",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
{
|
||||
"name": "sphere",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"cx": 0.5,
|
||||
"cy": 0.5,
|
||||
"r": 0.5
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float sphere(vec2 uv, vec2 c, float r) {\n\tuv -= c;\n\tuv /= r;\n\treturn 2.0*r*sqrt(max(0.0, 1.0-dot(uv, uv)));\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Sphere",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "sphere($uv, vec2($cx, $cy), $r)",
|
||||
"longdesc": "A heightmap of the specified sphere",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Center X",
|
||||
"longdesc": "Position of the center along the X axis",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "cx",
|
||||
"shortdesc": "Center.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Center Y",
|
||||
"longdesc": "Position of the center along the Y axis",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "cy",
|
||||
"shortdesc": "Center.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Radius",
|
||||
"longdesc": "Radius of the sphere",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "r",
|
||||
"shortdesc": "Radius",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
{
|
||||
"name": "truchet",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"shape": 0,
|
||||
"size": 4
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float truchet1(vec2 uv, vec2 seed) {\n vec2 i = floor(uv);\n vec2 f = fract(uv)-vec2(0.5);\n return 1.0-abs(abs((2.0*step(rand(i+seed), 0.5)-1.0)*f.x+f.y)-0.5);\n}\n\nfloat truchet2(vec2 uv, vec2 seed) {\n vec2 i = floor(uv);\n vec2 f = fract(uv);\n float random = step(rand(i+seed), 0.5);\n f.x *= 2.0*random-1.0;\n f.x += 1.0-random;\n return 1.0-min(abs(length(f)-0.5), abs(length(1.0-f)-0.5));\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates a truchet pattern",
|
||||
"name": "Truchet",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "truchet$shape($uv*$size, vec2(float($seed)))",
|
||||
"longdesc": "Shows a greyscale image of the truchet pattern.",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Shape",
|
||||
"longdesc": "The base shape of each tile of the truchet pattern",
|
||||
"name": "shape",
|
||||
"shortdesc": "Shape",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Line",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "Circle",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Size",
|
||||
"longdesc": "The number of rows and columns of the truchet pattern",
|
||||
"max": 64,
|
||||
"min": 2,
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Truchet pattern"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
{
|
||||
"name": "truchet_generic",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"size": 6
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec2 truchet_generic_uv(vec2 uv, vec2 seed) {\n vec2 i = floor(uv);\n vec2 f = fract(uv);\n\tvec2 invert = step(rand2(seed+i), vec2(0.5));\n return f*(vec2(1.0)-invert)+(vec2(1.0)-f)*invert;\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Generic Truchet",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$in(truchet_generic_uv($uv*$size, vec2(float($seed))))",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Size",
|
||||
"max": 64,
|
||||
"min": 2,
|
||||
"name": "size",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
Loading…
Reference in New Issue
Block a user