Advertisement
Guest User

X_Aton_edited

a guest
Nov 24th, 2017
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.56 KB | None | 0 0
  1. set cut_paste_input [stack 0]
  2. version 10.0 v4
  3. push $cut_paste_input
  4. Text2 {
  5. font_size_toolbar 100
  6. font_width_toolbar 100
  7. font_height_toolbar 100
  8. message Test
  9. old_message {{84 101 115 116}
  10. }
  11. box {630 277.000061 812 378.000061}
  12. transforms {{0 2}
  13. }
  14. cursor_position 4
  15. center {960 540}
  16. cursor_initialised true
  17. initial_cursor_position {{630 378.000061}
  18. }
  19. group_animations {{0} imported: 0 selected: 0 items: "root transform/"}
  20. animation_layers {{1 11 960 540 0 0 1 1 0 0 0 0}
  21. }
  22. name Text1
  23. selected true
  24. xpos 652
  25. ypos -11
  26. }
  27. Transform {
  28. translate {-698 182}
  29. center {960 540}
  30. shutteroffset centred
  31. name Transform1
  32. label "\[if \{\[value translate.x] != 0 || \[value translate.y] != 0\} then \{return \"t \[value translate.x] \[value translate.y]\n\"\} else \{return \"\"\}]\[if \{\[value rotate] != 0\} then \{return \"r \[value rotate]\n\"\} else \{return \"\"\}] \[if \{\[value scale] != 1\} then \{return \"s \[value scale]\"\} else \{return \"\"\}]\[if \{\[value skewX] != 0 || \[value skewY] != 0\} then \{return \"sk \[value skewX] \[value skewY]\n\"\} else \{return \"\"\}]\[if \{\[value motionblur] != 0\} then \{return \"mb \[value motionblur] sh \[value shutter] \[value shutteroffset]\n\"\} else \{return \"\"\}]"
  33. selected true
  34. xpos 652
  35. ypos 15
  36. }
  37. Group {
  38. name X_Aton1
  39. 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))"
  40. selected true
  41. xpos 652
  42. ypos 92
  43. addUserKnob {20 X_Aton}
  44. addUserKnob {41 "Local GPU: " T BlinkScript1.gpuName}
  45. addUserKnob {41 "Use GPU if Available" T BlinkScript1.useGPUIfAvailable}
  46. addUserKnob {26 ""}
  47. addUserKnob {12 center t "The point from which rays will be emitted."}
  48. center {18 394}
  49. 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}
  50. 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 10}
  51. length 2
  52. addUserKnob {26 ""}
  53. 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 ""}}
  54. 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 10}
  55. decay 1
  56. 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 100}
  57. diffuse 50
  58. addUserKnob {26 ""}
  59. addUserKnob {18 multiply t "Makes everything brighter or darker in a linear fashion." R 0.2 4}
  60. multiply 1
  61. addUserKnob {6 multiply_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
  62. 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 0.2 4}
  63. gamma 1
  64. addUserKnob {6 gamma_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
  65. addUserKnob {26 ""}
  66. 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 100}
  67. iterations 100
  68. 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}
  69. 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}
  70. normalize true
  71. addUserKnob {26 ""}
  72. addUserKnob {20 GPU_Settings l "GPU Settings"}
  73. addUserKnob {41 maxGPUMemory l "Percentage of GPU memory to use" T BlinkScript1.maxGPUMemory}
  74. addUserKnob {41 maxTileLines l "Percentage of image height per tile" T BlinkScript1.maxTileLines}
  75. addUserKnob {20 about l About}
  76. addUserKnob {26 about_1 l "" t "A bunny:\n(\\(\\ \n( - -)\n((') (')" +STARTLINE T "<br>\n<b>Xavier Martín © 2017</b>"}
  77. addUserKnob {26 ""}
  78. addUserKnob {26 website l "" +STARTLINE T "<a href=\"http://www.xaviermartinvfx.com\"><span style=\"color:#C8C8C8;\">www.xaviermartinvfx.com</span></a>"}
  79. addUserKnob {26 space4_1 l "" +STARTLINE T <br>}
  80. 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}
  81. 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>.')"}
  82. }
  83. BackdropNode {
  84. inputs 0
  85. name kbd
  86. tile_color 0x5d5e5965
  87. label "BBOX_Cheat\nExpands the BBox to \nthe longest rays, but \nnot further than the \ncanvas. Still preserves\nthe area outside the \ncanvas if in input. "
  88. note_font_size 40
  89. xpos 2
  90. ypos -709
  91. bdwidth 425
  92. bdheight 486
  93. }
  94. Input {
  95. inputs 0
  96. name InputLight
  97. xpos -540
  98. ypos -560
  99. number 1
  100. }
  101. Input {
  102. inputs 0
  103. name InputCamera
  104. xpos -440
  105. ypos -560
  106. number 2
  107. }
  108. Dot {
  109. name Dot11
  110. xpos -406
  111. ypos -456
  112. }
  113. Input {
  114. inputs 0
  115. name Input
  116. xpos -740
  117. ypos -558
  118. }
  119. Dot {
  120. name Dot3
  121. xpos -706
  122. ypos -506
  123. }
  124. set Na591630 [stack 0]
  125. Dot {
  126. name Dot9
  127. xpos -606
  128. ypos -506
  129. }
  130. Dot {
  131. name Dot10
  132. xpos -606
  133. ypos -456
  134. }
  135. Reconcile3D {
  136. inputs 3
  137. calc_output true
  138. name Reconcile3D1
  139. xpos -540
  140. ypos -466
  141. }
  142. push $Na591630
  143. Remove {
  144. operation keep
  145. channels rgba
  146. name Remove1
  147. xpos -740
  148. ypos -460
  149. }
  150. Gamma {
  151. channels rgb
  152. value {{1/parent.gamma} {1/parent.gamma} {1/parent.gamma} 1}
  153. name Gamma1
  154. xpos -740
  155. ypos -410
  156. }
  157. Dot {
  158. name Dot12
  159. tile_color 0xcccccc00
  160. xpos -706
  161. ypos -384
  162. }
  163. set Nbce50f0 [stack 0]
  164. Dot {
  165. name Dot13
  166. tile_color 0xcccccc00
  167. xpos 64
  168. ypos -384
  169. }
  170. set N7921cc0 [stack 0]
  171. Transform {
  172. scale {{1+parent.length}}
  173. center {{parent.center} {parent.center}}
  174. shutteroffset centred
  175. name Transform1
  176. label "\[if \{\[value translate.x] != 0 || \[value translate.y] != 0\} then \{return \"t \[value translate.x] \[value translate.y]\n\"\} else \{return \"\"\}]\[if \{\[value rotate] != 0\} then \{return \"r \[value rotate]\n\"\} else \{return \"\"\}] \[if \{\[value scale] != 1\} then \{return \"s \[value scale]\"\} else \{return \"\"\}]\[if \{\[value skewX] != 0 || \[value skewY] != 0\} then \{return \"sk \[value skewX] \[value skewY]\n\"\} else \{return \"\"\}]\[if \{\[value motionblur] != 0\} then \{return \"mb \[value motionblur] sh \[value shutter] \[value shutteroffset]\n\"\} else \{return \"\"\}]"
  177. xpos 133
  178. ypos -394
  179. }
  180. set Nbc668d0 [stack 0]
  181. Crop {
  182. box {{curve} {curve} {width} {height}}
  183. crop false
  184. name Crop1
  185. xpos 263
  186. ypos -388
  187. }
  188. Dot {
  189. name Dot15
  190. tile_color 0xa57aaa00
  191. xpos 297
  192. ypos -342
  193. }
  194. push $Nbc668d0
  195. Merge2 {
  196. inputs 2
  197. bbox intersection
  198. name Merge3
  199. xpos 130
  200. ypos -346
  201. }
  202. Dot {
  203. name Dot14
  204. tile_color 0x4b5ec600
  205. xpos 164
  206. ypos -300
  207. }
  208. push $N7921cc0
  209. Merge2 {
  210. inputs 2
  211. name Merge2
  212. xpos 30
  213. ypos -304
  214. }
  215. Dot {
  216. name Dot16
  217. tile_color 0x4b5ec600
  218. xpos 64
  219. ypos -254
  220. }
  221. set N78c79130 [stack 0]
  222. push $Nbce50f0
  223. Dot {
  224. name Dot2
  225. tile_color 0xcccccc00
  226. xpos -706
  227. ypos -356
  228. }
  229. set Na5c89a0 [stack 0]
  230. Blur {
  231. channels rgba
  232. size {{diffuse*sqrt(length)}}
  233. name Blur5
  234. xpos -240
  235. ypos -313
  236. }
  237. CopyBBox {
  238. inputs 2
  239. name CopyBBox2
  240. xpos -240
  241. ypos -258
  242. }
  243. Reformat {
  244. type scale
  245. scale 0.125
  246. pbb true
  247. name Reformat1
  248. xpos -240
  249. ypos -210
  250. }
  251. set Na5e8770 [stack 0]
  252. push $N78c79130
  253. push $Na5c89a0
  254. Blur {
  255. channels rgba
  256. size {{parent.Blur5.size/2}}
  257. name Blur4
  258. xpos -340
  259. ypos -310
  260. }
  261. CopyBBox {
  262. inputs 2
  263. name CopyBBox3
  264. xpos -340
  265. ypos -258
  266. }
  267. Reformat {
  268. type scale
  269. scale 0.25
  270. pbb true
  271. name Reformat5
  272. xpos -340
  273. ypos -210
  274. }
  275. set Na60c370 [stack 0]
  276. push $N78c79130
  277. push $Na5c89a0
  278. Blur {
  279. channels rgba
  280. size {{parent.Blur4.size/2}}
  281. name Blur3
  282. xpos -440
  283. ypos -310
  284. }
  285. CopyBBox {
  286. inputs 2
  287. name CopyBBox4
  288. xpos -440
  289. ypos -258
  290. }
  291. Reformat {
  292. type scale
  293. scale 0.5
  294. pbb true
  295. name Reformat4
  296. xpos -440
  297. ypos -210
  298. }
  299. set Na62fe30 [stack 0]
  300. push $N78c79130
  301. push $Na5c89a0
  302. Blur {
  303. channels rgba
  304. size {{parent.Blur3.size/2}}
  305. name Blur2
  306. xpos -540
  307. ypos -310
  308. }
  309. CopyBBox {
  310. inputs 2
  311. name CopyBBox5
  312. xpos -540
  313. ypos -258
  314. }
  315. Reformat {
  316. type scale
  317. scale 0.6
  318. pbb true
  319. name Reformat3
  320. xpos -540
  321. ypos -210
  322. }
  323. set Na653980 [stack 0]
  324. push $N78c79130
  325. push $Na5c89a0
  326. Blur {
  327. channels rgb
  328. size {{parent.Blur2.size/2}}
  329. name Blur1
  330. xpos -640
  331. ypos -310
  332. }
  333. CopyBBox {
  334. inputs 2
  335. name CopyBBox1
  336. xpos -640
  337. ypos -258
  338. }
  339. Reformat {
  340. type scale
  341. scale 0.8
  342. pbb true
  343. name Reformat2
  344. xpos -640
  345. ypos -210
  346. }
  347. set Na677440 [stack 0]
  348. push $Na5c89a0
  349. Dot {
  350. name Dot1
  351. tile_color 0xcccccc00
  352. xpos -706
  353. ypos -306
  354. }
  355. set Na5cd2c0 [stack 0]
  356. BlinkScript {
  357. inputs 6
  358. ProgramGroup 1
  359. 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=="
  360. 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\};"
  361. useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
  362. rebuild ""
  363. X_Aton_size {{parent.length}}
  364. X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
  365. X_Aton_iterations {{parent.iterations}}
  366. X_Aton_decay {{parent.decay}}
  367. X_Aton_normalize_output {{parent.normalize}}
  368. rebuild_finalise ""
  369. maxTileLines 100
  370. name BlinkScript2
  371. xpos -601
  372. ypos -113
  373. }
  374. push $Na5e8770
  375. push $Na60c370
  376. push $Na62fe30
  377. push $Na653980
  378. push $Na677440
  379. push $N78c79130
  380. push $Na5cd2c0
  381. CopyBBox {
  382. inputs 2
  383. name CopyBBox6
  384. xpos -740
  385. ypos -258
  386. }
  387. set N7700e6f0 [stack 0]
  388. BlinkScript {
  389. inputs 6
  390. ProgramGroup 1
  391. 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=="
  392. 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\};"
  393. rebuild ""
  394. X_Aton_size {{length}}
  395. X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
  396. X_Aton_iterations {{iterations}}
  397. X_Aton_decay {{decay}}
  398. X_Aton_normalize_output {{normalize}}
  399. rebuild_finalise ""
  400. maxTileLines 100
  401. name BlinkScript1
  402. onCreate "n = nuke.thisNode()\nn\[\"X_Aton_center\"].setFlag(0x00008000)"
  403. xpos -740
  404. ypos -116
  405. }
  406. Switch {
  407. inputs 2
  408. which {{parent.bilinear_interpolation}}
  409. name Switch2
  410. xpos -740
  411. ypos -60
  412. }
  413. push $N7700e6f0
  414. Dot {
  415. name Dot6
  416. tile_color 0x9e3c6300
  417. xpos -806
  418. ypos -254
  419. }
  420. Dot {
  421. name Dot8
  422. tile_color 0x9e3c6300
  423. xpos -806
  424. ypos -156
  425. }
  426. set Nb6e4b80 [stack 0]
  427. Dot {
  428. name Dot7
  429. tile_color 0x9e3c6300
  430. xpos -906
  431. ypos -156
  432. }
  433. BlinkScript {
  434. recompileCount 19
  435. ProgramGroup 1
  436. KernelDescription "2 \"X_Aton\" iterate componentWise 80f2464358c1acfc45bb079569dbeda3220b6389e4e6b486ddcb2a8d9e5d101d 2 \"src\" Read Random \"dst\" Write Point 7 \"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== \"proxy\" Float 1 AAAAAA== 7 \"size\" 1 1 \"center\" 2 1 \"iterations\" 1 1 \"decay\" 1 1 \"normalize_output\" 1 1 \"mode\" 1 1 \"proxy\" 1 1 2 \"normal\" Float 1 1 AAAAAA== \"centerP\" Float 2 1 AAAAAAAAAAA="
  437. 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 float proxy;\n local:\n float normal = 0.0f;\n float2 centerP;\n\n void init() \{\n centerP = center*proxy;\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\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-centerP.x,pos.y-centerP.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+centerP.x);\n posy = ((currentpos.y)/scale+centerP.y);\n total += bilinear(src,posx,posy)*pow((1-float(i)/iterations),decay);\n \}\n dst() = total/normal;\n // dst() = currentpos.x;\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"
  438. useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
  439. rebuild ""
  440. X_Aton_size {{length}}
  441. X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
  442. X_Aton_iterations {{iterations}}
  443. X_Aton_decay {{decay}}
  444. X_Aton_normalize_output {{normalize}}
  445. X_Aton_mode {{(parent.mode!=3)?parent.mode:parent.mode*(parent.diffuse!=0)}}
  446. X_Aton_proxy {{"\[python -execlocal root\\ =\\ nuke.root()\\n\\nif\\ not\\ root\\\['proxy'\\].value():\\n\\ \\ \\ \\ ret\\ =\\ 1\\nelif\\ root\\\['proxy_type'\\].value()\\ ==\\ 'format':\\n\\ \\ \\ \\ full\\ =\\ float(root\\\['format'\\].value().width())\\n\\ \\ \\ \\ proxy\\ =\\ float(root\\\['proxy_format'\\].value().width())\\n\\ \\ \\ \\ ret\\ =\\ proxy/full\\nelse:\\n\\ \\ \\ \\ ret\\ =\\ root\\\['proxy_scale'\\].value(0)]"}}
  447. rebuild_finalise ""
  448. maxTileLines 100
  449. name BlinkScript4
  450. tile_color 0xd600ff
  451. label "Modified for Proxy"
  452. xpos -940
  453. ypos -115
  454. }
  455. set Nb6ee010 [stack 0]
  456. push $Nb6e4b80
  457. BlinkScript {
  458. ProgramGroup 1
  459. 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=="
  460. 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"
  461. useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
  462. rebuild ""
  463. X_Aton_size {{length}}
  464. X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
  465. X_Aton_iterations {{iterations}}
  466. X_Aton_decay {{decay}}
  467. X_Aton_normalize_output {{normalize}}
  468. X_Aton_mode {{(parent.mode!=3)?parent.mode:parent.mode*(parent.diffuse!=0)}}
  469. rebuild_finalise ""
  470. maxTileLines 100
  471. name BlinkScript3
  472. xpos -840
  473. ypos -116
  474. }
  475. Switch {
  476. inputs 2
  477. which {{parent.bilinear_interpolation}}
  478. name Switch3
  479. xpos -840
  480. ypos -60
  481. }
  482. Switch {
  483. inputs 2
  484. which {{(mode==3)*(diffuse!=0)}}
  485. name Switch1
  486. xpos -740
  487. ypos -10
  488. }
  489. Grade {
  490. multiply {{1/parent.multiply} {1/parent.multiply} {1/parent.multiply} 1}
  491. gamma {{1/parent.gamma} {1/parent.gamma} {1/parent.gamma} 1}
  492. reverse true
  493. name Grade1
  494. xpos -740
  495. ypos 40
  496. }
  497. push $Na591630
  498. Dot {
  499. name Dot5
  500. xpos -1006
  501. ypos -506
  502. }
  503. Dot {
  504. name Dot4
  505. xpos -1006
  506. ypos 94
  507. }
  508. Merge2 {
  509. inputs 2
  510. operation copy
  511. name Merge1
  512. xpos -740
  513. ypos 88
  514. }
  515. Output {
  516. name Output1
  517. xpos -740
  518. ypos 140
  519. }
  520. push $Nb6ee010
  521. push $Nb6ee010
  522. Viewer {
  523. inputs 2
  524. frame_range 1-100
  525. colour_sample_bbox {-0.2958333194 -0.2166666687 -0.2947916687 -0.215625003}
  526. samplepoints {{-0.2958333194 -0.2166666687}
  527. }
  528. viewerProcess "rec709 (default)"
  529. name Viewer1
  530. xpos -33
  531. ypos -132
  532. }
  533. end_group
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement