{
	"name": "make_tileable",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"w": 0.1
	},
	"seed_int": 0,
	"shader_model": {
		"code": "",
		"global": "",
		"inputs": [
			{
				"default": "vec4(1.0)",
				"function": true,
				"label": "",
				"longdesc": "The image to be made tileable",
				"name": "in",
				"shortdesc": "Input",
				"type": "rgba"
			}
		],
		"instance": [
			"vec4 make_tileable_$(name)(vec2 uv, float w) {",
			"\tvec4 a = $in(uv);",
			"\tvec4 b = $in(fract(uv+vec2(0.5)));",
			"\tfloat coef_ab = sin(1.57079632679*clamp((length(uv-vec2(0.5))-0.5+w)/w, 0.0, 1.0));",
			"\tvec4 c = $in(fract(uv+vec2(0.25)));",
			"\tfloat coef_abc = sin(1.57079632679*clamp((min(min(length(uv-vec2(0.0, 0.5)), length(uv-vec2(0.5, 0.0))), min(length(uv-vec2(1.0, 0.5)), length(uv-vec2(0.5, 1.0))))-w)/w, 0.0, 1.0));",
			"\treturn mix(c, mix(a, b, coef_ab), coef_abc);",
			"}",
			""
		],
		"longdesc": "Creates a tileable version of its input image by moving different parts around to hide seams.",
		"name": "Make Tileable",
		"outputs": [
			{
				"longdesc": "A tileable version of the input image",
				"rgba": "make_tileable_$(name)($uv, 0.5*$w)",
				"shortdesc": "Output",
				"type": "rgba"
			}
		],
		"parameters": [
			{
				"control": "None",
				"default": 0.1,
				"label": "",
				"longdesc": "Width of the transition areas between parts of the input image",
				"max": 0.25,
				"min": 0,
				"name": "w",
				"shortdesc": "Width",
				"step": 0.01,
				"type": "float"
			}
		]
	},
	"type": "shader"
}