-
Notifications
You must be signed in to change notification settings - Fork 13
/
VisualizeDistance.nk
216 lines (216 loc) · 3.95 KB
/
VisualizeDistance.nk
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name VisualizeDistance
addUserKnob {20 VisualizeDistance}
addUserKnob {4 type M {inside outside}}
type outside
addUserKnob {6 show_distance l "show distance" -STARTLINE}
addUserKnob {7 threshold t "threshold of color distance to visualize. 1.0 is the edge of the gamut boundary. 0.0 is all colors." R 0 1.2}
threshold 1
addUserKnob {7 shd_rolloff l "shd rolloff" R 0 0.1}
shd_rolloff 0.008
addUserKnob {4 bg t "choose bg to put behind result colors" M {checkerboard "solid color"}}
addUserKnob {41 color T Fill1.color}
}
Input {
inputs 0
name Input
xpos -40
ypos -250
}
Dot {
name Dot1
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xff
xpos -6
ypos -198
}
set N402f2fa0 [stack 0]
Dot {
name Dot2
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xff
xpos -116
ypos -198
}
set N2a8a6560 [stack 0]
Dot {
name Dot5
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xff
xpos -226
ypos -198
}
set N2a90f4c0 [stack 0]
Dot {
name Dot6
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xff
xpos -336
ypos -198
}
Expression {
channel0 {rgba.red rgba.green rgba.blue none}
expr0 max(r,g,b)
channel1 none
channel2 none
channel3 none
name achromatic
note_font Helvetica
xpos -370
ypos -153
}
set N2a92aeb0 [stack 0]
Expression {
temp_name0 c_r
temp_expr0 1-r
temp_name1 c_g
temp_expr1 1-g
temp_name2 c_b
temp_expr2 1-b
expr0 1-(c_r<(1-thr)?c_r:(1-thr)+thr*tanh(((c_r-(1-thr))/thr)))
expr1 1-(c_g<(1-thr)?c_g:(1-thr)+thr*tanh(((c_g-(1-thr))/thr)))
expr2 1-(c_b<(1-thr)?c_b:(1-thr)+thr*tanh(((c_b-(1-thr))/thr)))
name toe
note_font Helvetica
xpos -370
ypos -118
disable {{parent.shd_rolloff==0}}
addUserKnob {20 Params_tab l Params}
addUserKnob {7 thr t "complement of threshold"}
thr {{parent.shd_rolloff}}
}
Expression {
expr0 abs(r)
expr1 abs(g)
expr2 abs(b)
name abs
xpos -370
ypos -82
}
push $N2a92aeb0
push $N2a90f4c0
Merge2 {
inputs 2
operation minus
bbox B
Achannels rgb
Bchannels rgb
output rgb
name Merge2
note_font Helvetica
xpos -260
ypos -153
}
MergeExpression {
inputs 2
expr0 Ar==0?0:Br/Ar
expr1 Ag==0?0:Bg/Ag
expr2 Ab==0?0:Bb/Ab
channel3 none
name MergeDivide
xpos -260
ypos -82
}
set N39140210 [stack 0]
Dot {
name Dot4
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xff
xpos -226
ypos 42
}
push $N39140210
push $N2a8a6560
MergeExpression {
inputs 2
temp_name0 limit
temp_expr0 threshold
temp_name1 sat
temp_expr1 max(Ar,Ag,Ab)
expr0 type?(sat>=limit?Br:0):sat<=limit?Br:0
expr1 type?(sat>=limit?Bg:0):sat<=limit?Bg:0
expr2 type?(sat>=limit?Bb:0):sat<=limit?Bb:0
expr3 type?(sat>limit?1:0):sat<limit?1:0
name MergeExpression1
note_font Helvetica
xpos -150
ypos -81
}
Dot {
name Dot3
note_font "Helvetica Bold"
note_font_size 24
note_font_color 0xff
xpos -116
ypos -30
}
push $N402f2fa0
Fill {
output rgb
color 0.18
name Fill1
note_font Helvetica
xpos -40
ypos -129
}
CheckerBoard2 {
inputs 0
color0 0.1000000015
color1 {{parent.color} {parent.color} {parent.color} {parent.color}}
color2 {{color0} {color0} {color0} {color0}}
color3 {{color1} {color1} {color1} {color1}}
linecolor 0
centerlinewidth 0
name CheckerBoard1
note_font Helvetica
xpos 70
ypos -129
postage_stamp false
}
Reformat {
type "to box"
box_width {{parent.input.width}}
box_height {{parent.input.height}}
box_fixed true
resize fill
name ReformatBox
xpos 70
ypos -82
}
Switch {
inputs 2
which {{parent.bg}}
name Switch1
note_font Helvetica
xpos -40
ypos -81
}
Merge2 {
inputs 2
bbox B
name Merge1
note_font Helvetica
xpos -40
ypos -33
}
Switch {
inputs 2
which {{parent.show_distance}}
name switch_distance
note_font Helvetica
xpos -40
ypos 39
}
Output {
name Output
xpos -40
ypos 110
}
end_group