· 6 years ago · Aug 27, 2019, 11:54 PM
1set cut_paste_input [stack 0]
2version 11.1 v3
3BackdropNode {
4 inputs 0
5 name BackdropNode1
6 tile_color 0x222222ff
7 label "Regrain\n"
8 note_font_size 24
9 selected true
10 xpos -474
11 ypos 738
12 bdwidth 530
13 bdheight 377
14}
15BackdropNode {
16 inputs 0
17 name BackdropNode2
18 tile_color 0xaaaaaa00
19 label key
20 note_font_size 42
21 selected true
22 xpos 260
23 ypos -97
24 bdwidth 250
25 bdheight 262
26}
27BackdropNode {
28 inputs 0
29 name BackdropNode5
30 tile_color 0xaaaaaa00
31 label godrays
32 note_font_size 42
33 selected true
34 xpos 260
35 ypos 217
36 bdwidth 354
37 bdheight 275
38}
39BackdropNode {
40 inputs 0
41 name BackdropNode3
42 tile_color 0xffd455ff
43 note_font_size 42
44 selected true
45 xpos -452
46 ypos 814
47 bdwidth 110
48 bdheight 131
49 z_order 1
50}
51BackdropNode {
52 inputs 0
53 name BackdropNode4
54 tile_color 0x9fffff
55 note_font_size 42
56 selected true
57 xpos -313
58 ypos 813
59 bdwidth 112
60 bdheight 134
61 z_order 1
62}
63Read {
64 inputs 0
65 file C:/Users/Samuel/Desktop/sources/MASTER/master_0023.jpg
66 format "1920 1080 0 0 1920 1080 1 HD_1080"
67 origset true
68 name Read1
69 selected true
70 xpos -38
71 ypos -614
72}
73Dot {
74 name Dot5
75 selected true
76 xpos -4
77 ypos -483
78}
79set N2177ce00 [stack 0]
80Denoise2 {
81 amount 1.96
82 enable_temporal true
83 analysisRegion {1395 759 1495 859}
84 analysisFrame 47
85 needsAnalyzing false
86 hasMotion true
87 profileCurve {profile {curve 0 x0.125 0 0 0 0 0 0 0 0}}
88 serializeKnob "7.637743652e-02 5.027216077e-01 4.826497436e-01
897.777331630e-04 4.957949277e-04 4.199358227e-04
907.777331630e-04 4.957949277e-04 4.199358227e-04
917.087803097e-04 4.974089097e-04 4.398856545e-04
920.000000000e+00 0.000000000e+00 0.000000000e+00
933.522183397e-04 3.311061882e-04 2.920456755e-04
943.522183397e-04 3.311061882e-04 2.920456755e-04
952.395832998e-04 1.651628409e-04 1.393342827e-04
960.000000000e+00 0.000000000e+00 0.000000000e+00
971.684527087e-04 2.061269042e-04 1.826388179e-04
981.684527087e-04 2.061269042e-04 1.826388179e-04
991.191751944e-04 1.308342908e-04 1.271618676e-04
1000.000000000e+00 0.000000000e+00 0.000000000e+00
1012.340443316e-04 1.798811718e-04 1.941017108e-04
1022.340443316e-04 1.798811718e-04 1.941017108e-04
1033.658383139e-05 5.750160562e-05 9.615445742e-05
1040.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00
1056292328533108354566"
106 name Denoise1
107 selected true
108 xpos -38
109 ypos -415
110}
111Write {
112 file C:/Users/Samuel/Desktop/master_denoise_23.jpg
113 file_type jpeg
114 _jpeg_quality 1
115 checkHashOnRead false
116 version 2
117 name Write1
118 selected true
119 xpos -38
120 ypos -331
121}
122Read {
123 inputs 0
124 file C:/Users/Samuel/Desktop/sources/master_denoise_23.jpg
125 format "1920 1080 0 0 1920 1080 1 HD_1080"
126 origset true
127 name Read3
128 selected true
129 xpos -38
130 ypos -276
131}
132set N1b852380 [stack 0]
133Dot {
134 name Dot11
135 selected true
136 xpos -175
137 ypos -242
138}
139Dot {
140 name Dot12
141 tile_color 0xff0000ff
142 label "denoise\n"
143 note_font "Verdana Italic"
144 note_font_size 16
145 selected true
146 xpos -175
147 ypos -205
148}
149Dot {
150 name Dot10
151 tile_color 0xff0000ff
152 label denoise
153 note_font "Verdana Italic"
154 note_font_size 16
155 selected true
156 xpos -264
157 ypos 786
158 hide_input true
159}
160PostageStamp {
161 name PostageStamp2
162 selected true
163 xpos -298
164 ypos 863
165 postage_stamp true
166}
167Dot {
168 name Dot13
169 selected true
170 xpos -264
171 ypos 955
172}
173set N4f748000 [stack 0]
174push $cut_paste_input
175Group {
176 name VoronoiGradient1
177 knobChanged "\n\nimport random\nfrom math import sqrt\n\n################\n##Script Start##\n################ \n \nn = nuke.thisNode() #the node\nk = nuke.thisKnob() #the knob\nkn = k.name() #the knob name\n\nprint (\"Knob name: \"+kn)\n\nif kn == \"type\":\n if n\['type'].getValue() == 0: #generate\n n\['sample_radius'].setVisible(False)\n n\['generate_format'].setVisible(True)\n else: #sample\n n\['generate_format'].setVisible(False)\n n\['sample_radius'].setVisible(True)\n \nif kn == \"method\":\n if n\['method'].getValue() == 0: #voronoi\n n\['speedup'].setVisible(False)\n n\['aa'].setVisible(True)\n else: #NNI\n n\['aa'].setVisible(False)\n n\['speedup'].setVisible(True)\n\n#############\n##Add Point##\n#############\n\nif kn == \"add_point\":\n count = 0\n found = False\n i = 1\n\n #Find the earliest available knob\n while found == False:\n try:\n n\[\"pos_\"+str(i)]\n except NameError:\n found = True\n count = i\n else:\n i += 1\n\n divider = nuke.Text_Knob('divider_'+str(count), ' ')\n position = nuke.XY_Knob('pos_'+str(count), 'Position')\n remove = nuke.PyScript_Knob('remove_'+str(count), 'Remove this Point', '')\n color = nuke.AColor_Knob('color_'+str(count), 'Color')\n #weight = nuke.Double_Knob('weight_'+str(count), 'Weight')\n\n remove.setFlag(0x00002000) #no new line\n\n n.addKnob(divider)\n n.addKnob(position)\n n.addKnob(remove)\n n.addKnob(color)\n \n #Set a random color at point creation\n randomColor = \[random.uniform(0, 1),random.uniform(0, 1),random.uniform(0, 1),0]\n randomColor\[random.randint(0, 2)] = 1\n color.setValue(randomColor)\n\n #n.addKnob(weight)\n #weight.setRange(0,5)\n #weight.setValue(1)\n \n \n################\n##Remove Point##\n################\n\nif kn\[0:7] == \"remove_\":\n id = str(kn\[7:])\n \n n.removeKnob(knobs\['divider_'+id])\n n.removeKnob(knobs\['pos_'+id])\n n.removeKnob(knobs\['remove_'+id])\n n.removeKnob(knobs\['color_'+id])\n #n.removeKnob(knobs\['weight_'+id])\n \n #Removing a point does not rename/reorder the pointlist.\n #This is for consistency reasons.\n \n####################\n##Update Pointlist##\n####################\n\nknobs = n.knobs() #knoblist\n\n#Calculate the triangulation only when a point is moved, added or removed\nif kn\[0:7] == \"remove_\" or kn == \"add_point\":\n points_orig = \[]\n \n #iterate through all knobs. If a position knob is found, append to pointlist\n for knob in knobs:\n if knob\[0:4] == \"pos_\":\n id = int(knob\[4:])\n points_orig.append(id)\n \n \n points_orig.sort()\n \n points = ','.join(str(i) for i in points_orig)\n n\['points'].setValue(points)\n"
178 tile_color 0xffb300ff
179 label "\[llength \[split \[value this.points] ,]] Points"
180 selected true
181 xpos 420
182 ypos -17
183 addUserKnob {20 User}
184 addUserKnob {26 title l "" +STARTLINE T "<font color=#ff8300 size=\"7\">Voronoi Gradient</font><font color=#ff8300 size=\"2\"> v1.2</font>"}
185 addUserKnob {26 description l "" +STARTLINE T "<font color=#ff8300 size=\"2\">by Nikolai Wüstemann</font>"}
186 addUserKnob {26 spacer_00 l "" +STARTLINE T " "}
187 addUserKnob {26 divider_general l "<b><font color=#ffd228>General</font><b>"}
188 addUserKnob {4 type l Type M {Generate Sample}}
189 addUserKnob {17 generate_format l Format}
190 generate_format "1920 1080 0 0 1920 1080 1 HD_1080"
191 addUserKnob {3 sample_radius l "Sample Radius" t "When Type is set to \"Sample\".\nBlurs the input image by this amount and samples the pixel at given position." +HIDDEN}
192 sample_radius 5
193 addUserKnob {14 boundingbox l "Add Bounding Box" R 0.000000000e+00 1.000000000e+02}
194 addUserKnob {26 spacer_01 l "" +STARTLINE T " "}
195 addUserKnob {26 divider_method l "<b><font color=#ffd228>Method</font><b>"}
196 addUserKnob {4 method l Output M {"Voronoi Diagram" "Natural Neighbor Interpolation"}}
197 method "Natural Neighbor Interpolation"
198 addUserKnob {7 aa l Anti-Aliasing t "Anti-Aliasing Levels. The image ist scaled up by this amount, the calculation is done, and the image is scaled down to original size again." +HIDDEN R 1.000000000e+00 4.000000000e+00}
199 aa 2
200 addUserKnob {7 speedup l Optimization t "Reduces the image scale by the selected amount and scales up afterwards. For smooth gradients this is a great optimization that comes at hardly no cost." R 1.000000000e+00 1.000000000e+01}
201 speedup 5
202 addUserKnob {41 colorspace l Colorspace t "Linear: Mathematical way\nsRGB: More natural falloff\nL*a*b*: Less grey areas\nHSV: Interpolate over spectrum" T ColorspaceForth.colorspace_out}
203 addUserKnob {26 spacer_02 l "" +STARTLINE T " "}
204 addUserKnob {26 divider_points l "<b><font color=#ffd228>Points</font><b>"}
205 addUserKnob {22 add_point l "Add Point" +STARTLINE}
206 addUserKnob {1 points l INVISIBLE +INVISIBLE}
207 points 1,2,3,4,5,6,7,8
208 addUserKnob {26 divider_1 l " "}
209 addUserKnob {12 pos_1 l Position}
210 pos_1 {1.0885000000e+03 1034}
211 addUserKnob {22 remove_1 l "Remove this Point" -STARTLINE}
212 addUserKnob {19 color_1 l Color}
213 color_1 {6.0688745975e-01 9.9670904875e-01 7.0876777172e-01 0}
214 addUserKnob {6 color_1_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
215 addUserKnob {6 color_1_panelDropped_1 l "panel dropped state" -STARTLINE +HIDDEN}
216 addUserKnob {6 color_2_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
217 addUserKnob {6 color_2_panelDropped_1 l "panel dropped state" -STARTLINE +HIDDEN}
218 addUserKnob {6 color_3_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
219 addUserKnob {6 color_3_panelDropped_1 l "panel dropped state" -STARTLINE +HIDDEN}
220 addUserKnob {6 color_4_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
221 addUserKnob {6 color_4_panelDropped_1 l "panel dropped state" -STARTLINE +HIDDEN}
222 addUserKnob {26 divider_2 l " "}
223 addUserKnob {12 pos_2 l Position}
224 pos_2 {1.1815000000e+03 8.0050000000e+02}
225 addUserKnob {22 remove_2 l "Remove this Point" -STARTLINE}
226 addUserKnob {19 color_2 l Color}
227 color_2 {4.5568421483e-01 9.9697160721e-01 5.6396943331e-01 0}
228 addUserKnob {26 divider_3 l " "}
229 addUserKnob {12 pos_3 l Position}
230 pos_3 {1.0375999756e+03 6.1979998779e+02}
231 addUserKnob {22 remove_3 l "Remove this Point" -STARTLINE}
232 addUserKnob {19 color_3 l Color}
233 color_3 {3.6241182685e-01 9.9455803633e-01 4.5870316029e-01 0}
234 addUserKnob {26 divider_4 l " "}
235 addUserKnob {12 pos_4 l Position}
236 pos_4 {1.0468000488e+03 8.2540002441e+02}
237 addUserKnob {22 remove_4 l "Remove this Point" -STARTLINE}
238 addUserKnob {19 color_4 l Color}
239 color_4 {4.3025574088e-01 9.9668490887e-01 5.2764940262e-01 0}
240 addUserKnob {26 divider_5 l " "}
241 addUserKnob {12 pos_5 l Position}
242 pos_5 {1173 920}
243 addUserKnob {22 remove_5 l "Remove this Point" -STARTLINE}
244 addUserKnob {19 color_5 l Color}
245 color_5 {5.3948628902e-01 9.9717789888e-01 6.5083068609e-01 0}
246 addUserKnob {26 divider_6 l " "}
247 addUserKnob {12 pos_6 l Position}
248 pos_6 {1.7105000000e+03 8.4050000000e+02}
249 addUserKnob {22 remove_6 l "Remove this Point" -STARTLINE}
250 addUserKnob {19 color_6 l Color}
251 color_6 {3.0693605542e-01 8.6830288172e-01 4.0950050950e-01 0}
252 addUserKnob {26 divider_7 l " "}
253 addUserKnob {12 pos_7 l Position}
254 pos_7 {1816 644}
255 addUserKnob {22 remove_7 l "Remove this Point" -STARTLINE}
256 addUserKnob {19 color_7 l Color}
257 color_7 {3.1113982201e-01 9.1220980883e-01 4.2817741632e-01 0}
258 addUserKnob {26 divider_8 l " "}
259 addUserKnob {12 pos_8 l Position}
260 pos_8 {1839 973}
261 addUserKnob {22 remove_8 l "Remove this Point" -STARTLINE}
262 addUserKnob {19 color_8 l Color}
263 color_8 {2.8783413768e-01 8.4732413292e-01 4.0604355931e-01 0}
264}
265 Input {
266 inputs 0
267 name Input1
268 xpos 25
269 ypos -453
270 }
271 Dot {
272 name Dot4
273 xpos 59
274 ypos -287
275 }
276set N1c352700 [stack 0]
277 Dot {
278 name Dot1
279 xpos -323
280 ypos -287
281 }
282 Blur {
283 size {{"\[value this.parent.sample_radius]-1"}}
284 name SampleBlur
285 xpos -357
286 ypos -200
287 }
288 NoOp {
289 name sample_image
290 xpos -357
291 ypos -120
292 }
293 StickyNote {
294 inputs 0
295 name StickyNote1
296 label "Generate a Format"
297 xpos -120
298 ypos -1
299 }
300 StickyNote {
301 inputs 0
302 name StickyNote2
303 label "Use Input Format"
304 xpos 19
305 ypos -3
306 }
307 StickyNote {
308 inputs 0
309 name StickyNote9
310 label "Restore original colorspace"
311 xpos -120
312 ypos 1289
313 }
314 StickyNote {
315 inputs 0
316 name StickyNote3
317 label "Sample Input Colors"
318 xpos -366
319 ypos 4
320 }
321 StickyNote {
322 inputs 0
323 name StickyNote10
324 label "Copy Input Colors"
325 xpos -533
326 ypos 6
327 }
328 Crop {
329 inputs 0
330 box {0 0 2 {"\[llength \[split \[value this.parent.points] ,]]"}}
331 reformat true
332 crop false
333 name Crop_points_orig_1
334 xpos -443
335 ypos -39
336 }
337set N1eb06700 [stack 0]
338 Expression {
339 temp_name0 col_r
340 temp_expr0 "\[sample \[node sample_image] red \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].x] \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].y]] "
341 temp_name1 col_g
342 temp_expr1 "\[sample \[node sample_image] green \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].x] \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].y]] "
343 temp_name2 col_b
344 temp_expr2 "\[sample \[node sample_image] blue \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].x] \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].y]] "
345 temp_name3 col_a
346 temp_expr3 "\[sample \[node sample_image] alpha \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].x] \[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].y]] "
347 expr0 "x==0 && y==0 ? col_r : r"
348 expr1 "x==0 && y==0 ? col_g : g"
349 expr2 "x==0 && y==0 ? col_b : b"
350 channel3 alpha
351 expr3 "x==0 && y==0 ? col_a : a"
352 name Expression_SampleColor
353 label "Sample Color\n"
354 xpos -356
355 ypos 49
356 }
357push $N1eb06700
358 Expression {
359 temp_name0 col_r
360 temp_expr0 "\[value this.parent.color_\[lindex \[split \[value this.parent.points] ,] \[frame]].r]"
361 temp_name1 col_g
362 temp_expr1 "\[value this.parent.color_\[lindex \[split \[value this.parent.points] ,] \[frame]].g]"
363 temp_name2 col_b
364 temp_expr2 "\[value this.parent.color_\[lindex \[split \[value this.parent.points] ,] \[frame]].b]"
365 temp_name3 col_a
366 temp_expr3 "\[value this.parent.color_\[lindex \[split \[value this.parent.points] ,] \[frame]].a]"
367 expr0 "x==0 && y==0 ? col_r : r"
368 expr1 "x==0 && y==0 ? col_g : g"
369 expr2 "x==0 && y==0 ? col_b : b"
370 channel3 alpha
371 expr3 "x==0 && y==0 ? col_a : a"
372 name Expression_GenerateColor
373 label "Generate Color"
374 xpos -526
375 ypos 48
376 }
377 Switch {
378 inputs 2
379 which {{type}}
380 name Switch_Mode
381 label "Python Sample Evaluation"
382 xpos -439
383 ypos 161
384 }
385 set C1fc6b500 [stack 0]
386 Colorspace {
387 colorspace_out sRGB
388 name ColorspaceForth
389 knobChanged "id = nuke.thisNode().knob(\"colorspace_out\").getValue()\nnuke.toNode(\"ColorspaceBack\").knob(\"colorspace_in\").setValue(int(id))"
390 xpos -439
391 ypos 239
392 }
393 Expression {
394 temp_name0 scale
395 temp_expr0 method==0?(aa<1?1:aa):1/(speedup<1?1:speedup)
396 temp_name1 pos_x
397 temp_expr1 "\[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].x]"
398 temp_name2 pos_y
399 temp_expr2 "\[value this.parent.pos_\[lindex \[split \[value this.parent.points] ,] \[frame]].y]"
400 expr0 "x==1 && y==0 ? pos_x*scale : r"
401 expr1 "x==1 && y==0 ? pos_y*scale : g"
402 channel3 none
403 name Expression_Position
404 label "Set Position"
405 xpos -439
406 ypos 314
407 }
408 Transform {
409 translate {0 {"\[frame]"}}
410 center {1.5000000000e+00 1.5000000000e+00}
411 filter Impulse
412 name Transform_IteratePoints
413 xpos -439
414 ypos 499
415 }
416 TimeEcho {
417 mode Plus
418 framesbehind {{"\[llength \[split \[value this.parent.points] ,]]"}}
419 name TimeEcho_AddPoints
420 xpos -439
421 ypos 568
422 }
423 FrameHold {
424 first_frame {{"\[llength \[split \[value this.parent.points] ,]]-1"}}
425 name FrameHold_FetchPoints
426 xpos -439
427 ypos 638
428 }
429 Crop {
430 box {0 0 2 {"\[llength \[split \[value this.parent.points] ,]]"}}
431 name Crop_points_orig_2
432 xpos -439
433 ypos 717
434 }
435 PostageStamp {
436 name PostageStamp2
437 xpos -439
438 ypos 796
439 postage_stamp true
440 }
441 Dot {
442 name Dot9
443 xpos -64
444 ypos 823
445 }
446set N23977880 [stack 0]
447 Dot {
448 name Dot8
449 xpos 217
450 ypos 823
451 }
452push $N1c352700
453 Dot {
454 name Dot2
455 xpos 59
456 ypos 70
457 }
458 Constant {
459 inputs 0
460 channels rgb
461 format {{{this.parent.generate_format}}}
462 name Constant_Base
463 xpos -112
464 ypos 40
465 }
466clone $C1fc6b500 {
467 inputs 2
468 xpos -41
469 ypos 161
470 selected false
471 }
472 AdjBBox {
473 numpixels {{boundingbox(0)} {boundingbox(1)}}
474 name AdjBBox
475 xpos -41
476 ypos 217
477 }
478set N23976700 [stack 0]
479 Dot {
480 name Dot11
481 xpos 161
482 ypos 221
483 }
484 Reformat {
485 type scale
486 scale {{1/speedup}}
487 pbb true
488 name Downscale
489 xpos 127
490 ypos 282
491 }
492push $N23976700
493 Reformat {
494 type scale
495 scale {{aa}}
496 pbb true
497 name AA_Upscale
498 xpos -41
499 ypos 284
500 }
501 Switch {
502 inputs 2
503 which {{method}}
504 name Display_Switch1
505 label "\[value this.parent.method]"
506 xpos 46
507 ypos 404
508 }
509 Dot {
510 name Dot3
511 xpos 80
512 ypos 876
513 }
514set N1e071500 [stack 0]
515 BlinkScript {
516 inputs 2
517 recompileCount 221
518 ProgramGroup 1
519 KernelDescription "2 \"VoronoiDistanceKernel\" iterate pixelWise 15d1c287562f8940cc17093cf47955af451b3301bfa723a622b751a936460589 3 \"src\" Read Point \"points\" Read Random \"dst\" Write Point 0 0 0"
520 kernelSource "float distance(int2 q, float2 p)\{\n\treturn sqrt(pow(q.x - p.x, 2) + pow(q.y - p.y, 2));\n\}\n\nkernel VoronoiDistanceKernel : public ImageComputationKernel<ePixelWise>\n\{\n\tImage<eRead, eAccessPoint, eEdgeClamped> src;\n\tImage<eRead, eAccessRandom, eEdgeClamped> points;\n\tImage<eWrite> dst;\n\t\n\tvoid process(int2 pos)\{\n\t\tfloat dist = 999999;\n\t\tfloat dist_temp;\n\t\tfloat2 pnt;\n\t\t\n\t\tfor (int p = 0; p < points.bounds.height()-2; p = p+1)\{\n\t\t\tpnt.x = points(1, p, 0);\n\t\t\tpnt.y = points(1, p, 1);\n\t\t\tdist_temp = distance(pos, pnt);\n\t\t\tif(dist_temp < dist)\{\n\t\t\t\tdist = dist_temp;\n\t\t\t\}\n\t\t\}\n\t\t\n\t\tdst() = dist;\n\n\t\}\n\};"
521 rebuild ""
522 rebuild_finalise ""
523 name Voronoi_Distances
524 xpos 183
525 ypos 950
526 }
527push $N23977880
528push $N1e071500
529 BlinkScript {
530 inputs 2
531 recompileCount 226
532 ProgramGroup 1
533 KernelDescription "2 \"VoronoiKernel\" iterate pixelWise 8f93ca828d1e7eff617bbde89024638eccbd4d8a7ddca1d2a48549f3965171fa 3 \"src\" Read Point \"points\" Read Random \"dst\" Write Point 0 0 0"
534 kernelSource "float distance(int2 q, float2 p)\{\n\treturn sqrt(pow(q.x - p.x, 2) + pow(q.y - p.y, 2));\n\}\n\nkernel VoronoiKernel : public ImageComputationKernel<ePixelWise>\n\{\n\tImage<eRead, eAccessPoint, eEdgeClamped> src;\n\tImage<eRead, eAccessRandom, eEdgeClamped> points;\n\tImage<eWrite> dst;\n\n\tvoid process(int2 pos)\{\n\t\tint shortest = 0;\n\t\tfloat dist = 999999;\n\t\tfloat dist_temp;\n\t\tfloat2 pnt;\n\t\t\n\t\tfor (int p = 0; p < points.bounds.height()-2; p = p+1)\{\n\t\t\tpnt.x = points(1, p, 0);\n\t\t\tpnt.y = points(1, p, 1);\n\t\t\tdist_temp = distance(pos, pnt);\n\t\t\tif(dist_temp < dist)\{\n\t\t\t\tdist = dist_temp;\n\t\t\t\tshortest = p;\n\t\t\t\}\n\t\t\}\n\t\t\n\t\tdst() = points(0, shortest);\n\n\t\}\n\};"
535 rebuild ""
536 rebuild_finalise ""
537 name Voronoi_Diagram
538 xpos -98
539 ypos 950
540 }
541set N1e070e00 [stack 0]
542 BlinkScript {
543 inputs 2
544 recompileCount 256
545 ProgramGroup 1
546 KernelDescription "2 \"NNIKernel\" iterate pixelWise 84fc76da964c772bb539a89199ff299d702a7a2b0c7989aaf6f79ff0502b5e50 3 \"diagram\" Read Random \"distances\" Read Random \"dst\" Write Point 0 0 0"
547 kernelSource "float distance(int2 q, float2 p)\{\n\treturn sqrt(pow(q.x - p.x, 2) + pow(q.y - p.y, 2));\n\}\n\nkernel NNIKernel : public ImageComputationKernel<ePixelWise>\{\n\tImage<eRead, eAccessRandom, eEdgeClamped> diagram;\n\tImage<eRead, eAccessRandom, eEdgeClamped> distances;\n\tImage<eWrite> dst;\n\t\n\tvoid process(int2 pos)\{\n\t\tint x,y,dx,dy;\n\t\tfloat4 rgba = 0;\n\t\tint c = 0;\n\t\tbool found = true;\n\t\tfloat dist;\n\n\t\tfor(int i = diagram.bounds.x1; i < diagram.bounds.x2; i+=1)\{\n\t\t\tfor(int j = diagram.bounds.y1; j < diagram.bounds.y2; j+=1)\{\n\t\t\t\tif(distance(pos, float2(i,j)) <= distances(i, j, 0))\{\n\t\t\t\t\trgba += diagram(i, j);\n\t\t\t\t\tc += 1;\n\t\t\t\t\}\n\t\t\t\}\n\t\t\}\n\t\tdst() = rgba/c;\n\t\}\n\};"
548 rebuild ""
549 rebuild_finalise ""
550 name Natural_Neighbor_Interpolation
551 xpos 48
552 ypos 1100
553 disable {{method!=1?1:0}}
554 }
555 Colorspace {
556 colorspace_in sRGB
557 name ColorspaceBack
558 xpos 48
559 ypos 1293
560 }
561 set C1e070700 [stack 0]
562 Reformat {
563 type scale
564 scale {{speedup}}
565 filter Notch
566 pbb true
567 name Upscale
568 xpos 48
569 ypos 1350
570 }
571push $N1e070e00
572 Dot {
573 name Dot6
574 xpos -219
575 ypos 1108
576 }
577clone $C1e070700 {
578 xpos -253
579 ypos 1287
580 selected false
581 }
582 Reformat {
583 type scale
584 scale {{1/aa}}
585 pbb true
586 name AA_Downscale
587 xpos -253
588 ypos 1345
589 }
590 Switch {
591 inputs 2
592 which {{method}}
593 name Display_Switch
594 label "\[value this.parent.method]"
595 xpos -100
596 ypos 1478
597 }
598 Output {
599 name Output1
600 xpos -100
601 ypos 1658
602 }
603 StickyNote {
604 inputs 0
605 name StickyNote6
606 label "Stores the distance to the nex input point in each pixel. This will be used by the NNI"
607 xpos 340
608 ypos 956
609 }
610 StickyNote {
611 inputs 0
612 name StickyNote7
613 label "Stores the voronoi diagram"
614 xpos -264
615 ypos 954
616 }
617 StickyNote {
618 inputs 0
619 name StickyNote5
620 label "Natural Neighbor Interpolation\n\nThe algorithm scales exponentially with the image scale, so we try to keep the input as small as possible and scale up the result instead.\nThe node is disabled, when the Voronoi Diagram is shown. This prevents Nuke from executing the Natural Neighbor Interpolation algorithm in the background and crashing."
621 xpos 168
622 ypos 1097
623 }
624 StickyNote {
625 inputs 0
626 name StickyNote11
627 label "A little bit of Blinkscript magic!"
628 xpos 15
629 ypos 899
630 }
631 StickyNote {
632 inputs 0
633 name StickyNote4
634 label "Transform Sample data vertically,\nadd them up and framehold to\nfeed them into one image.\n(See Postage Stamp)\n\nWith this little hack we can add as many \ninput samples to the blinkscripts as we want."
635 xpos -677
636 ypos 796
637 }
638 StickyNote {
639 inputs 0
640 name StickyNote8
641 label "Restore original scaling"
642 xpos -112
643 ypos 1348
644 }
645 StickyNote {
646 inputs 0
647 name StickyNote12
648 label "Upscaling the interpolated result with the Notch filter \npreserves the smooth look and feel we want to achieve."
649 xpos 169
650 ypos 1344
651 }
652 StickyNote {
653 inputs 0
654 name StickyNote13
655 label "Upscale (for Voronoi Diaram Anti-Aliasing) or \nDownscale (for speed improvement on the Natural Neighbor Interpolation algorithm) \naccording to user inputs."
656 xpos 267
657 ypos 284
658 }
659end_group
660set N1c341000 [stack 0]
661push $N1b852380
662Dot {
663 name Dot1
664 selected true
665 xpos -4
666 ypos -136
667}
668set N1eae5c00 [stack 0]
669Dot {
670 name Dot2
671 selected true
672 xpos 304
673 ypos -136
674}
675IBKGizmoV3 {
676 inputs 2
677 name IBKGizmoV3_1
678 xpos 270
679 ypos -11
680 st C-green
681 colour {0 1 0}
682}
683Remove {
684 operation keep
685 channels alpha
686 name Remove1
687 selected true
688 xpos 270
689 ypos 15
690}
691Grade {
692 channels alpha
693 whitepoint 6.6000000000e-01
694 name Grade1
695 selected true
696 xpos 270
697 ypos 123
698}
699Dot {
700 name Dot3
701 selected true
702 xpos 304
703 ypos 182
704}
705set N1eae5500 [stack 0]
706Invert {
707 channels alpha
708 name Invert1
709 selected true
710 xpos 270
711 ypos 308
712}
713Shuffle {
714 red alpha
715 green alpha
716 blue alpha
717 name Shuffle1
718 selected true
719 xpos 270
720 ypos 378
721}
722Premult {
723 name Premult2
724 selected true
725 xpos 270
726 ypos 404
727}
728Group {
729 name X_Aton1
730 knobChanged "n = nuke.thisNode()\nif n\[\"use_3d\"].value()==1:\n n\[\"center\"].setEnabled(False)\nelse:\n n\[\"center\"].setEnabled(True)\nn\[\"iterations\"].setValue(int(n\[\"iterations\"].value()))\nif n\[\"mode\"].value()==\"Diffuse\":\n n\[\"diffuse\"].setEnabled(True)\nelse:\n n\[\"diffuse\"].setEnabled(False)\nn\[\"diffuse\"].setValue(max(n\[\"diffuse\"].value(),0))\nn\[\"iterations\"].setValue(max(n\[\"iterations\"].value(),1))"
731 selected true
732 xpos 270
733 ypos 462
734 addUserKnob {20 X_Aton}
735 addUserKnob {41 "Local GPU: " T BlinkScript1.gpuName}
736 addUserKnob {41 "Use GPU if Available" T BlinkScript1.useGPUIfAvailable}
737 addUserKnob {26 ""}
738 addUserKnob {12 center t "The point from which rays will be emitted."}
739 center {2170 2990}
740 addUserKnob {6 use_3d l "use 3d input" t "Use a <b>3D light</b> and a <b>3D camera</b> to calculate the center of the light. When enabled the <b>center</b> parameter will be disabled. Make sure both inputs (Light and Camera) are connected in order for this to work properly." -STARTLINE}
741 addUserKnob {7 length t "This controls zoom of the final iteration. A value of 0 won't have any effect. A value of -1 will converge all rays in the centre point. All positive values will create rays projected outwards." R 0.000000000e+00 1.000000000e+01}
742 length 2
743 addUserKnob {26 ""}
744 addUserKnob {4 mode t "- <b>Regular</b>, old school God Ray algorithm. All samples get added together. Fast and simple.\n- <b>Brighter</b>, samples only contribute to the ray if they are brighter than the ray at that step. This creates unshadowed rays.\n- <b>Darker</b>, samples only contribute to the ray if they are darker than the say at that step. This generate only shadow rays.\n- <b>Diffused</b>, different model of ray generation where rays can defocus as they travel further. This is more expensive but often generates more natural results." M {Regular Darkest Brightest Diffuse ""}}
745 addUserKnob {7 decay t "The rate by which rays loose intensity and become darker. At 0 rays intensity will remain constant. Values between 1 and 2 generate realistic results. Denser atmospheres create shorter rays (more decay)." R 0.000000000e+00 1.000000000e+01}
746 decay 25
747 addUserKnob {7 diffuse t "This parameter is only enabled when <b>Diffuse</b> is selected as the <b>mode</b>.<br>Controls the rate of dispersion of the ray of light. Higher values create softer results. <br>Keep in mind in the real world this value is dependent on the shape of the light source. Wide light sources (like a campfire) generate very diffused rays, whereas concentrated lights (like a cellphone light) cast very sharp light rays. <br>The speed of the algorithm is independent of the value of diffusion." +DISABLED R 0.000000000e+00 1.000000000e+02}
748 diffuse 50
749 addUserKnob {26 ""}
750 addUserKnob {18 multiply t "Makes everything brighter or darker in a linear fashion." R 2.000000000e-01 4.000000000e+00}
751 multiply 1
752 addUserKnob {6 multiply_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
753 addUserKnob {6 multiply_panelDropped_1 l "panel dropped state" -STARTLINE +HIDDEN}
754 addUserKnob {18 gamma t "This works slightly different than just a regular gamma. This is both a pre-process and a post-process.\n\nFirst, the image gets applied the inverse of the gamma. After the rays have been generated, the value of gamma gets applied again.\n\nWith a little bit of practise this allows you to drive the colours of the rays as they decay." R 2.000000000e-01 4.000000000e+00}
755 gamma 1
756 addUserKnob {6 gamma_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
757 addUserKnob {6 gamma_panelDropped_1 l "panel dropped state" -STARTLINE +HIDDEN}
758 addUserKnob {26 ""}
759 addUserKnob {7 iterations t "The number of steps the light ray will take. The more <b>iterations</b>, the softer the ray will be. It is a good practice to raise this value to a high number (100-500) and gradually decreasing it until artifacts start to appear. Sometimes artifacts can be fixed in a more optimized way by keeping iterations low and enabling <b>bilinear interpolation</b>.<br>The more iterations, the slower the algorithm." R 1.000000000e+00 1.000000000e+02}
760 iterations 200
761 addUserKnob {6 bilinear_interpolation l "bilinear interpolation" t "By default each ray will sample the nearest pixel from the image. This often causes grid artifacts. Enabling this filtering should fix most of these issues. If it's not enough, you may need to increase the number of <b>iterations</b>. This is usually only needed when using <b>Diffuse</b> rays, altough the option is also available for the rest of modes." +STARTLINE}
762 addUserKnob {6 normalize l "normalize luma" t "Many settings can affect the final brightness of the rays: their length, their decay, the number of iterations,etc.\n\nThis tries to make the controls more intuitive by compensating those brightness changes. You can disable this to have a more direct control of the tool." -STARTLINE}
763 normalize true
764 addUserKnob {26 ""}
765 addUserKnob {20 GPU_Settings l "GPU Settings"}
766 addUserKnob {41 maxGPUMemory l "Percentage of GPU memory to use" T BlinkScript1.maxGPUMemory}
767 addUserKnob {41 maxTileLines l "Percentage of image height per tile" T BlinkScript1.maxTileLines}
768 addUserKnob {20 about l About}
769 addUserKnob {26 about_1 l "" t "A bunny:\n(\\(\\ \n( - -)\n((') (')" +STARTLINE T "<br>\n<b>Xavier Martín © 2017</b>"}
770 addUserKnob {26 ""}
771 addUserKnob {26 website l "" +STARTLINE T "<a href=\"http://www.xaviermartinvfx.com\"><span style=\"color:#C8C8C8;\">www.xaviermartinvfx.com</span></a>"}
772 addUserKnob {26 space4_1 l "" +STARTLINE T <br>}
773 addUserKnob {22 version l <center>version</center> T "nuke.message('X_Aton Gizmo <i>v1.1</i><br><b>Xavier Martín © 2017</b>')" +STARTLINE}
774 addUserKnob {22 help_documentation l <center>?</center> -STARTLINE T "nuke.message('You can find more documentation<br>on <a href=\"http://www.nukepedia.com/blink/filter/x_aton\"><span style=\"color:#BCBCBC;\">Nukepedia</span></a> or my <a href=\"http://www.xaviermartinvfx.com/x_aton/\"><span style=\"color:#BCBCBC;\">website</span></a>.')"}
775}
776 Input {
777 inputs 0
778 name Input
779 xpos -740
780 ypos -558
781 }
782 Dot {
783 name Dot3
784 xpos -706
785 ypos -506
786 }
787set N21635880 [stack 0]
788 Remove {
789 operation keep
790 channels rgba
791 name Remove1
792 xpos -740
793 ypos -460
794 }
795 Gamma {
796 channels rgb
797 value {{1/parent.gamma} {1/parent.gamma} {1/parent.gamma} 1}
798 name Gamma1
799 xpos -740
800 ypos -410
801 }
802set N21635180 [stack 0]
803 Dot {
804 name Dot2
805 xpos -706
806 ypos -356
807 }
808set N21634e00 [stack 0]
809 Dot {
810 name Dot1
811 xpos -706
812 ypos -306
813 }
814set N21634a80 [stack 0]
815push $N21634e00
816 Blur {
817 channels rgba
818 size {{diffuse*sqrt(length)}}
819 name Blur5
820 xpos -240
821 ypos -313
822 }
823 CopyBBox {
824 inputs 2
825 name CopyBBox2
826 xpos -240
827 ypos -258
828 }
829 Reformat {
830 type scale
831 scale 1.2500000000e-01
832 pbb true
833 name Reformat1
834 xpos -240
835 ypos -210
836 }
837set N21634000 [stack 0]
838push $N21634a80
839push $N21634e00
840 Blur {
841 channels rgba
842 size {{parent.Blur5.size/2}}
843 name Blur4
844 xpos -340
845 ypos -310
846 }
847 CopyBBox {
848 inputs 2
849 name CopyBBox3
850 xpos -340
851 ypos -258
852 }
853 Reformat {
854 type scale
855 scale 2.5000000000e-01
856 pbb true
857 name Reformat5
858 xpos -340
859 ypos -210
860 }
861set N1f579500 [stack 0]
862push $N21634a80
863push $N21634e00
864 Blur {
865 channels rgba
866 size {{parent.Blur4.size/2}}
867 name Blur3
868 xpos -440
869 ypos -310
870 }
871 CopyBBox {
872 inputs 2
873 name CopyBBox4
874 xpos -440
875 ypos -258
876 }
877 Reformat {
878 type scale
879 scale 5.0000000000e-01
880 pbb true
881 name Reformat4
882 xpos -440
883 ypos -210
884 }
885set N1f578a80 [stack 0]
886push $N21634a80
887push $N21634e00
888 Blur {
889 channels rgba
890 size {{parent.Blur3.size/2}}
891 name Blur2
892 xpos -540
893 ypos -310
894 }
895 CopyBBox {
896 inputs 2
897 name CopyBBox5
898 xpos -540
899 ypos -258
900 }
901 Reformat {
902 type scale
903 scale 6.0000000000e-01
904 pbb true
905 name Reformat3
906 xpos -540
907 ypos -210
908 }
909set N1f578000 [stack 0]
910push $N21634a80
911push $N21634e00
912 Blur {
913 channels rgb
914 size {{parent.Blur2.size/2}}
915 name Blur1
916 xpos -640
917 ypos -310
918 }
919 CopyBBox {
920 inputs 2
921 name CopyBBox1
922 xpos -640
923 ypos -258
924 }
925 Reformat {
926 type scale
927 scale 8.0000000000e-01
928 pbb true
929 name Reformat2
930 xpos -640
931 ypos -210
932 }
933set N1b707500 [stack 0]
934push $N21634a80
935 BlinkScript {
936 inputs 6
937 ProgramGroup 1
938 KernelDescription "2 \"X_Aton\" iterate componentWise 5140e5ada3150b5b17997b391784be72a8515242eff97b63a728e1d29924494f 7 \"src\" Read Random \"blr1\" Read Random \"blr2\" Read Random \"blr3\" Read Random \"blr4\" Read Random \"blr5\" Read Random \"dst\" Write Point 5 \"size\" Float 1 AAAAAA== \"center\" Float 2 AAAAAAAAAAA= \"iterations\" Int 1 AAAAAA== \"decay\" Float 1 AAAAAA== \"normalize_output\" Int 1 AAAAAA== 5 \"size\" 1 1 \"center\" 2 1 \"iterations\" 1 1 \"decay\" 1 1 \"normalize_output\" 1 1 1 \"normal\" Float 1 1 AAAAAA=="
939 kernelSource "kernel X_Aton : ImageComputationKernel<eComponentWise>\n\{\n Image<eRead, eAccessRandom, eEdgeClamped> src; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr1; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr2; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr3; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr4; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr5; // the input image\n\n Image<eWrite> dst; // the output image\n\n param:\n float size;\n float2 center;\n int iterations;\n float decay;\n int normalize_output;\n\n local:\n float normal = 0.0f;\n\n void init() \{\n if(normalize_output == 1) \{\n normal =0.0;\n for (int i = 0; i < iterations; i++) \{\n normal += (pow(1.0f-float(i)/iterations,decay));\n \}\n \}\n else \{\n normal = iterations;\n \}\n \}\n\n void process(int2 pos) \{\n float total = 0.0;\n float scale = 0.0;\n int posx = 0;\n int posy = 0;\n int2 currentpos = int2(pos.x-center.x,pos.y-center.y);\n \n float step = 0.0;\n for (int i = 0; i < iterations; i++) \{\n step = float(i)/iterations;\n scale = 1+size*step*step;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n if (step < 0.1)\n total += bilinear(src,posx,posy)*pow((1-step),decay);\n else if (step < 0.2)\n total += bilinear(blr1,posx*0.8,posy*0.8)*pow((1-step),decay);\n else if (step < 0.4)\n total += bilinear(blr2,posx*0.6,posy*0.6)*pow((1-step),decay);\n else if (step < 0.6)\n total += bilinear(blr3,posx*0.5,posy*0.5)*pow((1-step),decay);\n else if (step < 0.8)\n total += bilinear(blr4,posx*0.25,posy*0.25)*pow((1-step),decay);\n else\n total += bilinear(blr5,posx*0.125,posy*0.125)*pow((1-step),decay);\n \}\n dst() = total/normal;\n \}\n\};"
940 useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
941 rebuild ""
942 X_Aton_size {{parent.length}}
943 X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
944 X_Aton_iterations {{parent.iterations}}
945 X_Aton_decay {{parent.decay}}
946 X_Aton_normalize_output {{parent.normalize}}
947 rebuild_finalise ""
948 maxTileLines 100
949 name BlinkScript2
950 xpos -640
951 ypos -116
952 }
953push $N21634000
954push $N1f579500
955push $N1f578a80
956push $N1f578000
957push $N1b707500
958push $N21634a80
959 BlinkScript {
960 inputs 6
961 ProgramGroup 1
962 KernelDescription "2 \"X_Aton\" iterate componentWise e94f08f291fbc4837d066b1a66504220d926ab715f7f89378491e8b275e0f94c 7 \"src\" Read Random \"blr1\" Read Random \"blr2\" Read Random \"blr3\" Read Random \"blr4\" Read Random \"blr5\" Read Random \"dst\" Write Point 5 \"size\" Float 1 AAAAAA== \"center\" Float 2 AAAAAAAAAAA= \"iterations\" Int 1 AAAAAA== \"decay\" Float 1 AAAAAA== \"normalize_output\" Int 1 AAAAAA== 5 \"size\" 1 1 \"center\" 2 1 \"iterations\" 1 1 \"decay\" 1 1 \"normalize_output\" 1 1 1 \"normal\" Float 1 1 AAAAAA=="
963 kernelSource "kernel X_Aton : ImageComputationKernel<eComponentWise>\n\{\n Image<eRead, eAccessRandom, eEdgeClamped> src; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr1; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr2; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr3; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr4; // the input image\n Image<eRead, eAccessRandom, eEdgeClamped> blr5; // the input image\n\n Image<eWrite> dst; // the output image\n\n param:\n float size;\n float2 center;\n int iterations;\n float decay;\n int normalize_output;\n\n local:\n float normal = 0.0f;\n\n void init() \{\n if(normalize_output == 1) \{\n normal =0.0;\n for (int i = 0; i < iterations; i++) \{\n normal += (pow(1.0f-float(i)/iterations,decay));\n \}\n \}\n else \{\n normal = iterations;\n \}\n \}\n\n void process(int2 pos) \{\n float total = 0.0;\n float scale = 0.0;\n int posx = 0;\n int posy = 0;\n int2 currentpos = int2(pos.x-center.x,pos.y-center.y);\n \n float step = 0.0;\n for (int i = 0; i < iterations; i++) \{\n step = float(i)/iterations;\n scale = 1+size*step*step;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n if (step < 0.1)\n total += src(posx,posy)*pow((1-step),decay);\n else if (step < 0.2)\n total += blr1((posx*0.8),(posy*0.8))*pow((1-step),decay);\n else if (step < 0.4)\n total += blr2((posx*0.6),(posy*0.6))*pow((1-step),decay);\n else if (step < 0.6)\n total += blr3((posx*0.5),(posy*0.5))*pow((1-step),decay);\n else if (step < 0.8)\n total += blr4((posx*0.25),(posy*0.25))*pow((1-step),decay);\n else\n total += blr5((posx*0.125),(posy*0.125))*pow((1-step),decay);\n \}\n dst() = total/normal;\n \}\n\};"
964 rebuild ""
965 X_Aton_size {{length}}
966 X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
967 X_Aton_iterations {{iterations}}
968 X_Aton_decay {{decay}}
969 X_Aton_normalize_output {{normalize}}
970 rebuild_finalise ""
971 maxTileLines 100
972 name BlinkScript1
973 onCreate "n = nuke.thisNode()\nn\[\"X_Aton_center\"].setFlag(0x00008000)"
974 selected true
975 xpos -740
976 ypos -116
977 }
978 Switch {
979 inputs 2
980 which {{parent.bilinear_interpolation}}
981 name Switch2
982 xpos -740
983 ypos -60
984 }
985push $N21635180
986 Dot {
987 name Dot6
988 xpos -806
989 ypos -406
990 }
991 Dot {
992 name Dot8
993 xpos -806
994 ypos -156
995 }
996set N1b706380 [stack 0]
997 Dot {
998 name Dot7
999 xpos -906
1000 ypos -156
1001 }
1002 BlinkScript {
1003 ProgramGroup 1
1004 KernelDescription "2 \"X_Aton\" iterate componentWise 487f2268501f808ca51782f791e12713f7866399dc695919d23851a93187e87b 2 \"src\" Read Random \"dst\" Write Point 6 \"size\" Float 1 AAAAAA== \"center\" Float 2 AAAAAAAAAAA= \"iterations\" Int 1 AAAAAA== \"decay\" Float 1 AAAAAA== \"normalize_output\" Int 1 AAAAAA== \"mode\" Int 1 AAAAAA== 6 \"size\" 1 1 \"center\" 2 1 \"iterations\" 1 1 \"decay\" 1 1 \"normalize_output\" 1 1 \"mode\" 1 1 1 \"normal\" Float 1 1 AAAAAA=="
1005 kernelSource "kernel X_Aton : ImageComputationKernel<eComponentWise>\n\{\n Image<eRead, eAccessRandom, eEdgeClamped> src; // the input image\n\n\n Image<eWrite> dst; // the output image\n\n param:\n float size;\n float2 center;\n int iterations;\n float decay;\n int normalize_output;\n int mode;\n local:\n float normal = 0.0f;\n\n void init() \{\n if(mode==0) \{\n if(normalize_output == 1) \{\n normal =0.0;\n for (int i = 0; i < iterations; i++) \{\n normal += (pow(1.0f-float(i)/iterations,decay));\n \}\n \}\n else \{\n normal = iterations;\n \}\n \}\n \}\n\n void process(int2 pos) \{\n float total = 0.0f;\n float scale = 0.0f;\n float posx = 0.0f;\n float posy = 0.0f;\n float2 currentpos = float2(pos.x-center.x,pos.y-center.y);\n\n if(mode==0)\{\n for (int i = 0; i < iterations; i++) \{\n scale = 1+size*i*i/iterations/iterations;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n total += bilinear(src,posx,posy)*pow((1-float(i)/iterations),decay);\n \}\n dst() = total/normal;\n \}\n else if(mode==1)\{\n float sample;\n float norm = 1.0;\n total += src(pos.x,pos.y);\n for (int i = 1; i < iterations; i++) \{\n scale = 1+size*i*i/iterations/iterations;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n sample = bilinear(src,posx,posy);\n if(sample<total/norm) \{\n total += sample*pow((1-float(i)/iterations),decay);\n \}\n else\n total += (total/norm)*pow((1-float(i)/iterations),decay);\n norm += 1.0*pow((1-float(i)/iterations),decay);\n \}\n if(normalize_output==0)\n dst() = total/iterations;\n else\n dst() = total/norm;\n \}\n else \{\n float sample;\n float norm = 1.0;\n total += src(pos.x,pos.y);\n for (int i = 1; i < iterations; i++) \{\n scale = 1+size*i*i/iterations/iterations;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n sample = bilinear(src,posx,posy);\n if(sample>total/norm) \{\n total += sample*pow((1-float(i)/iterations),decay);\n \}\n else\n total += (total/norm)*pow((1-float(i)/iterations),decay);\n norm += 1.0*pow((1-float(i)/iterations),decay);\n \}\n if(normalize_output==0)\n dst() = total/iterations;\n else\n dst() = total/norm;\n \}\n \}\n\};\n"
1006 useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
1007 rebuild ""
1008 X_Aton_size {{length}}
1009 X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
1010 X_Aton_iterations {{iterations}}
1011 X_Aton_decay {{decay}}
1012 X_Aton_normalize_output {{normalize}}
1013 X_Aton_mode {{(parent.mode!=3)?parent.mode:parent.mode*(parent.diffuse!=0)}}
1014 rebuild_finalise ""
1015 maxTileLines 100
1016 name BlinkScript4
1017 xpos -940
1018 ypos -116
1019 }
1020push $N1b706380
1021 BlinkScript {
1022 ProgramGroup 1
1023 KernelDescription "2 \"X_Aton\" iterate componentWise 8ab15b8bdd9694a8f64ba7270da748947d286719d2fadccab9e45b58ec1aa1dd 2 \"src\" Read Random \"dst\" Write Point 6 \"size\" Float 1 AAAAAA== \"center\" Float 2 AAAAAAAAAAA= \"iterations\" Int 1 AAAAAA== \"decay\" Float 1 AAAAAA== \"normalize_output\" Int 1 AAAAAA== \"mode\" Int 1 AAAAAA== 6 \"size\" 1 1 \"center\" 2 1 \"iterations\" 1 1 \"decay\" 1 1 \"normalize_output\" 1 1 \"mode\" 1 1 1 \"normal\" Float 1 1 AAAAAA=="
1024 kernelSource "kernel X_Aton : ImageComputationKernel<eComponentWise>\n\{\n Image<eRead, eAccessRandom, eEdgeClamped> src; // the input image\n\n\n Image<eWrite> dst; // the output image\n\n param:\n float size;\n float2 center;\n int iterations;\n float decay;\n int normalize_output;\n int mode;\n local:\n float normal = 0.0f;\n\n void init() \{\n if(mode==0) \{\n if(normalize_output == 1) \{\n normal =0.0;\n for (int i = 0; i < iterations; i++) \{\n normal += (pow(1.0f-float(i)/iterations,decay));\n \}\n \}\n else \{\n normal = iterations;\n \}\n \}\n \}\n\n void process(int2 pos) \{\n float total = 0.0;\n float scale = 0.0;\n int posx = 0;\n int posy = 0;\n int2 currentpos = int2(pos.x-center.x,pos.y-center.y);\n\n if(mode==0)\{\n for (int i = 0; i < iterations; i++) \{\n scale = 1+size*i*i/iterations/iterations;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n total += src(posx,posy)*pow((1-float(i)/iterations),decay);\n \}\n dst() = total/normal;\n \}\n else if(mode==1)\{\n float sample;\n float norm = 1.0;\n total += src(pos.x,pos.y);\n for (int i = 1; i < iterations; i++) \{\n scale = 1+size*i*i/iterations/iterations;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n sample = src(posx,posy);\n if(sample<total/norm) \{\n total += sample*pow((1-float(i)/iterations),decay);\n \}\n else\n total += (total/norm)*pow((1-float(i)/iterations),decay);\n norm += pow((1.0f-float(i)/iterations),decay);\n \}\n if(normalize_output==0)\n dst() = total/iterations;\n else\n dst() = total/norm;\n \}\n else \{\n float sample;\n float norm = 1.0;\n total += src(pos.x,pos.y);\n for (int i = 1; i < iterations; i++) \{\n scale = 1+size*i*i/iterations/iterations;\n posx = ((currentpos.x)/scale+center.x);\n posy = ((currentpos.y)/scale+center.y);\n sample = src(posx,posy);\n if(sample>total/norm) \{\n total += sample*pow((1-float(i)/iterations),decay);\n \}\n else\n total += (total/norm)*pow((1-float(i)/iterations),decay);\n norm += pow((1.0f-float(i)/iterations),decay);\n \}\n if(normalize_output==0)\n dst() = total/iterations;\n else\n dst() = total/norm;\n \}\n \}\n\};\n"
1025 useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
1026 rebuild ""
1027 X_Aton_size {{length}}
1028 X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
1029 X_Aton_iterations {{iterations}}
1030 X_Aton_decay {{decay}}
1031 X_Aton_normalize_output {{normalize}}
1032 X_Aton_mode {{(parent.mode!=3)?parent.mode:parent.mode*(parent.diffuse!=0)}}
1033 rebuild_finalise ""
1034 maxTileLines 100
1035 name BlinkScript3
1036 xpos -840
1037 ypos -116
1038 }
1039 Switch {
1040 inputs 2
1041 which {{parent.bilinear_interpolation}}
1042 name Switch3
1043 xpos -840
1044 ypos -60
1045 }
1046 Switch {
1047 inputs 2
1048 which {{(mode==3)*(diffuse!=0)}}
1049 name Switch1
1050 xpos -740
1051 ypos -10
1052 }
1053 Grade {
1054 multiply {{1/parent.multiply} {1/parent.multiply} {1/parent.multiply} 1}
1055 gamma {{1/parent.gamma} {1/parent.gamma} {1/parent.gamma} 1}
1056 reverse true
1057 name Grade1
1058 xpos -740
1059 ypos 40
1060 }
1061push $N21635880
1062 Dot {
1063 name Dot5
1064 xpos -1006
1065 ypos -506
1066 }
1067 Dot {
1068 name Dot4
1069 xpos -1006
1070 ypos 94
1071 }
1072 Merge2 {
1073 inputs 2
1074 operation copy
1075 name Merge1
1076 xpos -740
1077 ypos 88
1078 }
1079 Output {
1080 name Output1
1081 xpos -740
1082 ypos 140
1083 }
1084 Input {
1085 inputs 0
1086 name InputLight
1087 xpos -540
1088 ypos -560
1089 number 1
1090 }
1091 Input {
1092 inputs 0
1093 name InputCamera
1094 xpos -440
1095 ypos -560
1096 number 2
1097 }
1098 Dot {
1099 name Dot11
1100 xpos -406
1101 ypos -456
1102 }
1103push $N21635880
1104 Dot {
1105 name Dot9
1106 xpos -606
1107 ypos -506
1108 }
1109 Dot {
1110 name Dot10
1111 xpos -606
1112 ypos -456
1113 }
1114 Reconcile3D {
1115 inputs 3
1116 calc_output true
1117 name Reconcile3D1
1118 xpos -540
1119 ypos -466
1120 }
1121end_group
1122push $N1eae5500
1123push $N1eae5c00
1124Group {
1125 name DespillMadness
1126 note_font "Bitstream Vera Sans"
1127 selected true
1128 xpos -38
1129 ypos 37
1130 mapsize {1.5000000000e-01 1.5000000000e-01}
1131 addUserKnob {20 DespillMadness l "Despill Settings"}
1132 addUserKnob {41 screenType l "screen type" T GizmoControl.screenType}
1133 addUserKnob {41 algorithm l "despill algorithm" T GizmoControl.algorithm}
1134 addUserKnob {41 LimitPercentage l "fine tune" T RedLimitsGreen.LimitPercentage}
1135 addUserKnob {26 ""}
1136 addUserKnob {26 text_2 l "" +STARTLINE T "spill area correction"}
1137 addUserKnob {26 spacer l " " T " "}
1138 addUserKnob {6 sourceLuma l "restore source luminance" t "Restores luminance of original image." +STARTLINE}
1139 sourceLuma true
1140 addUserKnob {41 saturation T CC_SpillMap.saturation}
1141 addUserKnob {41 gamma T CC_SpillMap.gamma}
1142 addUserKnob {41 offset T CC_SpillMap.offset}
1143 addUserKnob {26 ""}
1144 addUserKnob {41 spillMatteOut l "output spill matte in alpha" T GizmoControl.spillMatteOut}
1145 addUserKnob {26 ""}
1146 addUserKnob {41 maskChannel l mask T KeymixMask.maskChannel}
1147 addUserKnob {6 invmsk l invert -STARTLINE}
1148 addUserKnob {41 which l mix T mix.which}
1149}
1150 Input {
1151 inputs 0
1152 name img
1153 xpos 262
1154 ypos -342
1155 }
1156 Dot {
1157 name Dot6
1158 xpos 296
1159 ypos -186
1160 }
1161set N1eae4a80 [stack 0]
1162 Dot {
1163 name Dot2
1164 xpos 296
1165 ypos -71
1166 }
1167set N1eae4700 [stack 0]
1168 Dot {
1169 name Dot3
1170 xpos 626
1171 ypos -71
1172 }
1173set N1eae4380 [stack 0]
1174 Expression {
1175 expr2 b>g*LimitPercentage?g*LimitPercentage:b
1176 expr3 b-g*LimitPercentage
1177 name GreenLimitsBlue1
1178 xpos 728
1179 ypos 44
1180 addUserKnob {20 User}
1181 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1182 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1183 }
1184push $N1eae4380
1185 Expression {
1186 expr2 b>r*LimitPercentage?r*LimitPercentage:b
1187 expr3 b-r*LimitPercentage
1188 name RedLimitsBlue
1189 xpos 592
1190 ypos 44
1191 addUserKnob {20 User}
1192 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1193 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1194 }
1195push $N1eae4380
1196 Expression {
1197 expr2 b>(g+2*r)/2*LimitPercentage?(g+2*r)/2*LimitPercentage:b
1198 expr3 b-(2*r+g)*LimitPercentage/2
1199 name DoubleRedAve2
1200 xpos 1125
1201 ypos 43
1202 addUserKnob {20 User}
1203 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1204 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1205 }
1206push $N1eae4380
1207 Expression {
1208 expr2 b>(2*g+r)/2*LimitPercentage?(2*g+r)/2*LimitPercentage:b
1209 expr3 b-(r+2*g)*LimitPercentage/2
1210 name DoubleGreenAve
1211 xpos 998
1212 ypos 44
1213 addUserKnob {20 User}
1214 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1215 LimitPercentage {{RedLimitsGreen.LimitPercentage}}
1216 }
1217push $N1eae4380
1218 Expression {
1219 expr2 b>(g+r)/2*LimitPercentage?(g+r)/2*LimitPercentage:b
1220 expr3 b-(r+g)*LimitPercentage/2
1221 name RedAndGreenLimitBlue
1222 xpos 862
1223 ypos 44
1224 addUserKnob {20 User}
1225 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1226 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1227 }
1228 Switch {
1229 inputs 5
1230 which {{GizmoControl.algorithm i}}
1231 name SwitchBlue
1232 xpos 728
1233 ypos 190
1234 }
1235 Dot {
1236 name Dot5
1237 xpos 762
1238 ypos 370
1239 }
1240push $N1eae4700
1241 Dot {
1242 name Dot1
1243 xpos 164
1244 ypos -71
1245 }
1246set N1fbb9500 [stack 0]
1247 Expression {
1248 expr1 g>b*LimitPercentage?b*LimitPercentage:g
1249 expr3 g-b*LimitPercentage
1250 name BlueLimitsGreen
1251 xpos -15
1252 ypos 44
1253 addUserKnob {20 User}
1254 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1255 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1256 }
1257push $N1fbb9500
1258 Expression {
1259 expr1 g>r*LimitPercentage?r*LimitPercentage:g
1260 expr3 g-r*LimitPercentage
1261 name RedLimitsGreen
1262 xpos -160
1263 ypos 44
1264 addUserKnob {20 User}
1265 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1266 LimitPercentage 1.2800000000e+00
1267 }
1268push $N1fbb9500
1269 Expression {
1270 expr1 g>(b+2*r)/3*LimitPercentage?(b+2*r)/3*LimitPercentage:g
1271 expr3 g-(r+b)*LimitPercentage/2
1272 name DoubleRedAve
1273 xpos 370
1274 ypos 42
1275 addUserKnob {20 User}
1276 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1277 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1278 }
1279push $N1fbb9500
1280 Expression {
1281 expr1 g>(2*b+r)/3*LimitPercentage?(2*b+r)/3*LimitPercentage:g
1282 expr3 g-(r+b)*LimitPercentage/2
1283 name DoubleBlueAve
1284 xpos 257
1285 ypos 42
1286 addUserKnob {20 User}
1287 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1288 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1289 }
1290push $N1fbb9500
1291 Expression {
1292 expr1 g>(b+r)/2*LimitPercentage?(b+r)/2*LimitPercentage:g
1293 expr3 g-(r+b)*LimitPercentage/2
1294 name RedAveBlueLimitsGreen
1295 xpos 130
1296 ypos 44
1297 addUserKnob {20 User}
1298 addUserKnob {7 LimitPercentage l "fine tune" R 5.000000000e-01 1.500000000e+00}
1299 LimitPercentage {{RedLimitsGreen.LimitPercentage i}}
1300 }
1301 Switch {
1302 inputs 5
1303 which {{GizmoControl.algorithm i}}
1304 name SwitchGreen
1305 xpos -15
1306 ypos 199
1307 }
1308 Dot {
1309 name Dot4
1310 xpos 19
1311 ypos 370
1312 }
1313 Switch {
1314 inputs 2
1315 which {{GizmoControl.screenType i}}
1316 name SwitchMain
1317 xpos 257
1318 ypos 366
1319 }
1320 Clamp {
1321 channels alpha
1322 name Clamp1
1323 xpos 257
1324 ypos 408
1325 }
1326 ColorCorrect {
1327 offset {1.5000000000e-01 -1.0000000000e-01 -3.0000000000e-02 0}
1328 maskChannelInput rgba.alpha
1329 name CC_SpillMap
1330 note_font Verdana
1331 xpos 257
1332 ypos 468
1333 }
1334set N256c4000 [stack 0]
1335 Dot {
1336 name Dot9
1337 xpos 440
1338 ypos 478
1339 }
1340 Dot {
1341 name Dot10
1342 xpos 440
1343 ypos 1389
1344 }
1345 Input {
1346 inputs 0
1347 name mask
1348 xpos -696
1349 ypos -348
1350 number 1
1351 }
1352 Expression {
1353 channel0 {-rgba.red -rgba.green -rgba.blue none}
1354 expr0 0
1355 channel1 {-rgba.red -rgba.green -rgba.blue none}
1356 expr1 0
1357 channel2 {-rgba.red -rgba.green -rgba.blue none}
1358 expr2 0
1359 channel3 {rgba.alpha none none rgba.alpha}
1360 expr3 a==0?0:a
1361 name AlphaFix1
1362 label "To avid Gizmo being in state of\nerror without something plugged in input."
1363 xpos -696
1364 ypos 861
1365 }
1366set N1b715180 [stack 0]
1367push $N1b715180
1368 Copy {
1369 inputs 2
1370 from0 rgba.alpha
1371 to0 rgba.alpha
1372 name CopyMask
1373 xpos -296
1374 ypos 867
1375 }
1376 Invert {
1377 name Invert1
1378 xpos -296
1379 ypos 943
1380 disable {{parent.invmsk i}}
1381 }
1382push $N1eae4a80
1383 Dot {
1384 name Dot7
1385 xpos -345
1386 ypos -186
1387 }
1388 Dot {
1389 name Dot8
1390 xpos -345
1391 ypos 551
1392 }
1393 Expression {
1394 channel0 {-rgba.red -rgba.green -rgba.blue none}
1395 expr0 0
1396 channel1 {-rgba.red -rgba.green -rgba.blue none}
1397 expr1 0
1398 channel2 {-rgba.red -rgba.green -rgba.blue none}
1399 expr2 0
1400 channel3 {rgba.alpha none none rgba.alpha}
1401 expr3 a==0?0:a
1402 name AlphaFix
1403 label "To avid Gizmo being in state of\nerror without something plugged in input."
1404 xpos -27
1405 ypos 534
1406 }
1407set N35927c00 [stack 0]
1408 Dot {
1409 name Dot11
1410 xpos -113
1411 ypos 614
1412 }
1413 Dot {
1414 name Dot12
1415 xpos -113
1416 ypos 818
1417 }
1418set N35927180 [stack 0]
1419push $N35927c00
1420push $N35927c00
1421push $N256c4000
1422 Copy {
1423 inputs 2
1424 from0 rgba.alpha
1425 to0 rgba.alpha
1426 from3 rgba.alpha
1427 to3 rgba.alpha
1428 name CopyAlpha
1429 xpos 257
1430 ypos 534
1431 }
1432set N35926e00 [stack 0]
1433 Merge2 {
1434 inputs 2
1435 operation minus
1436 name Merge3
1437 xpos -27
1438 ypos 672
1439 }
1440 Clamp {
1441 name Clamp2
1442 xpos -27
1443 ypos 698
1444 }
1445 Saturation {
1446 saturation 0
1447 name Saturation2
1448 xpos -27
1449 ypos 736
1450 }
1451push $N35926e00
1452 Merge2 {
1453 inputs 2
1454 operation plus
1455 name RestoreLuma
1456 xpos 257
1457 ypos 736
1458 disable {{!parent.sourceLuma i}}
1459 }
1460 Keymix {
1461 inputs 3
1462 maskChannel -rgba.alpha
1463 name KeymixMask
1464 xpos 257
1465 ypos 943
1466 }
1467push $N35927180
1468 Dot {
1469 name Dot13
1470 xpos -113
1471 ypos 1087
1472 }
1473 Dissolve {
1474 inputs 2
1475 which 1
1476 name mix
1477 xpos 257
1478 ypos 1077
1479 }
1480 Switch {
1481 inputs 2
1482 which {{GizmoControl.spillMatteOut i}}
1483 name SwitchSpillMap
1484 xpos 257
1485 ypos 1385
1486 }
1487 Output {
1488 name Output1
1489 xpos 257
1490 ypos 1485
1491 }
1492 NoOp {
1493 inputs 0
1494 name GizmoControl
1495 selected true
1496 xpos 875
1497 ypos 414
1498 addUserKnob {20 User}
1499 addUserKnob {26 version l v1.0}
1500 addUserKnob {4 screenType l "screen type" M {green blue}}
1501 addUserKnob {4 algorithm l "despill algorithm" M {average "double green/blue average" "double red average" "red limit" "green/blue limit" ""}}
1502 addUserKnob {6 spillMatteOut l "output spill matte in alpha" +STARTLINE}
1503 }
1504end_group
1505ShuffleCopy {
1506 inputs 2
1507 name ShuffleCopy1
1508 selected true
1509 xpos -38
1510 ypos 178
1511}
1512Premult {
1513 name Premult1
1514 selected true
1515 xpos -38
1516 ypos 204
1517}
1518Read {
1519 inputs 0
1520 file C:/Users/Samuel/Desktop/sources/BG.jpg
1521 format "1300 859 0 0 1300 859 1 "
1522 origset true
1523 name Read2
1524 selected true
1525 xpos -197
1526 ypos 299
1527}
1528Reformat {
1529 format "1920 1080 0 0 1920 1080 1 HD_1080"
1530 name Reformat1
1531 selected true
1532 xpos -197
1533 ypos 385
1534}
1535Transform {
1536 center {960 540}
1537 name Transform1
1538 selected true
1539 xpos -197
1540 ypos 411
1541}
1542Merge2 {
1543 inputs 2
1544 name Merge1
1545 selected true
1546 xpos -38
1547 ypos 411
1548}
1549Merge2 {
1550 inputs 2
1551 operation average
1552 mix 7.1500000000e-01
1553 name Merge2
1554 selected true
1555 xpos -38
1556 ypos 462
1557}
1558Dot {
1559 name Dot4
1560 tile_color 0xff0000ff
1561 label comp
1562 note_font "Verdana Italic"
1563 note_font_size 18
1564 selected true
1565 xpos -4
1566 ypos 789
1567}
1568Dot {
1569 name Dot14
1570 selected true
1571 xpos -4
1572 ypos 955
1573}
1574set N53275500 [stack 0]
1575Group {
1576 inputs 2
1577 name DiffCheck2
1578 selected true
1579 xpos -154
1580 ypos 951
1581 addUserKnob {20 CommonKey l DiffCheck}
1582 addUserKnob {41 tolerance T MergeExpression1.tolerance}
1583}
1584 Input {
1585 inputs 0
1586 name InputA
1587 xpos -190
1588 ypos -335
1589 number 1
1590 }
1591 Input {
1592 inputs 0
1593 name InputB
1594 xpos 7
1595 ypos -336
1596 }
1597 MergeExpression {
1598 inputs 2
1599 expr3 "abs(Br-Ar) > tolerance || abs(Bg-Ag) > tolerance || abs(Bb-Ab)\n > tolerance?1:0"
1600 name MergeExpression1
1601 xpos -98
1602 ypos -266
1603 addUserKnob {20 User}
1604 addUserKnob {7 tolerance R 0.000000000e+00 1.000000000e-01}
1605 tolerance 1.0000000000e-04
1606 }
1607 Shuffle {
1608 red alpha
1609 green alpha
1610 blue alpha
1611 name Shuffle1
1612 xpos -98
1613 ypos -242
1614 }
1615 Clamp {
1616 name Clamp1
1617 xpos -98
1618 ypos -211
1619 }
1620 Output {
1621 name Output1
1622 xpos -98
1623 ypos -99
1624 }
1625end_group
1626set N5148b400 [stack 0]
1627push 0
1628push $N1c341000
1629push $N5148b400
1630push $N4f748000
1631push $N2177ce00
1632Dot {
1633 name Dot7
1634 selected true
1635 xpos -179
1636 ypos -483
1637}
1638Dot {
1639 name Dot6
1640 tile_color 0xff0000ff
1641 label scan
1642 note_font "Verdana Italic"
1643 note_font_size 16
1644 selected true
1645 xpos -179
1646 ypos -434
1647}
1648Dot {
1649 name Dot8
1650 tile_color 0xff0000ff
1651 label scan
1652 note_font "Verdana Italic"
1653 note_font_size 16
1654 selected true
1655 xpos -407
1656 ypos 786
1657 hide_input true
1658}
1659PostageStamp {
1660 name PostageStamp1
1661 selected true
1662 xpos -441
1663 ypos 856
1664 postage_stamp true
1665}
1666Dot {
1667 name Dot9
1668 selected true
1669 xpos -407
1670 ypos 1077
1671}
1672push $N53275500
1673Group {
1674 inputs 4
1675 name DasGrain1
1676 help "DasGrain makes re-graining as simple as clicking a few buttons.\n\nFollow the steps in the Help tab and you'll have a perfect regrain in no time!"
1677 onCreate "import random\n\ntestimonials = \[\n \"Such an elegant solution, love it!\",\n \"Your gizmo is beyond expectation\",\n \"Totally awesome!\",\n \"DasGrain is officially the best thing ever\",\n \"It's really working!\",\n \"Das bringt Tränen in meine Augen\",\n \"DasGrain is the salvation we waited for\",\n \"It's really working\",\n \"I save a lot of time, and definitely my nerves :)\",\n \"It's alright\",\n ]\n\nnode = nuke.thisNode()\nnode\['testimonial'].setValue('<br><br><br><i>«%s»</i><br>— anonymous<br><br>' % random.choice(testimonials))\nnode\['box'].setFlag(nuke.NO_ANIMATION)"
1678 knobChanged "n = nuke.thisNode()\nk = nuke.thisKnob()\n\nif k.name() == 'box':\n this_frame = nuke.frame()\n n\['sample_frame'].setValue(this_frame)"
1679 tile_color 0x7f7f7fff
1680 label "v1.5 | 2019-05-18"
1681 selected true
1682 xpos -38
1683 ypos 1060
1684 addUserKnob {20 Analyse_tab l Analyse}
1685 addUserKnob {41 output t "<strong>regrained comp</strong> it is what it sais\n\n<strong>original grain</strong> plate minus degrained plate\n<strong>normalised grain</strong> check if the normalisation worked. It should be as even as possible. This is what you want to output if you want to prerender a grain plate. Later you can plug it into the <i>external grain</i> input of another DasGrain\n<strong>adapted grain</strong> check if the adaptation worked. Output this if you want to further manipulate the grain (who knows what the sup is gonna come up with...). After simply plus it to your comp.\n<strong>grain QC</strong> check if voronoi seams are visible (-> edgeblend), or the scattered grain looks different to the original plate grain (-> maybe bad sample area or wrong luminance degrain amount)" T Output.output}
1686 addUserKnob {26 spacer01_1 l " " T " "}
1687 addUserKnob {26 level l "<strong>Degrain amount"}
1688 addUserKnob {78 luminance t "Leave this at 1, if you're working on a completely degrained plate.\n\nIn case you decided to leave some luminance grain in the degrained plate (use the DegrainHelper node for this!), set this to the same value as in the DegrainHelper in order to compensate.\n\nIf the luminance degrain amount was set to 0.8, this needs to be set to 0.8 as well.\n\nDon't forget to use a mask of all elements that cover the plate." n 1}
1689 luminance 1
1690 addUserKnob {6 fix_ghosting l "fix ghosting" t "If your plate is repo'd or retimed and you want to use scattered grain everywhere, compensating for luminance grain will introduce plate detail back to the comp.\nEnable this to fix it." +STARTLINE}
1691 addUserKnob {26 divider01 l " "}
1692 addUserKnob {41 maskChannelMask1 l "grain level mask" T Multiply1.maskChannelMask}
1693 addUserKnob {41 invert_mask l invert -STARTLINE T Multiply1.invert_mask}
1694 addUserKnob {26 spacer02 l " " T " "}
1695 addUserKnob {26 divider02 l <strong>Analyse}
1696 addUserKnob {3 number_of_frames l "number of frames" t "Set the number of sample frames to be spread across the input range.\n\nMore frames lead to higher accuracy.\n\nIf there are particularly bright or dark frames, set them manually in the knob below.\n\nIf you want to set all sample frames manually, set this to 0 and add the frames in the knob below."}
1697 number_of_frames 1
1698 addUserKnob {1 additional_frames l "additional frames" t "Set additional frames like this:\n\n1001,1020,1053 (single frames)\n1020-1040 (frame ranges)\n1020-1040x4 (frame ranges with step)"}
1699 addUserKnob {3 sample_count l "sample count" t "The samples are spread across the sample range (which gets calculated automatically) based on the AlexaV3LogC curve. This results in more samples in the dark areas and less samples in the brights.\n\nMore samples lead to a more detailed response curve (while the accuracy is limited by the quality of the degrain)."}
1700 sample_count 20
1701 addUserKnob {22 analyse l Analyse t "this is where the magic happens" T "import nuke\n\n\ndef _sample_count(this):\n\n # returns the sample count\n\n sample_count = int(this\['sample_count'].value())\n if sample_count <= 0:\n raise RuntimeError('Enter a sample count greater than 0')\n\n else:\n\n return sample_count\n\n\ndef _generate_frame_list(this):\n\n # converts the frames submitted by the user into a list\n\n frame_list = \[]\n\n number_of_frames = int(this\['number_of_frames'].value())\n additional_frames = this\['additional_frames'].value()\n\n if number_of_frames < 1 and additional_frames is '':\n raise RuntimeError('Either set the number of frames > 0\\nor define additional frames')\n\n first_frame = max(this.input(1).firstFrame(),\n this.input(2).firstFrame())\n last_frame = min(this.input(1).lastFrame(),\n this.input(2).lastFrame())\n\n if number_of_frames > 0:\n distance = (last_frame - first_frame) / (number_of_frames)\n frame = first_frame + distance / 2\n\n for x in xrange(number_of_frames):\n int_frame = int(round(frame))\n if int_frame not in frame_list:\n frame_list.append(int_frame)\n frame += distance\n\n frange = nuke.FrameRanges(additional_frames.split(','))\n for r in frange:\n for f in r:\n if f >= first_frame and f <= last_frame:\n if f not in frame_list:\n frame_list.append(f)\n return frame_list\n\n\ndef _setup_for_multiframe(frame_list):\n\n # arranges all sample frames next to each other, starting at frame 0\n # sets the frame number knob of the FrameBlend node\n\n tw_lookup = nuke.toNode('TimeWarp1')\['lookup']\n tw_lookup.clearAnimated()\n tw_lookup.setAnimated()\n anim_list = \[]\n for n in range(0, len(frame_list)):\n anim_list.append(nuke.AnimationKey(n, frame_list\[n]))\n anim = tw_lookup.animation(0)\n anim.addKey(anim_list)\n\n fb = nuke.toNode('FrameBlend1')\n fb\['numframes'].setValue(len(frame_list))\n\n\ndef _generate_sample_list(\n sample_count,\n sample_range,\n sample_radius\n ):\n\n # generate a list of sample values spread equally between the\n # min and max values of the sample range\n\n sample_list = \[]\n for item in range(0, sample_count):\n sample_list.append(float(item) / sample_count\n * (sample_range\[1] - sample_range\[0])\n + sample_range\[0] + sample_radius)\n return sample_list\n\n\ndef _get_sample_range(\n channel,\n channel_list,\n frame_list\n ):\n\n # samples the minimum and maximum values of the given frame range and\n # sets the sample range to those values\n\n TimeWarp_disable = nuke.toNode('TimeWarp1')\['disable']\n CurveTool = nuke.toNode('CurveTool_Range')\n min_knob = CurveTool\['minlumapixvalue']\n max_knob = CurveTool\['maxlumapixvalue']\n\n if channel is 'red':\n TimeWarp_disable.setValue(False)\n\n min_knob.clearAnimated()\n max_knob.clearAnimated()\n\n min_knob.setAnimated()\n max_knob.setAnimated()\n\n nuke.execute(CurveTool, 0, len(frame_list) - 1)\n\n min_list = \[]\n max_list = \[]\n\n index = channel_list.index(channel)\n for key in min_knob.animation(index).keys():\n min_list.append(key.y)\n\n for key in max_knob.animation(index).keys():\n max_list.append(key.y)\n\n min_value = min(min_list)\n max_value = max(max_list)\n\n if channel is 'blue':\n TimeWarp_disable.setValue(True) #hopefully prevents slowing down the comp\n\n min_knob.clearAnimated()\n max_knob.clearAnimated()\n CurveTool\['minlumapixdata'].clearAnimated()\n CurveTool\['maxlumapixdata'].clearAnimated()\n\n return \[min_value, max_value]\n\n\ndef _log2lin(value):\n\n # converts values from AlexaV3LogC to linear\n\n if value > 5.367655 * 0.010591 + 0.092809:\n new_value = (10.0 ** ((value - 0.385537) / 0.247190) - 0.052272) / 5.555556\n else:\n new_value = (value - 0.092809) / 5.367655\n return new_value\n\n\ndef _sample_it(\n Keyer,\n CurveTool,\n frame_list,\n channel_list,\n channel,\n sample,\n sample_radius,\n ):\n\n # analyse the grain level per channel and sample value in the sample range\n\n min = str(sample - sample_radius)\n max = str(sample + sample_radius)\n Keyer\['temp_expr0'].setValue(min)\n Keyer\['temp_expr1'].setValue(max)\n\n intensity_knob = CurveTool\['intensitydata']\n intensity_knob.clearAnimated()\n intensity_knob.setAnimated()\n\n nuke.execute(CurveTool, len(frame_list) - 1, len(frame_list) - 1)\n sample_values = intensity_knob.value()\n\n intensity_knob.clearAnimated()\n\n if sample_values\[3] > 0:\n value = sample_values\[0] / sample_values\[3]\n\n if value > 0:\n return value\n else:\n\n return None\n else:\n\n return None\n\n\ndef check_inputs(this):\n if this.input(1) is None:\n raise RuntimeError('no plate connected')\n if this.input(2) is None:\n raise RuntimeError('no degrained plate connected')\n\n def format_to_tuple(g):\n \"\"\"returns (1024, 786, 2.0)\n \"\"\"\n return (g.format().width(), g.format().height(), g.format().pixelAspect())\n\n format_set = set(\[\n format_to_tuple(this.input(1)),\n format_to_tuple(this.input(2)),\n ])\n if len(format_set) != 1:\n raise RuntimeError(\"Format missmatch: Make sure the formats of plate and degrained plate match.\")\n\ndef start():\n\n # let's do this!\n\n this = nuke.thisNode()\n\n check_inputs(this)\n\n with this:\n frame_list = _generate_frame_list(this)\n _setup_for_multiframe(frame_list)\n sample_count = _sample_count(this)\n\n blank = 'bWFzdGVyIHt9CiAgICAgICAgcmVkIHtjdXJ2ZX0KICAgICAgICBncmVlbiB7Y3VydmV9CiAgICAgICAgYmx1ZSB7Y3VydmV9CiAgICAgICAgYWxwaGEge30='.decode(\"base64\")\n\n lut = nuke.toNode('ColorLookup')\['lut']\n lut.fromScript(blank)\n\n channel_list = \['red', 'green', 'blue']\n\n Keyer = nuke.toNode('Expression2')\n Copy = nuke.toNode('Copy2')\n\n CurveTool = nuke.toNode('CurveTool')\n\n task = nuke.ProgressTask('Analysing...')\n step = 100.0 / 3 / sample_count\n progress = step\n\n TimeWarp_disable = nuke.toNode('TimeWarp2')\['disable']\n FrameBlend_disable = nuke.toNode('FrameBlend1')\['disable']\n\n TimeWarp_disable.setValue(False)\n FrameBlend_disable.setValue(False)\n\n for channel in channel_list:\n Copy\['from0'].setValue('rgba.\{\}'.format(channel))\n\n sample_range = _get_sample_range(channel, channel_list, frame_list)\n sample_radius = (sample_range\[1] - sample_range\[0]) / sample_count / 2\n sample_list = _generate_sample_list(sample_count, sample_range, sample_radius)\n\n for sample in sample_list:\n if task.isCancelled():\n return\n\n task.setProgress(int(progress))\n task.setMessage('\{\} channel at \{\}'.format(channel, round(_log2lin(sample), 2)))\n\n value = _sample_it(\n Keyer,\n CurveTool,\n frame_list,\n channel_list,\n channel,\n sample,\n sample_radius,\n )\n\n if value is not None:\n lut.setValueAt(value, _log2lin(sample),\n channel_list.index(channel) + 1)\n\n progress += step\n\n tw_lookup = nuke.toNode('TimeWarp1')\['lookup']\n tw_lookup.clearAnimated()\n TimeWarp_disable.setValue(True) #hopefully prevents slowing down the comp\n FrameBlend_disable.setValue(True) #hopefully prevents slowing down the comp\n\n del task\n\n\nstart()\n" +STARTLINE}
1702 addUserKnob {26 divider03 l " "}
1703 addUserKnob {41 maskChannelMask l "analysis mask" T ChannelMerge1.A}
1704 addUserKnob {6 invert_1 l invert -STARTLINE}
1705 addUserKnob {20 Adjust_tab l Adjust}
1706 addUserKnob {41 output_1 l output t "<strong>regrained comp</strong> it is what it sais\n\n<strong>original grain</strong> plate minus degrained plate\n<strong>normalised grain</strong> check if the normalisation worked. It should be as even as possible. This is what you want to output if you want to prerender a grain plate. Later you can plug it into the <i>external grain</i> input of another DasGrain\n<strong>adapted grain</strong> check if the adaptation worked. Output this if you want to further manipulate the grain (who knows what the sup is gonna come up with...). After simply plus it to your comp.\n<strong>grain QC</strong> check if voronoi seams are visible (-> edgeblend), or the scattered grain looks different to the original plate grain (-> maybe bad sample area or wrong luminance degrain amount)" T Output.output}
1707 addUserKnob {26 spacer03_2 l " " T " "}
1708 addUserKnob {26 divider04 l <strong>Adjust}
1709 addUserKnob {22 whatsthis l "What am I looking at?" T "nuke.message(\"In the RGB channels are the sampled grain response curves. Their quality depends entirely on the quality of the degrain. If the curves look wrong, try to improve the degrain first. If they still look wrong and the resulting regrain doesn't work well enough, you can try to improve the curves here. You can also extend the curves if the comp has values that don't exist in the plate. Don't touch the master curve though.\\n\\nNote: Slope of curves should always be positive (always going up ↗)\")" +STARTLINE}
1710 addUserKnob {41 lut l "" +STARTLINE T ColorLookup.lut}
1711 addUserKnob {20 Replace_tab l Replace}
1712 addUserKnob {41 output_2 l output t "<strong>regrained comp</strong> it is what it sais\n\n<strong>original grain</strong> plate minus degrained plate\n<strong>normalised grain</strong> check if the normalisation worked. It should be as even as possible. This is what you want to output if you want to prerender a grain plate. Later you can plug it into the <i>external grain</i> input of another DasGrain\n<strong>adapted grain</strong> check if the adaptation worked. Output this if you want to further manipulate the grain (who knows what the sup is gonna come up with...). After simply plus it to your comp.\n<strong>grain QC</strong> check if voronoi seams are visible (-> edgeblend), or the scattered grain looks different to the original plate grain (-> maybe bad sample area or wrong luminance degrain amount)" T Output.output}
1713 addUserKnob {26 spacer04 l " " T " "}
1714 addUserKnob {26 divider05 l "<strong>External Grain"}
1715 addUserKnob {6 external_grain l "use external grain" t "Use external grain from a second DasGrain, with the output set to 'normalised grain', to replace masked area.\nConnect it to the 'external grain' input of this DasGrain (it's a bit hidden on the left side of the node)." +STARTLINE}
1716 addUserKnob {26 spacer05 l " " T " "}
1717 addUserKnob {26 divider06 l <strong>Scatter}
1718 addUserKnob {6 scatter l activate t "Activates the scatter function. It generates a new grain based on the grain in the sample box using a Voronoi noise." +STARTLINE}
1719 addUserKnob {15 box l "sample box" t "Define an area that is used as a source for the scatter function. The grain in this area should be as even as possible, without any visible plate detail."}
1720 box {100 100 500 300}
1721 addUserKnob {3 sample_frame l "sample frame" t "The frame at which the grain is being sampled. Is set automatically once the sample box is changed." +DISABLED}
1722 sample_frame 1001
1723 addUserKnob {26 spacer06 l "" +STARTLINE T " "}
1724 addUserKnob {6 overlay l "overlay cell pattern" t "Overlay the cell pattern of the voronoy noise. Useful to check where the seams are and if distortion or blending is necessary." +STARTLINE}
1725 addUserKnob {7 cell_size l "cell size" t "Cell size of the scatter. Shoudn't be too small, as lower grain frequencies might break.\nCan't be too big either, to prevent it from breaking the border of the samplebox (will error if it does)." R 5.000000000e+00 1.000000000e+02}
1726 cell_size 40
1727 addUserKnob {26 spacer07 l "" +STARTLINE T " "}
1728 addUserKnob {20 concealer l "edge concealer" n 1}
1729 concealer 0
1730 addUserKnob {26 concealer_help l " " T "If you can see the voronoi pattern in the grain QC output,\nincrease the edge blend size."}
1731 addUserKnob {3 edge_blend_size l "edge blend size" t "Set the output to grain QC. If you see the cell seams, increase the edge blend size to conceal them.\n\nThis is a bit hacky and slow."}
1732 addUserKnob {26 tip l "" -STARTLINE T "sloooow - keep this below 3 if possible"}
1733 addUserKnob {26 distortion_help l " " T "\nDistortion might help as well, if somehow the straight\nseams are visible (you might want to toggle the overlay\nwhile adjusting)."}
1734 addUserKnob {7 amplitude R 0.000000000e+00 5.000000000e+01}
1735 addUserKnob {7 frequency R 0.000000000e+00 5.000000000e+01}
1736 frequency 15
1737 addUserKnob {20 endGroup n -1}
1738 addUserKnob {26 divider07 l "" +STARTLINE}
1739 addUserKnob {41 maskChannelMask_1 l "replace mask" -STARTLINE T Merge9.maskChannelMask}
1740 addUserKnob {41 invert_mask_1 l invert -STARTLINE T Merge9.invert_mask}
1741 addUserKnob {20 Help_tab l Help}
1742 addUserKnob {26 basic_setup l "" +STARTLINE T "<font size=\"5\">Basic setup</font>"}
1743 addUserKnob {26 ""}
1744 addUserKnob {26 explanation l "" +STARTLINE T "<strong>Bold</strong> steps are always necessary"}
1745 addUserKnob {26 steps l "" +STARTLINE T "<br><strong>1. Connect <i>plate</i>, <i>degrained plate</i> and <i>comp</i>.</strong><br>2. Set the <i>luminance degrain amount</i>.<br><strong>3. Press the <i>Analyse</i> button.</strong><br>4. Correct the <i>response curves</i> in the Adjust tab.<br>5. Move the <i>sample box</i> to an area without any plate detail and activate <i>scatter</i>.<br>6. If necessary, activate <i>edge blend</i> and/or <i>distortion</i> to conceal seams."}
1746 addUserKnob {26 in_depth l "" +STARTLINE T "<br>For an in depth explanation of the steps, read the tooltips and check out this video:<br><a href=\"https://vimeo.com/284820390/\"><span style=\"color:#C8C8C8;\">https://vimeo.com/284820390</a>"}
1747 addUserKnob {26 pushthebutton l "" +STARTLINE T "<br><br>If the result is not as expected and you don't know why, push this button:"}
1748 addUserKnob {22 troubleshoot l Troubleshoot t HEEEEEEELP T "messages = \[]\n\nthis = nuke.thisNode()\n\n#########################\n\nif this.input(0) is None or this.input(1) is None or this.input(2) is None:\n messages.append(\"<font color='red'><strong>ERROR</strong></font> Plate, degrained plate and comp need to be connected to the appropriate inputs.\")\n\n#########################\n\nelse:\n\n def format_to_tuple(g):\n \"\"\"returns (1024, 786, 2.0)\n \"\"\"\n return (g.format().width(), g.format().height(), g.format().pixelAspect())\n\n format_set = set(\[\n format_to_tuple(this.input(0)),\n format_to_tuple(this.input(1)),\n format_to_tuple(this.input(2)),\n ])\n if len(format_set) != 1:\n messages.append(\"<font color='orange'><strong>WARNING</strong></font> Format missmatch: Make sure formats of plate, degrained plate and comp match.\")\n\n if (this.input(1).firstFrame() != this.input(2).firstFrame()) or (this.input(1).lastFrame() != this.input(2).lastFrame()):\n messages.append(\"<font color='orange'><strong>WARNING</strong></font> The frame ranges of plate and degrained plate don't match. Double check that they belong together.\")\n\n#########################\n\nmessages.append(\"Double check that plate and degrained plate haven't been modified in any way (paint, despill, etc).\")\n\n#########################\n\nif this\['luminance'].getValue() == 1:\n messages.append(\"Are you working on a completely degrained plate? If not, you might have to set the luminance degrain amount.\")\n\n#########################\n\nblank = 'bWFzdGVyIHt9CnJlZCB7fQpncmVlbiB7fQpibHVlIHt9CmFscGhhIHt9'.decode(\"base64\")\n\nwith this:\n ColorLookup = nuke.toNode('ColorLookup') \n if ColorLookup\['lut'].toScript() == blank:\n messages.append(\"<font color='red'><strong>ERROR</strong></font> You haven't pressed the Analyse button yet!\")\n\n#########################\n\nclass BadThings(Exception): pass\n\ndef thingy():\n with this:\n ColorLookup = nuke.toNode('ColorLookup')\n list = this\['lut'].toScript().replace('\}','').split('\\n')\n for item in list\[1:-1]:\n sample_value = 0\n for value in item.split(' '):\n try:\n value == float(value)\n if value < sample_value:\n raise BadThings(\"<font color='orange'><strong>WARNING</strong></font> Check and fix the response curves. Their slopes should always be positive (the curves should always go up ↗).\")\n \n else:\n sample_value = value\n except ValueError:\n # Ignore non-numeric things like x-values of \"x5.46\" and channel names like \"red\{\" etc\n pass\ntry:\n thingy()\nexcept BadThings as e:\n messages.append(str(e))\n \n#########################\n\nif this\['scatter'].value() == True:\n if this\['box'].getValue() == \[100.0, 100.0, 500.0, 300.0]:\n messages.append(\"<font color='orange'><strong>WARNING</strong></font> Scatter has been activated, but the sample box is still in its default position. Are you sure that's a good area to sample?\")\n\n#########################\n\nmessages.append(\"Did you copy/paste DasGrain from another script? Make sure to reanalyse and to reset the sample area if you are using scatter.\")\n\n#########################\n\nif len(messages) > 0:\n nuke.message(\"<font size=\\\"5\\\">Things worth checking</font><br><br>\"\n \"%s<br><br><br>If any of this doesn't make sense to you, it might be worth checking out the video on vimeo.\" % (\n \"<hr>\".join(\"%s: %s\" % (i+1, m) for i, m in enumerate(messages))))\n" +STARTLINE}
1749 addUserKnob {26 dont_despair l "" +STARTLINE T "<br>If it still doesn't work and you're about to flip the table, send me a mail.<br>I'm happy to help! :)"}
1750 addUserKnob {20 Info_tab l Info}
1751 addUserKnob {26 dasname l "" +STARTLINE T "<font size='7'>DasGrain</font> v1.5"}
1752 addUserKnob {26 ""}
1753 addUserKnob {26 info l "" +STARTLINE T "Last change: 2019-05-18\n"}
1754 addUserKnob {26 name_1 l "" +STARTLINE T "\nFabian Holtz"}
1755 addUserKnob {26 mail l "" +STARTLINE T "<a href=\"mailto:holtzf+nuke@gmail.com\"><span style=\"color:#C8C8C8;\">holtzf+nuke@gmail.com</a>"}
1756 addUserKnob {26 testimonial l "" +STARTLINE T "<br><br><br><i>«It's really working!»</i><br>— anonymous<br><br>"}
1757 addUserKnob {26 ""}
1758 addUserKnob {26 credit l "" +STARTLINE T "<br>VoronoiScatter based on Ivan Busquets' implementation of libNoise's\nVoronoi generator"}
1759 addUserKnob {26 website l "" +STARTLINE T "<a href=\"http://www.nukepedia.com/blink/image/voronoi/\"><span style=\"color:#C8C8C8;\">http://www.nukepedia.com/blink/image/voronoi/</a>"}
1760 addUserKnob {26 ""}
1761 addUserKnob {26 thanks l "" +STARTLINE T "<br>Special thanks to Ben Dickson for bearing with my questions and<br>problems and RSP comp for the valuable feedback."}
1762}
1763 BackdropNode {
1764 inputs 0
1765 name BackdropNode1
1766 tile_color 0x7f7f7fff
1767 label "normalise grain"
1768 note_font_size 30
1769 xpos 280
1770 ypos 1470
1771 bdwidth 320
1772 bdheight 110
1773 }
1774 BackdropNode {
1775 inputs 0
1776 name BackdropNode11
1777 tile_color 0x7f7f7fff
1778 label "add grain"
1779 note_font_size 30
1780 xpos 830
1781 ypos 2574
1782 bdwidth 320
1783 bdheight 110
1784 }
1785 BackdropNode {
1786 inputs 0
1787 name BackdropNode13
1788 tile_color 0x7f7f7fff
1789 label scatter
1790 note_font_size 30
1791 xpos -50
1792 ypos 1830
1793 bdwidth 320
1794 bdheight 110
1795 }
1796 BackdropNode {
1797 inputs 0
1798 name BackdropNode14
1799 tile_color 0x7f7f7fff
1800 label "analyse grain"
1801 note_font_size 30
1802 xpos -159
1803 ypos 606
1804 bdwidth 319
1805 bdheight 720
1806 }
1807 BackdropNode {
1808 inputs 0
1809 name BackdropNode2
1810 tile_color 0x7f7f7fff
1811 label "grain response curve"
1812 note_font_size 30
1813 xpos 610
1814 ypos 2382
1815 bdwidth 320
1816 bdheight 110
1817 }
1818 BackdropNode {
1819 inputs 0
1820 name BackdropNode3
1821 tile_color 0x7f7f7fff
1822 label QC
1823 note_font_size 30
1824 xpos 1050
1825 ypos 2862
1826 bdwidth 320
1827 bdheight 110
1828 }
1829 BackdropNode {
1830 inputs 0
1831 name BackdropNode4
1832 tile_color 0x7f7f7fff
1833 label "grain response curve"
1834 note_font_size 30
1835 xpos 610
1836 ypos 1230
1837 bdwidth 320
1838 bdheight 110
1839 }
1840 BackdropNode {
1841 inputs 0
1842 name BackdropNode5
1843 tile_color 0x7f7f7fff
1844 label "adapt grain"
1845 note_font_size 30
1846 xpos 280
1847 ypos 2382
1848 bdwidth 320
1849 bdheight 110
1850 }
1851 BackdropNode {
1852 inputs 0
1853 name BackdropNode6
1854 tile_color 0x7f7f7fff
1855 label "sample range"
1856 note_font_size 30
1857 xpos -490
1858 ypos 606
1859 bdwidth 320
1860 bdheight 160
1861 }
1862 BackdropNode {
1863 inputs 0
1864 name BackdropNode7
1865 tile_color 0x7f7f7fff
1866 label "luminance level"
1867 note_font_size 30
1868 xpos 280
1869 ypos -282
1870 bdwidth 760
1871 bdheight 685
1872 }
1873 BackdropNode {
1874 inputs 0
1875 name BackdropNode8
1876 tile_color 0x7f7f7fff
1877 label "original grain"
1878 note_font_size 30
1879 xpos 280
1880 ypos 606
1881 bdwidth 320
1882 bdheight 110
1883 }
1884 BackdropNode {
1885 inputs 0
1886 name BackdropNode9
1887 tile_color 0x7f7f7fff
1888 label replace
1889 note_font_size 30
1890 xpos 60
1891 ypos 1999
1892 bdwidth 540
1893 bdheight 226
1894 }
1895 Input {
1896 inputs 0
1897 name mask
1898 label "\[value number]"
1899 note_font_size 30
1900 xpos 1170
1901 ypos -680
1902 number 3
1903 }
1904 Dot {
1905 name Dot39
1906 xpos 1204
1907 ypos 258
1908 }
1909set N2162d880 [stack 0]
1910 Dot {
1911 name Dot26
1912 xpos 1204
1913 ypos 1074
1914 }
1915set N2162d500 [stack 0]
1916 Dot {
1917 name Dot38
1918 xpos 1204
1919 ypos 1650
1920 }
1921 Dot {
1922 name Dot37
1923 xpos 544
1924 ypos 1650
1925 }
1926 Dot {
1927 name Dot22
1928 xpos 544
1929 ypos 2079
1930 }
1931set N2162ca80 [stack 0]
1932 Dot {
1933 name Dot20
1934 xpos 544
1935 ypos 2199
1936 }
1937push $N2162ca80
1938 Dot {
1939 name Dot17
1940 xpos 434
1941 ypos 2079
1942 }
1943set N2162c380 [stack 0]
1944 Dot {
1945 name Dot13
1946 xpos 214
1947 ypos 2079
1948 }
1949 Input {
1950 inputs 0
1951 name external_grain
1952 label "\[value number]"
1953 note_font_size 30
1954 xpos -150
1955 ypos 1524
1956 number 4
1957 }
1958 Dot {
1959 name Dot21
1960 xpos -116
1961 ypos 1746
1962 }
1963 Input {
1964 inputs 0
1965 name DEGRAINED_PLATE
1966 label "\[value number]"
1967 note_font_size 30
1968 xpos 730
1969 ypos -680
1970 number 2
1971 }
1972 Dot {
1973 name Dot9
1974 xpos 764
1975 ypos -390
1976 }
1977set N3bea7180 [stack 0]
1978 Dot {
1979 name Dot28
1980 xpos 764
1981 ypos -198
1982 }
1983set N3bea6e00 [stack 0]
1984 Dot {
1985 name Dot32
1986 xpos 764
1987 ypos 234
1988 }
1989set N3bea6a80 [stack 0]
1990push $N3bea6e00
1991 Dot {
1992 name Dot27
1993 xpos 624
1994 ypos -198
1995 }
1996 Colorspace {
1997 colorspace_out YCbCr
1998 name Colorspace1
1999 xpos 590
2000 ypos -130
2001 }
2002 Dot {
2003 name Dot7
2004 xpos 624
2005 ypos -54
2006 }
2007set N3bea6000 [stack 0]
2008 Input {
2009 inputs 0
2010 name PLATE
2011 label "\[value number]"
2012 note_font_size 30
2013 xpos 290
2014 ypos -680
2015 number 1
2016 }
2017 Dot {
2018 name Dot29
2019 xpos 324
2020 ypos -198
2021 }
2022set N3b26d880 [stack 0]
2023 Dot {
2024 name Dot6
2025 xpos 464
2026 ypos -198
2027 }
2028 Colorspace {
2029 colorspace_out YCbCr
2030 name Colorspace2
2031 xpos 430
2032 ypos -130
2033 }
2034 Merge2 {
2035 inputs 2
2036 operation from
2037 bbox B
2038 Achannels rgb
2039 Bchannels rgb
2040 output rgb
2041 name Merge4
2042 xpos 430
2043 ypos -58
2044 }
2045 Multiply {
2046 channels rgb
2047 value {{1/parent.luminance-1} 0 0 0}
2048 name Multiply6
2049 xpos 430
2050 ypos 14
2051 }
2052 Dot {
2053 name Dot31
2054 xpos 464
2055 ypos 90
2056 }
2057push $N3bea6000
2058 Merge2 {
2059 inputs 2
2060 operation plus
2061 bbox B
2062 Achannels rgb
2063 Bchannels rgb
2064 output rgb
2065 name Merge5
2066 xpos 590
2067 ypos 86
2068 }
2069 Colorspace {
2070 colorspace_in YCbCr
2071 name Colorspace3
2072 xpos 590
2073 ypos 158
2074 }
2075 Merge2 {
2076 inputs 2
2077 operation from
2078 bbox B
2079 Achannels rgb
2080 Bchannels rgb
2081 output rgb
2082 name Merge6
2083 xpos 590
2084 ypos 230
2085 }
2086 Dot {
2087 name Dot35
2088 xpos 624
2089 ypos 306
2090 }
2091set N442b1880 [stack 0]
2092push $N3bea6a80
2093 Merge2 {
2094 inputs 2
2095 operation from
2096 bbox B
2097 Achannels rgb
2098 Bchannels rgb
2099 output rgb
2100 name Merge7
2101 xpos 730
2102 ypos 302
2103 disable {{Multiply6.value.r==0}}
2104 }
2105 Dot {
2106 name Dot2
2107 xpos 764
2108 ypos 522
2109 }
2110set N442b1180 [stack 0]
2111 ColorLookup {
2112 channels rgb
2113 lut {master {}
2114 red {curve x5.4883426055e-03 7.9197550909e-04 x9.7719589248e-03 1.0016920174e-03 x1.4373803511e-02 1.2409310686e-03 x2.0054226741e-02 1.5298702573e-03 x2.7091398835e-02 1.8389970770e-03 x3.5809371620e-02 2.1137036514e-03 x4.6609599143e-02 2.4606126531e-03 x5.9989422560e-02 2.7586421105e-03 x7.6564967632e-02 3.0951894146e-03 x9.7099512815e-02 3.5206409875e-03 x1.2253866345e-01 4.2684341339e-03 x1.5405385196e-01 4.9180747153e-03 x1.9309633970e-01 5.6509728855e-03 x2.4146395922e-01 6.5499034485e-03 x3.0138400197e-01 6.9809159453e-03 x3.7561574578e-01 8.0959383089e-03 x4.6757745743e-01 9.5122126545e-03 x5.8150386810e-01 1.1076711922e-02 x7.2264117002e-01 1.6255095274e-02 L l x8.9748859406e-01 2.3223292950e-02}
2115 green {curve x6.8829995580e-03 7.1352625166e-04 x1.1101547629e-02 8.6514336154e-04 x1.5909701586e-02 1.0400923703e-03 x2.1845003590e-02 1.2616445709e-03 x2.9171682894e-02 1.4910300283e-03 x3.8215909153e-02 1.7410412009e-03 x4.9380321056e-02 1.9593516258e-03 x6.3161939383e-02 2.2679813317e-03 x8.0174304545e-02 2.5993073190e-03 x1.0117476434e-01 2.9683029893e-03 x1.2709824741e-01 3.4091182603e-03 x1.5909880400e-01 3.8042994401e-03 x1.9860106707e-01 4.4383339368e-03 x2.4736361206e-01 5.1074801854e-03 x3.0755725503e-01 5.7555733132e-03 x3.8186174631e-01 6.5706851248e-03 x4.7358500957e-01 7.4139833194e-03 x5.8681035042e-01 8.4647158692e-03 x7.2657847404e-01 1.0320618956e-02 l x8.9911162853e-01 1.0474751324e-02}
2116 blue {curve x7.2774481960e-03 1.0499339542e-03 x1.1488932185e-02 1.2415460436e-03 x1.6361821443e-02 1.4959871376e-03 x2.2370953113e-02 1.7608363119e-03 x2.9781268910e-02 2.1215681151e-03 x3.8919493556e-02 2.4869199170e-03 x5.0188533962e-02 2.8568853689e-03 x6.4085245132e-02 3.2834701919e-03 x8.1222340465e-02 3.7318817958e-03 x1.0235539824e-01 4.2070231017e-03 x1.2841618061e-01 4.7264746209e-03 x1.6055370867e-01 5.7214596830e-03 x2.0018494129e-01 6.6465625530e-03 x2.4905723333e-01 7.4660851822e-03 x3.0932536721e-01 8.8802777220e-03 x3.8364660740e-01 9.2142484270e-03 x4.7529777884e-01 1.0281608265e-02 x5.8831983805e-01 1.1743024229e-02 x7.2769588232e-01 1.3658493073e-02 l x8.9957118034e-01 2.2460815864e-02}
2117 alpha {}}
2118 name ColorLookup
2119 xpos 730
2120 ypos 1304
2121 }
2122 set C442b0e00 [stack 0]
2123 Dot {
2124 name Dot24
2125 xpos 764
2126 ypos 1554
2127 }
2128 Expression {
2129 temp_name0 target
2130 temp_expr0 .01
2131 expr0 target/r
2132 expr1 target/g
2133 expr2 target/b
2134 channel3 none
2135 name Expression
2136 xpos 400
2137 ypos 1550
2138 }
2139push $N442b1180
2140 Dot {
2141 name Dot30
2142 xpos 544
2143 ypos 690
2144 }
2145push $N3b26d880
2146 Merge2 {
2147 inputs 2
2148 operation from
2149 bbox B
2150 Achannels rgb
2151 Bchannels rgb
2152 output rgb
2153 name Merge27
2154 xpos 290
2155 ypos 686
2156 bookmark true
2157 }
2158 Dot {
2159 name Dot3
2160 xpos 324
2161 ypos 786
2162 }
2163set N4534f880 [stack 0]
2164 Dot {
2165 name Dot33
2166 xpos 324
2167 ypos 1386
2168 }
2169 Merge2 {
2170 inputs 2
2171 operation multiply
2172 bbox B
2173 Achannels rgb
2174 Bchannels rgb
2175 output rgb
2176 name Merge2
2177 xpos 290
2178 ypos 1550
2179 }
2180 Dot {
2181 name Dot15
2182 xpos 324
2183 ypos 1650
2184 }
2185set N4534ee00 [stack 0]
2186 Dot {
2187 name Dot25
2188 xpos 104
2189 ypos 1650
2190 }
2191 Switch {
2192 inputs 2
2193 which {{parent.external_grain}}
2194 name Switch2
2195 xpos 70
2196 ypos 1742
2197 }
2198 Group {
2199 name VoronoiScatter
2200 selected true
2201 xpos 70
2202 ypos 1910
2203 disable {{!parent.scatter}}
2204 addUserKnob {20 User}
2205 addUserKnob {15 box}
2206 box {{parent.box} {parent.box} {parent.box} {parent.box}}
2207 addUserKnob {3 sample_frame l "sample frame"}
2208 sample_frame {{parent.sample_frame}}
2209 addUserKnob {7 cell_size l "cell size" R 0.000000000e+00 1.000000000e+02}
2210 cell_size {{parent.cell_size}}
2211 addUserKnob {6 overlay_pattern l "overlay pattern" -STARTLINE}
2212 overlay_pattern {{parent.overlay}}
2213 addUserKnob {3 edge_blend_size l "edge blend size"}
2214 edge_blend_size {{parent.edge_blend_size}}
2215 addUserKnob {7 amplitude R 0.000000000e+00 1.000000000e+02}
2216 amplitude {{parent.amplitude}}
2217 addUserKnob {7 frequency R 0.000000000e+00 1.000000000e+02}
2218 frequency {{parent.frequency}}
2219 addUserKnob {41 VoroNoise_Seed l Seed T VoroNoise.VoroNoise_Seed}
2220 }
2221 Reformat {
2222 inputs 0
2223 type "to box"
2224 box_width {{Input1.width}}
2225 box_height {{Input1.height}}
2226 box_fixed true
2227 box_pixel_aspect {{Input1.pixel_aspect}}
2228 resize distort
2229 center false
2230 black_outside true
2231 name Reformat1
2232 xpos 510
2233 ypos -658
2234 }
2235 Dot {
2236 name Dot6
2237 xpos 544
2238 ypos -606
2239 }
2240set N4534e000 [stack 0]
2241 Dot {
2242 name Dot7
2243 xpos 874
2244 ypos -606
2245 }
2246 Noise {
2247 output {rgba.red -rgba.green -rgba.blue none}
2248 replace true
2249 size {{parent.frequency} {size.0*pixel_aspect}}
2250 zoffset {{x+1000}}
2251 nyquist false
2252 gamma 1
2253 center {960 4.5350000000e+02}
2254 name Noise1
2255 xpos 840
2256 ypos -514
2257 }
2258 Noise {
2259 output {-rgba.red rgba.green -rgba.blue none}
2260 replace true
2261 size {{parent.Noise1.size} {parent.Noise1.size}}
2262 zoffset {{x}}
2263 gamma 1
2264 center {960 4.5350000000e+02}
2265 name Noise2
2266 xpos 840
2267 ypos -466
2268 }
2269 Clamp {
2270 name Clamp1
2271 xpos 840
2272 ypos -424
2273 }
2274 Dot {
2275 name Dot11
2276 xpos 874
2277 ypos -366
2278 }
2279push $N4534e000
2280 BlinkScript {
2281 kernelSourceFile C:/Users/fab/Downloads/voronoi.blink
2282 recompileCount 91
2283 ProgramGroup 1
2284 KernelDescription "2 \"VoroNoise\" iterate pixelWise c117be128a07c11b6d82fd34148d66b3bcac41976ec9c2082affe38e890c2c0f 2 \"src\" Read Point \"dst\" Write Point 6 \"Frequency\" Float 1 AABIQg== \"Seed\" Int 1 AAAAAA== \"aspect ratio\" Float 1 AACAPw== \"width\" Int 1 AAAAAA== \"height\" Int 1 AAAAAA== \"Randomness\" Float 1 AAAAPw== 6 \"frequency\" 1 1 \"seed\" 1 1 \"aspect_ratio\" 1 1 \"width\" 1 1 \"height\" 1 1 \"randomness\" 1 1 0"
2285 kernelSource "// Voronoi.blink\n// A test implementation of libNoise's Voronoi generator using Blink\n// Ivan Busquets - August 2013\n// Modified for DasGrain by Fabian Holtz - April 2019\n\n#define X_NOISE_GEN 1619\n#define Y_NOISE_GEN 31337\n#define Z_NOISE_GEN 6971\n#define SEED_NOISE_GEN 1013\n#define SQRT_3 1.73205081\n\ninline int IntValueNoise3D (int x, int y, int z, int seed)\n\{\n // All constants are primes and must remain prime in order for this noise\n // function to work correctly.\n int n = (\n X_NOISE_GEN * x\n + Y_NOISE_GEN * y\n + Z_NOISE_GEN * z\n + SEED_NOISE_GEN * seed)\n & 0x7fffffff;\n n = (n >> 13) ^ n;\n return (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;\n\}\n\ninline float ValueNoise3D (int x, int y, int z, int seed)\n\{\n return 1.0 - ((float)IntValueNoise3D (x, y, z, seed) / 1073741824.0);\n\}\n\nkernel VoroNoise : ImageComputationKernel<ePixelWise>\n\{\n Image<eRead> src;\n Image<eWrite, eAccessPoint> dst;\n\nparam:\n float frequency;\n int seed;\n float aspect_ratio;\n int width;\n int height;\n float randomness;\n\n\n void define() \{\n defineParam(frequency, \"Frequency\", 50.0f);\n defineParam(aspect_ratio, \"aspect ratio\", 1.0f);\n defineParam(seed, \"Seed\", 0);\n defineParam(randomness, \"Randomness\", 0.5f);\n \}\n\n\n\n\n void process(int2 pos) \{\n float x = pos.x * aspect_ratio * frequency / width;\n float y = pos.y * frequency / width;\n int xInt = (x > 0.0) ? x : x - 1;\n int yInt = (y > 0.0) ? y : y - 1;\n\n\n float minDist = 2147483647.0;\n float xCandidate = 0;\n float yCandidate = 0;\n\n float dist;\n\nfor (int yCur = yInt - 2; yCur <= yInt + 2; yCur++) \{\n for (int xCur = xInt - 2; xCur <= xInt + 2; xCur++) \{\n\n // Calculate the position and distance to the seed point inside of\n // this unit cube. Limited by the randomness value\n float xPos = xCur + (ValueNoise3D (xCur, yCur, 0, seed ) + 1 ) * randomness + (1-randomness) - 1;\n float yPos = yCur + (ValueNoise3D (xCur, yCur, 0, seed + 1) + 1 ) * randomness + (1-randomness) - 1;\n\n float xDist = xPos - x;\n float yDist = yPos - y;\n\n dist = pow(xDist, 2) + pow(yDist, 2);\n if (dist < minDist) \{\n // This seed point is closer to any others found so far, so record\n // this seed point.\n minDist = dist;\n xCandidate = xPos;\n yCandidate = yPos;\n\t\}\n \}\n\}\n\n SampleType(dst) sample(0.0f);\n\n sample.x = xCandidate / aspect_ratio / frequency;\n sample.y = yCandidate / height * width / frequency;\n sample.z = 0;\n\n dst() = sample;\n\}\n\};"
2286 rebuild ""
2287 VoroNoise_Frequency {{width/parent.cell_size}}
2288 VoroNoise_Seed {{x*5}}
2289 "VoroNoise_aspect ratio" {{pixel_aspect}}
2290 VoroNoise_width {{width}}
2291 VoroNoise_height {{height}}
2292 rebuild_finalise ""
2293 name VoroNoise
2294 xpos 620
2295 ypos -520
2296 }
2297 Copy {
2298 inputs 2
2299 from0 rgba.red
2300 to0 forward.u
2301 from1 rgba.green
2302 to1 forward.v
2303 name Copy1
2304 xpos 620
2305 ypos -382
2306 disable {{parent.amplitude==0}}
2307 }
2308 IDistort {
2309 uv forward
2310 uv_offset 5.0000000000e-01
2311 uv_scale {{parent.amplitude} {uv_scale.w*pixel_aspect}}
2312 filter Impulse
2313 name IDistort1
2314 xpos 620
2315 ypos -280
2316 disable {{parent.amplitude==0}}
2317 }
2318 Dot {
2319 name Dot5
2320 xpos 654
2321 ypos -174
2322 }
2323set N4cc5b880 [stack 0]
2324 Dot {
2325 name Dot12
2326 xpos 764
2327 ypos -174
2328 }
2329set N4cc5b500 [stack 0]
2330 Dot {
2331 name Dot13
2332 xpos 764
2333 ypos 114
2334 }
2335push $N4cc5b500
2336 Dot {
2337 name Dot8
2338 xpos 874
2339 ypos -174
2340 }
2341 Blur {
2342 channels rgb
2343 size {{pixel_aspect} 1}
2344 name Blur1
2345 label "\[value size]"
2346 xpos 840
2347 ypos -88
2348 }
2349 Difference {
2350 inputs 2
2351 name Difference2
2352 xpos 840
2353 ypos 104
2354 }
2355 Expression {
2356 channel0 {none none none rgba.alpha}
2357 expr0 a>1e-9
2358 channel1 none
2359 channel2 none
2360 channel3 none
2361 name Expression2
2362 xpos 840
2363 ypos 206
2364 }
2365 Shuffle {
2366 red alpha
2367 green alpha
2368 blue alpha
2369 name Shuffle1
2370 label "\[value in]:\[value out]"
2371 xpos 840
2372 ypos 296
2373 }
2374 Dot {
2375 name Dot4
2376 xpos 874
2377 ypos 834
2378 }
2379push $N4cc5b880
2380 NoTimeBlur {
2381 name NoTimeBlur3
2382 xpos 620
2383 ypos -82
2384 }
2385 Transform {
2386 translate {{floor((x*size)%1*(size))-int(size/2) x1.0820000000e+03 0.0000000000e+00} {floor(x%1*(size))-int(size/2) x1.0820000000e+03 0.0000000000e+00}}
2387 center {1064 714}
2388 filter Impulse
2389 black_outside false
2390 name Transform1
2391 xpos 620
2392 ypos 14
2393 disable {{parent.edge_blend_size<1}}
2394 addUserKnob {20 User}
2395 addUserKnob {3 size}
2396 size {{parent.edge_blend_size+1}}
2397 }
2398 Dot {
2399 name Dot9
2400 xpos 654
2401 ypos 114
2402 }
2403set N45894e00 [stack 0]
2404push $N4534e000
2405 Expression {
2406 expr0 (x+.5)/width
2407 expr1 (y+.5)/height
2408 expr2 0
2409 name STMapGenerator
2410 xpos 400
2411 ypos -514
2412 }
2413 NoTimeBlur {
2414 name NoTimeBlur2
2415 xpos 400
2416 ypos -82
2417 }
2418 Merge2 {
2419 inputs 2
2420 operation from
2421 Achannels {rgba.red rgba.green -rgba.blue none}
2422 Bchannels {rgba.red rgba.green -rgba.blue none}
2423 output {rgba.red rgba.green -rgba.blue none}
2424 name Merge2
2425 xpos 400
2426 ypos 110
2427 }
2428 Dot {
2429 name Dot10
2430 xpos 434
2431 ypos 282
2432 }
2433push $N45894e00
2434 Expression {
2435 expr0 random(r*1000000,0)*(maxx-minx)+minx
2436 expr1 random(g*1000000,0)*(maxy-miny)+miny
2437 channel2 none
2438 channel3 none
2439 name Expression3
2440 selected true
2441 xpos 620
2442 ypos 182
2443 addUserKnob {20 User}
2444 addUserKnob {7 frequency R 0.000000000e+00 1.000000000e+02}
2445 frequency {{parent.parent.cell_size}}
2446 addUserKnob {7 multiplier R 0.000000000e+00 3.000000000e+00}
2447 multiplier 5.0000000000e-01
2448 addUserKnob {15 shrink}
2449 shrink {{frequency*multiplier+ceil(parent.edge_blend_size/2)+IDistort1.uv_scale.w/2} {frequency*multiplier+ceil(parent.edge_blend_size/2)+IDistort1.uv_scale.h/2} {frequency*multiplier+floor(parent.edge_blend_size/2)+IDistort1.uv_scale.w/2} {frequency*multiplier+floor(parent.edge_blend_size/2)+IDistort1.uv_scale.h/2}}
2450 addUserKnob {26 ""}
2451 addUserKnob {7 minx}
2452 minx {{(parent.box.x+shrink.x+.5)/width}}
2453 addUserKnob {7 maxx}
2454 maxx {{(parent.box.r-shrink.r+.5)/width}}
2455 addUserKnob {7 miny}
2456 miny {{(parent.box.y+shrink.y+.5)/height}}
2457 addUserKnob {7 maxy}
2458 maxy {{(parent.box.t-shrink.t+.5)/height}}
2459 }
2460 Merge2 {
2461 inputs 2
2462 operation plus
2463 Achannels {rgba.red rgba.green -rgba.blue none}
2464 Bchannels {rgba.red rgba.green -rgba.blue none}
2465 output {rgba.red rgba.green -rgba.blue none}
2466 name Merge3
2467 xpos 620
2468 ypos 278
2469 }
2470 Expression {
2471 expr0 r<minx?maxx-(minx-r):(r-minx)%(maxx-minx)+minx
2472 expr1 g<miny?maxy-(miny-g):(g-miny)%(maxy-miny)+miny
2473 channel2 none
2474 channel3 none
2475 name Expression7
2476 xpos 620
2477 ypos 350
2478 addUserKnob {20 User}
2479 addUserKnob {7 minx}
2480 minx {{(parent.box.x+rint(x%1*parent.edge_blend_size)+.5)/width}}
2481 addUserKnob {7 maxx}
2482 maxx {{(parent.box.r+rint(x%1*parent.edge_blend_size)+.5)/width}}
2483 addUserKnob {7 miny}
2484 miny {{(parent.box.y+rint(x%1*parent.edge_blend_size)+.5)/height}}
2485 addUserKnob {7 maxy}
2486 maxy {{(parent.box.t+rint(x%1*parent.edge_blend_size)+.5)/height}}
2487 }
2488 Dot {
2489 name Dot3
2490 xpos 654
2491 ypos 426
2492 }
2493 Input {
2494 inputs 0
2495 name Input1
2496 xpos 180
2497 ypos -664
2498 }
2499 FrameHold {
2500 first_frame {{parent.sample_frame}}
2501 name FrameHold1
2502 xpos 180
2503 ypos -184
2504 }
2505 NoTimeBlur {
2506 name NoTimeBlur1
2507 xpos 180
2508 ypos -82
2509 }
2510 STMap {
2511 inputs 2
2512 channels rgb
2513 uv rgb
2514 filter Impulse
2515 name STMap1
2516 xpos 180
2517 ypos 422
2518 }
2519set N43fc5c00 [stack 0]
2520 TimeBlur {
2521 divisions {{max(Transform1.size==1?2:pow2(Transform1.size),1)}}
2522 shutter 1
2523 shuttercustomoffset {{1/divisions/2}}
2524 name TimeBlur1
2525 xpos 180
2526 ypos 518
2527 disable {{parent.edge_blend_size<1}}
2528 }
2529set N43fc5880 [stack 0]
2530push $N43fc5c00
2531 Dot {
2532 name Dot1
2533 xpos -6
2534 ypos 426
2535 }
2536 Difference {
2537 inputs 2
2538 name Difference1
2539 xpos -40
2540 ypos 512
2541 }
2542 Expression {
2543 channel0 {none none none rgba.alpha}
2544 expr0 a>1e-10
2545 channel1 none
2546 channel2 none
2547 channel3 none
2548 name Expression1
2549 xpos -40
2550 ypos 566
2551 }
2552 Blur {
2553 channels alpha
2554 size {{parent.parent.edge_blend_size}}
2555 name Blur2
2556 xpos -40
2557 ypos 608
2558 }
2559 Grade {
2560 channels alpha
2561 blackpoint 5.0000000000e-01
2562 white_clamp true
2563 name Grade2
2564 xpos -40
2565 ypos 656
2566 }
2567 Dot {
2568 name Dot2
2569 xpos -6
2570 ypos 738
2571 }
2572push $N43fc5880
2573 Grade {
2574 inputs 1+1
2575 white 1.4000000000e+00
2576 black_clamp false
2577 name Grade1
2578 xpos 180
2579 ypos 734
2580 disable {{parent.edge_blend_size<1}}
2581 }
2582 Merge2 {
2583 inputs 2
2584 Achannels rgb
2585 Bchannels rgb
2586 output rgb
2587 name Merge1
2588 xpos 180
2589 ypos 830
2590 disable {{!parent.overlay_pattern}}
2591 }
2592 Assert {
2593 expression {{"Expression3.maxx>Expression3.minx && Expression3.maxy>Expression3.miny"}}
2594 message "increase sample box size or decrease cell size"
2595 name error
2596 xpos 180
2597 ypos 926
2598 }
2599 Output {
2600 name Output1
2601 xpos 180
2602 ypos 1022
2603 }
2604 end_group
2605 Multiply {
2606 inputs 1+1
2607 channels rgb
2608 value 1.8000000000e+00
2609 maskChannelMask {{{parent.Merge9.maskChannelMask}}}
2610 invert_mask {{!Merge9.invert_mask}}
2611 name Multiply7
2612 xpos 70
2613 ypos 2123
2614 disable {{"!maskChannelMask || !\[exists parent.input3.name]"}}
2615 }
2616 Dot {
2617 name Dot23
2618 xpos 104
2619 ypos 2199
2620 }
2621push $N2162c380
2622push $N4534ee00
2623 Multiply {
2624 inputs 1+1
2625 channels rgb
2626 value 1.8000000000e+00
2627 maskChannelMask {{{parent.Merge9.maskChannelMask}}}
2628 invert_mask {{parent.Merge9.invert_mask}}
2629 name Multiply2
2630 xpos 290
2631 ypos 2123
2632 disable {{"!maskChannelMask || (!parent.scatter && !parent.external_grain)"}}
2633 }
2634 Merge2 {
2635 inputs 2+1
2636 operation copy
2637 Achannels rgb
2638 Bchannels rgb
2639 output rgb
2640 maskChannelMask -rgba.alpha
2641 name Merge9
2642 xpos 290
2643 ypos 2195
2644 disable {{"!(parent.scatter || parent.external_grain)"}}
2645 }
2646 Dot {
2647 name Dot11
2648 xpos 324
2649 ypos 2298
2650 }
2651set N21d8c000 [stack 0]
2652push $N2162d880
2653 Dot {
2654 name Dot40
2655 xpos 874
2656 ypos 258
2657 }
2658push $N442b1880
2659 Dot {
2660 name Dot34
2661 xpos 624
2662 ypos 378
2663 }
2664 Multiply {
2665 inputs 1+1
2666 channels rgb
2667 value 0
2668 maskChannelMask -rgba.red
2669 name Multiply1
2670 xpos 840
2671 ypos 374
2672 }
2673 Input {
2674 inputs 0
2675 name COMP
2676 label "\[value number]"
2677 note_font_size 30
2678 xpos 950
2679 ypos -680
2680 }
2681 Dot {
2682 name Dot44
2683 xpos 984
2684 ypos -198
2685 }
2686set N43146e00 [stack 0]
2687 Merge2 {
2688 inputs 2
2689 operation from
2690 bbox B
2691 Achannels rgb
2692 Bchannels rgb
2693 output rgb
2694 name Merge8
2695 xpos 950
2696 ypos 374
2697 disable {{"Multiply6.value.r==0 || parent.fix_ghosting == 1"}}
2698 }
2699 Dot {
2700 name Dot18
2701 xpos 984
2702 ypos 2466
2703 }
2704set N43146700 [stack 0]
2705clone $C442b0e00 {
2706 xpos 730
2707 ypos 2462
2708 selected false
2709 }
2710 Multiply {
2711 channels rgb
2712 value {{1/Expression.temp_expr0}}
2713 name Multiply5
2714 xpos 400
2715 ypos 2462
2716 }
2717 Merge2 {
2718 inputs 2
2719 operation multiply
2720 bbox B
2721 Achannels rgb
2722 Bchannels rgb
2723 output rgb
2724 name Merge1
2725 xpos 290
2726 ypos 2462
2727 }
2728 Dot {
2729 name Dot8
2730 xpos 324
2731 ypos 2658
2732 }
2733push $N43146700
2734 Merge2 {
2735 inputs 2
2736 operation plus
2737 bbox B
2738 Achannels rgb
2739 Bchannels rgb
2740 output rgb
2741 name Merge3
2742 xpos 950
2743 ypos 2654
2744 }
2745set N4c7c5500 [stack 0]
2746 Dot {
2747 name Dot19
2748 xpos 984
2749 ypos 2802
2750 }
2751set N4c7c5180 [stack 0]
2752 Dot {
2753 name Dot41
2754 xpos 1204
2755 ypos 2802
2756 }
2757set N4c7c4e00 [stack 0]
2758 Dot {
2759 name Dot36
2760 xpos 1314
2761 ypos 2802
2762 }
2763 Blur {
2764 channels rgb
2765 size 1
2766 name Blur1
2767 xpos 1280
2768 ypos 2894
2769 }
2770push $N4c7c4e00
2771 Merge2 {
2772 inputs 2
2773 operation difference
2774 bbox B
2775 Achannels rgb
2776 Bchannels rgb
2777 output rgb
2778 name Merge10
2779 xpos 1170
2780 ypos 2894
2781 }
2782 Multiply {
2783 channels rgb
2784 value 50
2785 name Multiply3
2786 xpos 1170
2787 ypos 2942
2788 }
2789 Dot {
2790 name Dot43
2791 xpos 1204
2792 ypos 3042
2793 }
2794push $N43146e00
2795 Dot {
2796 name Dot45
2797 xpos 1424
2798 ypos -198
2799 }
2800push $N4c7c5500
2801 Merge2 {
2802 inputs 2
2803 operation from
2804 Achannels rgb
2805 Bchannels rgb
2806 output rgb
2807 name Merge11
2808 xpos 1390
2809 ypos 2654
2810 }
2811 Dot {
2812 name Dot46
2813 xpos 1424
2814 ypos 3162
2815 }
2816push $N21d8c000
2817 Dot {
2818 name Dot14
2819 xpos 104
2820 ypos 2298
2821 }
2822 Dot {
2823 name Dot12
2824 xpos 104
2825 ypos 3042
2826 }
2827push $N3bea7180
2828 Dot {
2829 name Dot47
2830 xpos -556
2831 ypos -390
2832 }
2833push $N3b26d880
2834 Merge2 {
2835 inputs 2
2836 operation from
2837 Achannels rgb
2838 Bchannels rgb
2839 output rgb
2840 name Merge12
2841 xpos -590
2842 ypos -202
2843 }
2844 Dot {
2845 name Dot10
2846 xpos -556
2847 ypos 3162
2848 }
2849push $N4c7c5180
2850 Switch {
2851 inputs 5
2852 which {{output}}
2853 name Output
2854 xpos 950
2855 ypos 3296
2856 addUserKnob {20 User}
2857 addUserKnob {4 output M {"regrained comp" "original grain" "normalised grain" "adapted grain" "grain QC"}}
2858 }
2859 Output {
2860 name Output1
2861 xpos 950
2862 ypos 3494
2863 }
2864push $N442b1180
2865 Colorspace {
2866 colorspace_out AlexaV3LogC
2867 name Colorspace5
2868 xpos 70
2869 ypos 518
2870 }
2871 Clamp {
2872 maximum_enable false
2873 name Clamp2
2874 xpos -40
2875 ypos 512
2876 }
2877 Dot {
2878 name Dot1
2879 xpos -116
2880 ypos 522
2881 }
2882set N3fda0e00 [stack 0]
2883 Dot {
2884 name Dot16
2885 xpos -336
2886 ypos 522
2887 }
2888 TimeWarp {
2889 lookup 1
2890 time ""
2891 filter nearest
2892 name TimeWarp1
2893 xpos -370
2894 ypos 686
2895 disable true
2896 }
2897 CurveTool {
2898 operation "Max Luma Pixel"
2899 ROI {0 0 {width} {height}}
2900 autocropdata {512 389 1536 1167}
2901 maxlumapixdata {1006 888}
2902 maxlumapixvalue {5.7063150406e-01 5.7063150406e-01 5.7063150406e-01}
2903 minlumapixdata {1909 36}
2904 minlumapixvalue {1.1077204347e-01 1.1845003068e-01 1.2062158436e-01}
2905 name CurveTool_Range
2906 xpos -370
2907 ypos 734
2908 }
2909push $N2162d500
2910 Invert {
2911 name Invert2
2912 xpos 180
2913 ypos 1064
2914 disable {{!parent.invert_1}}
2915 }
2916push $N4534f880
2917 Dot {
2918 name Dot5
2919 xpos 104
2920 ypos 786
2921 }
2922 Reformat {
2923 inputs 0
2924 type "to box"
2925 box_width {{Dot1.width}}
2926 box_height {{Dot1.height}}
2927 box_fixed true
2928 box_pixel_aspect {{Dot1.pixel_aspect}}
2929 name Reformat1
2930 xpos -40
2931 ypos 686
2932 }
2933 Dot {
2934 name Dot42
2935 xpos -6
2936 ypos 786
2937 }
2938set N459f3500 [stack 0]
2939 Copy {
2940 inputs 2
2941 from0 {{{parent.Copy2.from0}}}
2942 to0 rgba.red
2943 name Copy3
2944 xpos 70
2945 ypos 848
2946 }
2947 Expression {
2948 expr0 abs(r)
2949 channel1 {none none none rgba.alpha}
2950 expr1 r==0
2951 channel2 none
2952 channel3 none
2953 name Expression4
2954 xpos 70
2955 ypos 926
2956 }
2957set N459f2e00 [stack 0]
2958push $N3fda0e00
2959push $N459f3500
2960 Copy {
2961 inputs 2
2962 from0 rgba.blue
2963 to0 rgba.red
2964 name Copy2
2965 xpos -150
2966 ypos 848
2967 }
2968 Expression {
2969 temp_name0 min
2970 temp_expr0 0.548131008074
2971 temp_name1 max
2972 temp_expr1 0.570631504059
2973 channel0 {none none none rgba.alpha}
2974 expr0 "r>=min && r<=max"
2975 channel1 none
2976 channel2 none
2977 channel3 none
2978 name Expression2
2979 xpos -150
2980 ypos 926
2981 }
2982 Dot {
2983 name Dot4
2984 xpos -116
2985 ypos 1002
2986 }
2987 ChannelMerge {
2988 inputs 2
2989 operation stencil
2990 name ChannelMerge2
2991 xpos -40
2992 ypos 985
2993 }
2994push $N459f2e00
2995 Copy {
2996 inputs 2
2997 from0 rgba.alpha
2998 to0 rgba.alpha
2999 name Copy1
3000 xpos 70
3001 ypos 992
3002 }
3003 ChannelMerge {
3004 inputs 2
3005 A -rgba.green
3006 operation multiply
3007 name ChannelMerge1
3008 xpos 70
3009 ypos 1057
3010 disable {{!A}}
3011 }
3012 Premult {
3013 channels {rgba.red -rgba.green -rgba.blue none}
3014 name Premult1
3015 xpos 70
3016 ypos 1142
3017 }
3018 TimeWarp {
3019 lookup {{parent.TimeWarp1.lookup}}
3020 time ""
3021 filter nearest
3022 name TimeWarp2
3023 xpos 70
3024 ypos 1190
3025 disable true
3026 }
3027 FrameBlend {
3028 channels {rgba.red -rgba.green -rgba.blue rgba.alpha}
3029 numframes 1
3030 name FrameBlend1
3031 xpos 70
3032 ypos 1232
3033 disable true
3034 }
3035 CurveTool {
3036 avgframes 0
3037 channels {rgba.red -rgba.green -rgba.blue rgba.alpha}
3038 ROI {0 0 {width} {height}}
3039 autocropdata {512 389 1536 1167}
3040 intensitydata {4.2568965252e-05 0 0 1.8952546296e-03}
3041 name CurveTool
3042 xpos 70
3043 ypos 1280
3044 }
3045end_group
3046Viewer {
3047 inputs 4
3048 frame 1
3049 frame_range 1-1
3050 colour_sample_bbox {9.0312498808e-01 4.0416666865e-01 9.6875000000e-01 4.8124998808e-01}
3051 name Viewer1
3052 selected true
3053 xpos 49
3054 ypos 321
3055}