{
	"generic_size": 1,
	"name": "sdf3d_smoothboolean",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"k1": 0.15,
		"op1": 0
	},
	"seed_int": 0,
	"shader_model": {
		"code": [
			"vec2 $(name_uv)_b = $b($uv);",
			"",
			"#for",
			"$(name_uv)_b = sdf3d_smooth_$op#($s#($uv), $(name_uv)_b, $k#);",
			"#end"
		],
		"global": [
			"vec2 sdf3d_smooth_union(vec2 d1, vec2 d2, float k) {",
			"\tfloat h = clamp(0.5+0.5*(d2.x-d1.x)/k, 0.0, 1.0);",
			"\treturn vec2(mix(d2.x, d1.x, h)-k*h*(1.0-h), mix(d2.y, d1.y, step(d1.x, d2.x)));",
			"}",
			"",
			"vec2 sdf3d_smooth_subtraction(vec2 d1, vec2 d2, float k ) {",
			"\tfloat h = clamp(0.5-0.5*(d2.x+d1.x)/k, 0.0, 1.0);",
			"\treturn vec2(mix(d2.x, -d1.x, h )+k*h*(1.0-h), d2.y);",
			"}",
			"",
			"vec2 sdf3d_smooth_intersection(vec2 d1, vec2 d2, float k ) {",
			"\tfloat h = clamp(0.5-0.5*(d2.x-d1.x)/k, 0.0, 1.0);",
			"\treturn vec2(mix(d2.x, d1.x, h)+k*h*(1.0-h), mix(d1.y, d2.y, step(d1.x, d2.x)));",
			"}",
			""
		],
		"inputs": [
			{
				"default": "vec2(100.0, 0.0)",
				"label": "",
				"longdesc": "The first shape, defined as a signed distance function",
				"name": "b",
				"shortdesc": "Base Shape",
				"type": "sdf3dc"
			},
			{
				"default": "vec2(100.0, 0.0)",
				"label": "",
				"longdesc": "The subsequent shape, defined as a signed distance function",
				"name": "s#",
				"shortdesc": "Shape#",
				"type": "sdf3dc"
			}
		],
		"instance": "",
		"longdesc": "Performs smooth boolean operation(s) (union, intersection or difference) between two or more shapes",
		"name": "SmoothBoolean",
		"outputs": [
			{
				"longdesc": "The shape generated by the boolean operation(s)",
				"sdf3dc": "$(name_uv)_b",
				"shortdesc": "Output",
				"type": "sdf3dc"
			}
		],
		"parameters": [
			{
				"default": 0,
				"label": "2:",
				"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": "2:",
				"longdesc": "The smoothness of the boolean operation",
				"max": 1,
				"min": 0,
				"name": "k#",
				"shortdesc": "Smoothness",
				"step": 0.01,
				"type": "float"
			}
		],
		"shortdesc": "SmoothBoolean"
	},
	"type": "shader"
}