{
	"name": "warp_dilation_nobuf",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"a": 0,
		"d": 0.5,
		"mode": 0,
		"s": 9
	},
	"seed_int": 0,
	"shader_model": {
		"code": "",
		"global": "",
		"inputs": [
			{
				"default": "0.0",
				"function": true,
				"label": "",
				"longdesc": "The input image",
				"name": "in",
				"shortdesc": "Input",
				"type": "f"
			},
			{
				"default": "0.0",
				"function": true,
				"label": "",
				"longdesc": "The height map whose contours or slopes are followed",
				"name": "hm",
				"shortdesc": "Height map",
				"type": "f"
			}
		],
		"instance": [
			"vec2 $(name)_slope(vec2 uv, float epsilon) {",
			"\tfloat dx = $hm(fract(uv+vec2(epsilon, 0.0)))-$hm(fract(uv-vec2(epsilon, 0.0)));",
			"\tfloat dy = $hm(fract(uv+vec2(0.0, epsilon)))-$hm(fract(uv-vec2(0.0, epsilon)));",
			"\treturn vec2($mode);",
			"}",
			"",
			"float $(name)_dilate(vec2 uv, vec2 slope) {",
			"\tfloat e = 1.0/$s;",
			"\tfloat v = 0.0;",
			"\tfor (float x = 0.0; x <= $d; x += e) {",
			"\t\tv = max(v, $in(fract(uv))*(1.0-x/$d*$a));",
			"\t\tuv += e*normalize($(name)_slope(uv, 0.0001));",
			"\t}",
			"\treturn v;",
			"}"
		],
		"longdesc": "Dilates its input following the contours or slope of an input heightmap",
		"name": "Warp Dilation",
		"outputs": [
			{
				"f": "$(name)_dilate($uv, normalize($(name)_slope($uv, 0.001)))",
				"longdesc": "The dilated image",
				"shortdesc": "Output",
				"type": "f"
			}
		],
		"parameters": [
			{
				"default": 0,
				"label": "Mode",
				"longdesc": "The dilate mode (clockwise contour, counter clockwise contour or slope)",
				"name": "mode",
				"shortdesc": "Mode",
				"type": "enum",
				"values": [
					{
						"name": "Contour (cw)",
						"value": "-dy,dx"
					},
					{
						"name": "Contour (ccw)",
						"value": "dy, -dx"
					},
					{
						"name": "Slope",
						"value": "dx,dy"
					}
				]
			},
			{
				"default": 9,
				"first": 6,
				"label": "Resolution",
				"last": 12,
				"longdesc": "The resolution at which the contours or slopes are followed (higher values will be more precise but rendering time will be higher)",
				"name": "s",
				"shortdesc": "Resolution",
				"type": "size"
			},
			{
				"control": "None",
				"default": 0.1,
				"label": "Distance",
				"longdesc": "The distance along which the contours or slopes are followed",
				"max": 0.5,
				"min": 0,
				"name": "d",
				"shortdesc": "Distance",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "None",
				"default": 0,
				"label": "Attenuation",
				"longdesc": "The attenuation applied along the path",
				"max": 1,
				"min": 0,
				"name": "a",
				"shortdesc": "Attenuation",
				"step": 0.01,
				"type": "float"
			}
		],
		"shortdesc": "Warp Dilation"
	},
	"type": "shader"
}