Turned all except one sdf related mmg files into comments. In a more crude way than before.

This commit is contained in:
Relintai 2021-10-12 22:23:31 +02:00
parent c9fe275357
commit a25d43ae29
19 changed files with 1081 additions and 1310 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +0,0 @@
{
"name": "sdarc",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"a1": 30,
"a2": 150,
"r1": 0.3,
"r2": 0.1
},
"shader_model": {
"code": "",
"global": "float sdArc(vec2 p, float a1, float a2, float ra, float rb) {\n\tfloat amid = 0.5*(a1+a2)+1.6+3.14*step(a1, a2);\n\tfloat alength = 0.5*(a1-a2)-1.6+3.14*step(a1, a2);\n\tvec2 sca = vec2(cos(amid), sin(amid));\n\tvec2 scb = vec2(cos(alength), sin(alength));\n p *= mat2(vec2(sca.x,sca.y),vec2(-sca.y,sca.x));\n p.x = abs(p.x);\n float k = (scb.y*p.x>scb.x*p.y) ? dot(p.xy,scb) : length(p.xy);\n return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;\n}\n",
"inputs": [
],
"instance": "",
"longdesc": "An arc as a signed distance function",
"name": "sdArc",
"outputs": [
{
"longdesc": "The arc as a signed distance function",
"sdf2d": "sdArc($uv-vec2(0.5), mod($a1, 360.0)*0.01745329251, mod($a2, 360.0)*0.01745329251, $r1, $r2)",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Angle1.a",
"default": 0,
"label": "Angle 1",
"longdesc": "The first angle of the arc",
"max": 180,
"min": -180,
"name": "a1",
"shortdesc": "Angle1",
"step": 1,
"type": "float"
},
{
"control": "Angle2.a",
"default": 0,
"label": "Angle 2",
"longdesc": "The second angle of the arc",
"max": 180,
"min": -180,
"name": "a2",
"shortdesc": "Angle2",
"step": 1,
"type": "float"
},
{
"control": "Radius1.r",
"default": 0.5,
"label": "Radius",
"longdesc": "The radius of the arc",
"max": 1,
"min": 0,
"name": "r1",
"shortdesc": "Radius",
"step": 0.01,
"type": "float"
},
{
"control": "Radius11.r",
"default": 0.1,
"label": "Width",
"longdesc": "The width of the shape around the arc",
"max": 1,
"min": 0,
"name": "r2",
"shortdesc": "Width",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdArc"
},
"type": "shader"
}

View File

@ -1,69 +0,0 @@
{
"name": "sdboolean",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"op": 0
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The first shape, defined as a signed distance function",
"name": "in1",
"shortdesc": "Input1",
"type": "sdf2d"
},
{
"default": "0.0",
"label": "",
"longdesc": "The second shape, defined as a signed distance function",
"name": "in2",
"shortdesc": "Input2",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Performs a boolean operation (union, intersection or difference) between two shapes",
"name": "sdBoolean",
"outputs": [
{
"longdesc": "The shape generated by the boolean operation",
"sdf2d": "$op $in1($uv), $in2($uv))",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"default": 2,
"label": "",
"longdesc": "The operation performed by this node",
"name": "op",
"shortdesc": "Operation",
"type": "enum",
"values": [
{
"name": "Union",
"value": "min("
},
{
"name": "Subtraction",
"value": "max(-"
},
{
"name": "Intersection",
"value": "max("
}
]
}
],
"shortdesc": "sdBoolean"
},
"type": "shader"
}

View File

@ -1,83 +0,0 @@
{
"name": "sdbox",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"cx": 0,
"cy": 0,
"h": 0.2,
"w": 0.3
},
"shader_model": {
"code": "vec2 $(name_uv)_d = abs($uv-vec2($cx+0.5, $cy+0.5))-vec2($w, $h);\n",
"global": "",
"inputs": [
],
"instance": "",
"longdesc": "A rectangle described as a signed distance function",
"name": "sdBox",
"outputs": [
{
"longdesc": "The generated signed distance function",
"sdf2d": "length(max($(name_uv)_d,vec2(0)))+min(max($(name_uv)_d.x,$(name_uv)_d.y),0.0)",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Rect1.x",
"default": 0.5,
"label": "Width",
"longdesc": "The width of the box",
"max": 1,
"min": 0,
"name": "w",
"shortdesc": "Width",
"step": 0.01,
"type": "float"
},
{
"control": "Rect1.y",
"default": 1,
"label": "Height",
"longdesc": "The height of the box",
"max": 1,
"min": 0,
"name": "h",
"shortdesc": "Height",
"step": 0.01,
"type": "float"
},
{
"control": "P1.x",
"default": 0,
"label": "Center X",
"longdesc": "The position of the center of the box on the X axis",
"max": 1,
"min": -1,
"name": "cx",
"shortdesc": "Center.x",
"step": 0.01,
"type": "float"
},
{
"control": "P1.y",
"default": 0,
"label": "Center Y",
"longdesc": "The position of the center of the box on the Y axis",
"max": 1,
"min": -1,
"name": "cy",
"shortdesc": "Center.y",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdBox"
},
"type": "shader"
}

View File

@ -1,70 +0,0 @@
{
"name": "sdcircle",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"cx": 0,
"cy": 0,
"r": 0.4
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
],
"instance": "",
"longdesc": "A circle described as a signed distance function",
"name": "sdCircle",
"outputs": [
{
"longdesc": "The generated signed distance function",
"sdf2d": "length($uv-vec2($cx+0.5, $cy+0.5))-$r",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Radius1.r",
"default": 0.5,
"label": "Radius",
"longdesc": "The radius of the circle",
"max": 1,
"min": 0,
"name": "r",
"shortdesc": "Radius",
"step": 0.01,
"type": "float"
},
{
"control": "P1.x",
"default": 0,
"label": "Center X",
"longdesc": "The position of the center on the X axis",
"max": 1,
"min": -1,
"name": "cx",
"shortdesc": "Center.x",
"step": 0.01,
"type": "float"
},
{
"control": "P1.y",
"default": 0,
"label": "Center Y",
"longdesc": "The position of the center on the Y axis",
"max": 1,
"min": -1,
"name": "cy",
"shortdesc": "Center.y",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdCircle"
},
"type": "shader"
}

View File

@ -1,51 +0,0 @@
{
"name": "sdcirclerepeat",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"c": 6
},
"shader_model": {
"code": "",
"global": "vec2 circle_repeat_transform_2d(vec2 p, float count) {\n\tfloat r = 6.28/count;\n\tfloat pa = atan(p.x, p.y);\n\tfloat a = mod(pa+0.5*r, r)-0.5*r;\n\tvec2 rv;\n\tfloat c = cos(a-pa);\n\tfloat s = sin(a-pa);\n\trv.x = p.x*c+p.y*s;\n\trv.y = -p.x*s+p.y*c;\n\treturn rv;\n}\n",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Repeats its input shape around a circle",
"name": "Circle Repeat",
"outputs": [
{
"longdesc": "The shape generated by the repeat operation",
"sdf2d": "$in(circle_repeat_transform_2d($uv-vec2(0.5), $c)+vec2(0.5))",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 4,
"label": "",
"longdesc": "The number of repetitions of the input shape around the circle",
"max": 32,
"min": 1,
"name": "c",
"shortdesc": "Count",
"step": 1,
"type": "float"
}
],
"shortdesc": "Circle Repeat"
},
"type": "shader"
}

View File

@ -1,62 +0,0 @@
{
"name": "sdelongation",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"k": 0.15,
"op": 0,
"r": 0.08,
"w": 0.28,
"x": 0,
"y": 0
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "sdf2d"
}
],
"instance": "",
"name": "sdElongation",
"outputs": [
{
"sdf2d": "$in($uv-clamp($uv-vec2(0.5), -vec2($x, $y), vec2($x, $y)))",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Rect1.x",
"default": 0,
"label": "X",
"max": 1,
"min": 0,
"name": "x",
"step": 0.01,
"type": "float"
},
{
"control": "Rect1.y",
"default": 0,
"label": "Y",
"max": 1,
"min": 0,
"name": "y",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -1,135 +0,0 @@
{
"name": "sdline",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"ax": -0.3,
"ay": -0.3,
"bx": 0.3,
"by": 0.3,
"profile": {
"points": [
{
"ls": 0,
"rs": 0,
"x": 0,
"y": 1
},
{
"ls": 0,
"rs": 0,
"x": 1,
"y": 1
}
],
"type": "Curve"
},
"r": 0.1
},
"shader_model": {
"code": "vec2 $(name_uv)_sdl = sdLine($uv, vec2($ax+0.5, $ay+0.5), vec2($bx+0.5, $by+0.5));",
"global": "vec2 sdLine(vec2 p, vec2 a, vec2 b) {\n vec2 pa = p-a, ba = b-a;\n float h = clamp(dot(pa,ba)/dot(ba,ba), 0.0, 1.0);\n return vec2(length(pa-ba*h), h);\n}\n",
"inputs": [
],
"instance": "",
"longdesc": "A line or a capsule shape described as a signed distance function",
"name": "sdLine",
"outputs": [
{
"longdesc": "The shape as signed distance function",
"sdf2d": "$(name_uv)_sdl.x-$r*$profile($(name_uv)_sdl.y)",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "P1.x",
"default": 0,
"label": "A X",
"longdesc": "The position on the X axis of the first point of the line",
"max": 1,
"min": -1,
"name": "ax",
"shortdesc": "A.x",
"step": 0.01,
"type": "float"
},
{
"control": "P1.y",
"default": 0,
"label": "A Y",
"longdesc": "The position on the Y axis of the first point of the line",
"max": 1,
"min": -1,
"name": "ay",
"shortdesc": "A.y",
"step": 0.01,
"type": "float"
},
{
"control": "P2.x",
"default": 1,
"label": "B X",
"longdesc": "The position on the X axis of the second point of the line",
"max": 1,
"min": -1,
"name": "bx",
"shortdesc": "B.x",
"step": 0.01,
"type": "float"
},
{
"control": "P2.y",
"default": 1,
"label": "B Y",
"longdesc": "The position on the Y axis of the second point of the line",
"max": 1,
"min": -1,
"name": "by",
"shortdesc": "B.y",
"step": 0.01,
"type": "float"
},
{
"control": "Radius1.r",
"default": 0,
"label": "Width",
"longdesc": "The width of the capsule shape around the line",
"max": 1,
"min": 0,
"name": "r",
"shortdesc": "Width",
"step": 0.01,
"type": "float"
},
{
"default": {
"points": [
{
"ls": 0,
"rs": 0,
"x": 0,
"y": 1
},
{
"ls": 0,
"rs": 0,
"x": 1,
"y": 1
}
],
"type": "Curve"
},
"label": "Profile",
"name": "profile",
"type": "curve"
}
],
"shortdesc": "sdLine"
},
"type": "shader"
}

View File

@ -1,60 +0,0 @@
{
"name": "sdmorph",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"amount": 0.5
},
"seed_value": 41515,
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The first shape, defined as a signed distance function",
"name": "in1",
"shortdesc": "Input1",
"type": "sdf2d"
},
{
"default": "0.0",
"label": "",
"longdesc": "The second shape, defined as a signed distance function",
"name": "in2",
"shortdesc": "Input2",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Morphs between 2 input shapes",
"name": "sdMorph",
"outputs": [
{
"longdesc": "The generated hybrid shape",
"sdf2d": "mix($in1($uv), $in2($uv), $amount)",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 0.5,
"label": "",
"longdesc": "The amount of the second input in the result",
"max": 1,
"min": 0,
"name": "amount",
"shortdesc": "Amount",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdMorph"
},
"type": "shader"
}

View File

@ -1,102 +0,0 @@
{
"name": "sdngon",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"cx": 0,
"cy": 0,
"n": 5,
"r": 0.4,
"rot": 0
},
"seed": 0,
"seed_locked": false,
"shader_model": {
"code": "",
"global": "float sdNgon(vec2 p, float r, float n) {\n\tfloat PI = 3.1415926535;\n\tp = circle_repeat_transform_2d(p, n);\n\tvec2 d = abs(p)-vec2(r*tan(3.14159265359/n), r);\n\treturn p.y < r ? p.y-r : length(max(d,vec2(0)))+min(max(d.x,d.y),0.0);\n}",
"includes": [
"sdrotate",
"sdcirclerepeat"
],
"inputs": [
],
"instance": "",
"longdesc": "An n-gon described as a signed distance function",
"name": "sdNgon",
"outputs": [
{
"longdesc": "The n-gon as a signed distance function",
"sdf2d": "sdNgon(sdf2d_rotate($uv-vec2($cx, $cy), $rot*0.01745329251-1.57079632679)-vec2(0.5), $r, $n)",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 3,
"label": "N",
"longdesc": "The number of sides of the n-gon",
"max": 12,
"min": 3,
"name": "n",
"shortdesc": "N",
"step": 1,
"type": "float"
},
{
"control": "Radius1.r",
"default": 0.5,
"label": "Radius",
"longdesc": "The radius of the n-gon",
"max": 1,
"min": 0,
"name": "r",
"shortdesc": "Radius",
"step": 0.01,
"type": "float"
},
{
"control": "Radius1.a",
"default": 0,
"label": "Rotation",
"longdesc": "The rotation of the n-gon",
"max": 180,
"min": -180,
"name": "rot",
"shortdesc": "Rotation",
"step": 0.01,
"type": "float"
},
{
"control": "P1.x",
"default": 0,
"label": "Center X",
"longdesc": "The position of the center on the X axis",
"max": 0.5,
"min": -0.5,
"name": "cx",
"shortdesc": "Center.x",
"step": 0.01,
"type": "float"
},
{
"control": "P1.y",
"default": 0,
"label": "Center Y",
"longdesc": "The position of the center on the Y axis",
"max": 0.5,
"min": -0.5,
"name": "cy",
"shortdesc": "Center.y",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdNgon"
},
"type": "shader"
}

View File

@ -1,72 +0,0 @@
{
"name": "sdpolygon",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"polygon": {
"points": [
{
"x": 0.2,
"y": 0.2
},
{
"x": 0.4,
"y": 0.7
},
{
"x": 0.7,
"y": 0.4
}
],
"type": "Polygon"
}
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
],
"instance": "float sdPolygon_$(name)(vec2 p) {\n\tvec2 v[] = $polygon;\n\tint l = v.length();\n float d = dot(p-v[0],p-v[0]);\n float s = 1.0;\n\tint j = l-1;\n for(int i=0; i<l; i++)\n {\n vec2 e = v[j] - v[i];\n vec2 w = p - v[i];\n vec2 b = w - e*clamp( dot(w,e)/dot(e,e), 0.0, 1.0 );\n d = min( d, dot(b,b) );\n bvec3 c = bvec3(p.y>=v[i].y,p.y<v[j].y,e.x*w.y>e.y*w.x);\n if( all(c) || all(not(c)) ) s*=-1.0;\n\t\tj=i;\n }\n return s*sqrt(d);\n}\n",
"longdesc": "A polygon as a signed distance function",
"name": "sdPolygon",
"outputs": [
{
"longdesc": "The polygon as a signed distance function",
"sdf2d": "sdPolygon_$(name)($uv)",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"default": {
"points": [
{
"x": 0.2,
"y": 0.2
},
{
"x": 0.4,
"y": 0.7
},
{
"x": 0.7,
"y": 0.4
}
],
"type": "Polygon"
},
"label": "",
"longdesc": "The polygon to be drawn",
"name": "polygon",
"shortdesc": "Polygon",
"type": "polygon"
}
],
"shortdesc": "sdPolygon"
},
"type": "shader"
}

View File

@ -1,77 +0,0 @@
{
"name": "sdrepeat",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"r": 0.5,
"rx": 3,
"ry": 3
},
"shader_model": {
"code": "",
"global": "vec2 repeat_2d(vec2 p, vec2 r, float seed, float randomness) {\n\tp -= vec2(0.5);\n\tfloat a = (rand(floor(mod((p.xy+0.5*r.xy)/r.xy, 1.0/r.xy)+vec2(seed)))-0.5)*6.28*randomness;\n\tp = mod(p+0.5*r,r)-0.5*r;\n\tvec2 rv;\n\tfloat c = cos(a);\n\tfloat s = sin(a);\n\trv.x = p.x*c+p.y*s;\n\trv.y = -p.x*s+p.y*c;\n\treturn rv+vec2(0.5);\n}\n",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Repeats its input shape on a grid.\nThis node does not support overlapping between instances.",
"name": "Repeat",
"outputs": [
{
"longdesc": "The shape generated by the repeat operation",
"sdf2d": "$in(repeat_2d($uv, vec2(1.0/$rx, 1.0/$ry), float($seed), $r))",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 4,
"label": "X",
"longdesc": "The number of columns in the grid",
"max": 32,
"min": 1,
"name": "rx",
"shortdesc": "Columns",
"step": 1,
"type": "float"
},
{
"control": "None",
"default": 4,
"label": "Y",
"longdesc": "The number of lines in the grid",
"max": 32,
"min": 1,
"name": "ry",
"shortdesc": "Lines",
"step": 1,
"type": "float"
},
{
"control": "None",
"default": 0.5,
"label": "R",
"longdesc": "The amount of random rotation on each instance of the input shape",
"max": 1,
"min": 0,
"name": "r",
"shortdesc": "Rotation",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdRepeat"
},
"type": "shader"
}

View File

@ -1,83 +0,0 @@
{
"name": "sdrhombus",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"cx": 0,
"cy": 0,
"h": 0.2,
"w": 0.3
},
"shader_model": {
"code": "",
"global": "float sdr_ndot(vec2 a, vec2 b) { return a.x*b.x - a.y*b.y; }\nfloat sdRhombus(in vec2 p, in vec2 b) {\n vec2 q = abs(p);\n float h = clamp((-2.0*sdr_ndot(q,b)+sdr_ndot(b,b))/dot(b,b),-1.0,1.0);\n float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );\n return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );\n}",
"inputs": [
],
"instance": "",
"longdesc": "A rhombus described as a signed distance function",
"name": "sdRhombus",
"outputs": [
{
"longdesc": "The rhombus as a signed distance function",
"sdf2d": "sdRhombus($uv-vec2($cx+0.5, $cy+0.5), vec2($w, $h))",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Rect1.x",
"default": 0.5,
"label": "Width",
"longdesc": "The width of the rhombus",
"max": 1,
"min": 0,
"name": "w",
"shortdesc": "Width",
"step": 0.01,
"type": "float"
},
{
"control": "Rect1.y",
"default": 1,
"label": "Height",
"longdesc": "The height of the rhombus",
"max": 1,
"min": 0,
"name": "h",
"shortdesc": "Height",
"step": 0.01,
"type": "float"
},
{
"control": "P1.x",
"default": 0,
"label": "Center X",
"longdesc": "The position of the center on the X axis",
"max": 1,
"min": -1,
"name": "cx",
"shortdesc": "Center.x",
"step": 0.01,
"type": "float"
},
{
"control": "P1.y",
"default": 0,
"label": "Center Y",
"longdesc": "The position of the center on the Y axis",
"max": 1,
"min": -1,
"name": "cy",
"shortdesc": "Center.y",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdRhombus"
},
"type": "shader"
}

View File

@ -1,51 +0,0 @@
{
"name": "sdrotate",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"a": 0
},
"shader_model": {
"code": "",
"global": "vec2 sdf2d_rotate(vec2 uv, float a) {\n\tvec2 rv;\n\tfloat c = cos(a);\n\tfloat s = sin(a);\n\tuv -= vec2(0.5);\n\trv.x = uv.x*c+uv.y*s;\n\trv.y = -uv.x*s+uv.y*c;\n\treturn rv+vec2(0.5);\n}\n",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Rotates its input shape described as a signed distance function",
"name": "Rotate",
"outputs": [
{
"longdesc": "The rotated shape",
"sdf2d": "$in(sdf2d_rotate($uv, $a*0.01745329251))",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Radius1.a",
"default": 0,
"label": "",
"longdesc": "The rotation angle",
"max": 180,
"min": -180,
"name": "a",
"shortdesc": "Angle",
"step": 1,
"type": "float"
}
],
"shortdesc": "sdRotate"
},
"type": "shader"
}

View File

@ -1,51 +0,0 @@
{
"name": "sdroundedshape",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"r": 0.2
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Dilates an input shape into a rounded shape",
"name": "sdRoundedShape",
"outputs": [
{
"longdesc": "The shape generated by the operation",
"sdf2d": "$in($uv)-$r",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 0,
"label": "",
"longdesc": "The length of the dilate operation",
"max": 1,
"min": 0,
"name": "r",
"shortdesc": "Radius",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdRoundedShape"
},
"type": "shader"
}

View File

@ -1,51 +0,0 @@
{
"name": "sdscale",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"s": 1
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Scales its input shape described as a signed distance function",
"name": "Scale",
"outputs": [
{
"longdesc": "The generated scaled shape",
"sdf2d": "$in(($uv-vec2(0.5))/$s+vec2(0.5))*$s",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Scale1.x",
"default": 1,
"label": "",
"longdesc": "The scale of the transform",
"max": 5,
"min": 0,
"name": "s",
"shortdesc": "Scale",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdScale"
},
"type": "shader"
}

View File

@ -1,64 +0,0 @@
{
"name": "sdshow",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"base": 0,
"bevel": 0.1
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The input shape",
"name": "in",
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Creates a greyscale image from a shape described as a 2D Signed Distance Function",
"name": "sdShow",
"outputs": [
{
"f": "clamp($base-$in($uv)/max($bevel, 0.00001), 0.0, 1.0)",
"longdesc": "Shows the shape as a greyscale image",
"shortdesc": "Output",
"type": "f"
}
],
"parameters": [
{
"control": "None",
"default": 0,
"label": "Bevel",
"longdesc": "The width of the gradient at the edges of the shape",
"max": 1,
"min": 0,
"name": "bevel",
"shortdesc": "Bevel",
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0,
"label": "Base",
"longdesc": "The base value of the output",
"max": 1,
"min": 0,
"name": "base",
"shortdesc": "Base",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdShow"
},
"type": "shader"
}

View File

@ -1,82 +0,0 @@
{
"name": "sdsmoothboolean",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"k": 0.15,
"op": 0
},
"shader_model": {
"code": "",
"global": "float sdSmoothUnion( float d1, float d2, float k ) {\n float h = clamp( 0.5 + 0.5*(d2-d1)/k, 0.0, 1.0 );\n return mix( d2, d1, h ) - k*h*(1.0-h); }\n\nfloat sdSmoothSubtraction( float d1, float d2, float k ) {\n float h = clamp( 0.5 - 0.5*(d2+d1)/k, 0.0, 1.0 );\n return mix( d2, -d1, h ) + k*h*(1.0-h); }\n\nfloat sdSmoothIntersection( float d1, float d2, float k ) {\n float h = clamp( 0.5 - 0.5*(d2-d1)/k, 0.0, 1.0 );\n return mix( d2, d1, h ) + k*h*(1.0-h); }\n",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The first shape, defined as a signed distance function",
"name": "in1",
"shortdesc": "Input1",
"type": "sdf2d"
},
{
"default": "0.0",
"label": "",
"longdesc": "The second shape, defined as a signed distance function",
"name": "in2",
"shortdesc": "Input2",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Performs a smooth boolean operation (union, intersection or difference) between two shapes",
"name": "sdSmoothBoolean",
"outputs": [
{
"longdesc": "The shape generated by the boolean operation",
"sdf2d": "sdSmooth$op($in1($uv), $in2($uv), $k)",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"default": 0,
"label": "",
"longdesc": "The operation performed by this node",
"name": "op",
"shortdesc": "Operation",
"type": "enum",
"values": [
{
"name": "Union",
"value": "Union"
},
{
"name": "Subtraction",
"value": "Subtraction"
},
{
"name": "Intersection",
"value": "Intersection"
}
]
},
{
"control": "None",
"default": 0,
"label": "",
"longdesc": "The smoothness of the boolean operation",
"max": 1,
"min": 0,
"name": "k",
"shortdesc": "Smoothness",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdSmoothBoolean"
},
"type": "shader"
}

View File

@ -1,64 +0,0 @@
{
"name": "sdtranslate",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"x": 0,
"y": 0
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The input shape, defined as a signed distance function",
"name": "in",
"shortdesc": "Input",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Translates its input shape described as signed distance function",
"name": "Translate",
"outputs": [
{
"longdesc": "The translated shape",
"sdf2d": "$in($uv-vec2($x, $y))",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "P1.x",
"default": 0,
"label": "X",
"longdesc": "The translation along the X axis",
"max": 1,
"min": -1,
"name": "x",
"shortdesc": "Translate.x",
"step": 0.01,
"type": "float"
},
{
"control": "P1.y",
"default": 0,
"label": "Y",
"longdesc": "The translation along the Y axis",
"max": 1,
"min": -1,
"name": "y",
"shortdesc": "Translate.y",
"step": 0.01,
"type": "float"
}
],
"shortdesc": "sdTranslate"
},
"type": "shader"
}