forked from RodZill4/material-maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedge_detect_3.mmg
62 lines (62 loc) · 1.25 KB
/
edge_detect_3.mmg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
"name": "edge_detect_3",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"size": 6
},
"seed_int": 0,
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "vec3(0.0)",
"function": true,
"label": "",
"longdesc": "The input image",
"name": "in",
"shortdesc": "Input",
"type": "rgb"
}
],
"instance": [
"float $(name)_fct(vec2 uv) {",
"\tvec2 e = vec2(1.0/$size, -1.0/$size);",
"\tvec3 rv = 4.0*$in(uv);",
"\trv -= $in(uv+e.xy);",
"\trv -= $in(uv-e.xy);",
"\trv -= $in(uv+e.xx);",
"\trv -= $in(uv-e.xx);",
"\trv = abs(rv);",
"\treturn max(rv.x, max(rv.y ,rv.z))*$size;",
"}"
],
"longdesc": "An edge detect filter that detects edges along diagonals and draws them in white on a black background",
"name": "Diagonal Edge Detect",
"outputs": [
{
"f": "clamp($(name)_fct($uv), 0.0, 1.0)",
"longdesc": "Shows the generated outlines",
"shortdesc": "Output",
"type": "f"
}
],
"parameters": [
{
"default": 9,
"first": 4,
"label": "Size",
"last": 12,
"longdesc": "The resolution of the input image",
"name": "size",
"shortdesc": "Size",
"type": "size"
}
],
"shortdesc": "Edge Detect"
},
"type": "shader"
}