Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set cut_paste_input [stack 0]
- version 10.0 v4
- push $cut_paste_input
- Text2 {
- font_size_toolbar 100
- font_width_toolbar 100
- font_height_toolbar 100
- message Test
- old_message {{84 101 115 116}
- }
- box {630 277.000061 812 378.000061}
- transforms {{0 2}
- }
- cursor_position 4
- center {960 540}
- cursor_initialised true
- initial_cursor_position {{630 378.000061}
- }
- group_animations {{0} imported: 0 selected: 0 items: "root transform/"}
- animation_layers {{1 11 960 540 0 0 1 1 0 0 0 0}
- }
- name Text1
- selected true
- xpos 652
- ypos -11
- }
- Transform {
- translate {-698 182}
- center {960 540}
- shutteroffset centred
- name Transform1
- 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 \"\"\}]"
- selected true
- xpos 652
- ypos 15
- }
- Group {
- name X_Aton1
- 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))"
- selected true
- xpos 652
- ypos 92
- addUserKnob {20 X_Aton}
- addUserKnob {41 "Local GPU: " T BlinkScript1.gpuName}
- addUserKnob {41 "Use GPU if Available" T BlinkScript1.useGPUIfAvailable}
- addUserKnob {26 ""}
- addUserKnob {12 center t "The point from which rays will be emitted."}
- center {18 394}
- 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}
- 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}
- length 2
- addUserKnob {26 ""}
- 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 ""}}
- 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}
- decay 1
- 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}
- diffuse 50
- addUserKnob {26 ""}
- addUserKnob {18 multiply t "Makes everything brighter or darker in a linear fashion." R 0.2 4}
- multiply 1
- addUserKnob {6 multiply_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
- 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}
- gamma 1
- addUserKnob {6 gamma_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
- addUserKnob {26 ""}
- 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}
- iterations 100
- 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}
- 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}
- normalize true
- addUserKnob {26 ""}
- addUserKnob {20 GPU_Settings l "GPU Settings"}
- addUserKnob {41 maxGPUMemory l "Percentage of GPU memory to use" T BlinkScript1.maxGPUMemory}
- addUserKnob {41 maxTileLines l "Percentage of image height per tile" T BlinkScript1.maxTileLines}
- addUserKnob {20 about l About}
- addUserKnob {26 about_1 l "" t "A bunny:\n(\\(\\ \n( - -)\n((') (')" +STARTLINE T "<br>\n<b>Xavier Martín © 2017</b>"}
- addUserKnob {26 ""}
- addUserKnob {26 website l "" +STARTLINE T "<a href=\"http://www.xaviermartinvfx.com\"><span style=\"color:#C8C8C8;\">www.xaviermartinvfx.com</span></a>"}
- addUserKnob {26 space4_1 l "" +STARTLINE T <br>}
- 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}
- 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>.')"}
- }
- BackdropNode {
- inputs 0
- name kbd
- tile_color 0x5d5e5965
- 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. "
- note_font_size 40
- xpos 2
- ypos -709
- bdwidth 425
- bdheight 486
- }
- Input {
- inputs 0
- name InputLight
- xpos -540
- ypos -560
- number 1
- }
- Input {
- inputs 0
- name InputCamera
- xpos -440
- ypos -560
- number 2
- }
- Dot {
- name Dot11
- xpos -406
- ypos -456
- }
- Input {
- inputs 0
- name Input
- xpos -740
- ypos -558
- }
- Dot {
- name Dot3
- xpos -706
- ypos -506
- }
- set Na591630 [stack 0]
- Dot {
- name Dot9
- xpos -606
- ypos -506
- }
- Dot {
- name Dot10
- xpos -606
- ypos -456
- }
- Reconcile3D {
- inputs 3
- calc_output true
- name Reconcile3D1
- xpos -540
- ypos -466
- }
- push $Na591630
- Remove {
- operation keep
- channels rgba
- name Remove1
- xpos -740
- ypos -460
- }
- Gamma {
- channels rgb
- value {{1/parent.gamma} {1/parent.gamma} {1/parent.gamma} 1}
- name Gamma1
- xpos -740
- ypos -410
- }
- Dot {
- name Dot12
- tile_color 0xcccccc00
- xpos -706
- ypos -384
- }
- set Nbce50f0 [stack 0]
- Dot {
- name Dot13
- tile_color 0xcccccc00
- xpos 64
- ypos -384
- }
- set N7921cc0 [stack 0]
- Transform {
- scale {{1+parent.length}}
- center {{parent.center} {parent.center}}
- shutteroffset centred
- name Transform1
- 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 \"\"\}]"
- xpos 133
- ypos -394
- }
- set Nbc668d0 [stack 0]
- Crop {
- box {{curve} {curve} {width} {height}}
- crop false
- name Crop1
- xpos 263
- ypos -388
- }
- Dot {
- name Dot15
- tile_color 0xa57aaa00
- xpos 297
- ypos -342
- }
- push $Nbc668d0
- Merge2 {
- inputs 2
- bbox intersection
- name Merge3
- xpos 130
- ypos -346
- }
- Dot {
- name Dot14
- tile_color 0x4b5ec600
- xpos 164
- ypos -300
- }
- push $N7921cc0
- Merge2 {
- inputs 2
- name Merge2
- xpos 30
- ypos -304
- }
- Dot {
- name Dot16
- tile_color 0x4b5ec600
- xpos 64
- ypos -254
- }
- set N78c79130 [stack 0]
- push $Nbce50f0
- Dot {
- name Dot2
- tile_color 0xcccccc00
- xpos -706
- ypos -356
- }
- set Na5c89a0 [stack 0]
- Blur {
- channels rgba
- size {{diffuse*sqrt(length)}}
- name Blur5
- xpos -240
- ypos -313
- }
- CopyBBox {
- inputs 2
- name CopyBBox2
- xpos -240
- ypos -258
- }
- Reformat {
- type scale
- scale 0.125
- pbb true
- name Reformat1
- xpos -240
- ypos -210
- }
- set Na5e8770 [stack 0]
- push $N78c79130
- push $Na5c89a0
- Blur {
- channels rgba
- size {{parent.Blur5.size/2}}
- name Blur4
- xpos -340
- ypos -310
- }
- CopyBBox {
- inputs 2
- name CopyBBox3
- xpos -340
- ypos -258
- }
- Reformat {
- type scale
- scale 0.25
- pbb true
- name Reformat5
- xpos -340
- ypos -210
- }
- set Na60c370 [stack 0]
- push $N78c79130
- push $Na5c89a0
- Blur {
- channels rgba
- size {{parent.Blur4.size/2}}
- name Blur3
- xpos -440
- ypos -310
- }
- CopyBBox {
- inputs 2
- name CopyBBox4
- xpos -440
- ypos -258
- }
- Reformat {
- type scale
- scale 0.5
- pbb true
- name Reformat4
- xpos -440
- ypos -210
- }
- set Na62fe30 [stack 0]
- push $N78c79130
- push $Na5c89a0
- Blur {
- channels rgba
- size {{parent.Blur3.size/2}}
- name Blur2
- xpos -540
- ypos -310
- }
- CopyBBox {
- inputs 2
- name CopyBBox5
- xpos -540
- ypos -258
- }
- Reformat {
- type scale
- scale 0.6
- pbb true
- name Reformat3
- xpos -540
- ypos -210
- }
- set Na653980 [stack 0]
- push $N78c79130
- push $Na5c89a0
- Blur {
- channels rgb
- size {{parent.Blur2.size/2}}
- name Blur1
- xpos -640
- ypos -310
- }
- CopyBBox {
- inputs 2
- name CopyBBox1
- xpos -640
- ypos -258
- }
- Reformat {
- type scale
- scale 0.8
- pbb true
- name Reformat2
- xpos -640
- ypos -210
- }
- set Na677440 [stack 0]
- push $Na5c89a0
- Dot {
- name Dot1
- tile_color 0xcccccc00
- xpos -706
- ypos -306
- }
- set Na5cd2c0 [stack 0]
- BlinkScript {
- inputs 6
- ProgramGroup 1
- 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=="
- 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\};"
- useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
- rebuild ""
- X_Aton_size {{parent.length}}
- X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
- X_Aton_iterations {{parent.iterations}}
- X_Aton_decay {{parent.decay}}
- X_Aton_normalize_output {{parent.normalize}}
- rebuild_finalise ""
- maxTileLines 100
- name BlinkScript2
- xpos -601
- ypos -113
- }
- push $Na5e8770
- push $Na60c370
- push $Na62fe30
- push $Na653980
- push $Na677440
- push $N78c79130
- push $Na5cd2c0
- CopyBBox {
- inputs 2
- name CopyBBox6
- xpos -740
- ypos -258
- }
- set N7700e6f0 [stack 0]
- BlinkScript {
- inputs 6
- ProgramGroup 1
- 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=="
- 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\};"
- rebuild ""
- X_Aton_size {{length}}
- X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
- X_Aton_iterations {{iterations}}
- X_Aton_decay {{decay}}
- X_Aton_normalize_output {{normalize}}
- rebuild_finalise ""
- maxTileLines 100
- name BlinkScript1
- onCreate "n = nuke.thisNode()\nn\[\"X_Aton_center\"].setFlag(0x00008000)"
- xpos -740
- ypos -116
- }
- Switch {
- inputs 2
- which {{parent.bilinear_interpolation}}
- name Switch2
- xpos -740
- ypos -60
- }
- push $N7700e6f0
- Dot {
- name Dot6
- tile_color 0x9e3c6300
- xpos -806
- ypos -254
- }
- Dot {
- name Dot8
- tile_color 0x9e3c6300
- xpos -806
- ypos -156
- }
- set Nb6e4b80 [stack 0]
- Dot {
- name Dot7
- tile_color 0x9e3c6300
- xpos -906
- ypos -156
- }
- BlinkScript {
- recompileCount 19
- ProgramGroup 1
- 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="
- 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"
- useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
- rebuild ""
- X_Aton_size {{length}}
- X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
- X_Aton_iterations {{iterations}}
- X_Aton_decay {{decay}}
- X_Aton_normalize_output {{normalize}}
- X_Aton_mode {{(parent.mode!=3)?parent.mode:parent.mode*(parent.diffuse!=0)}}
- 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)]"}}
- rebuild_finalise ""
- maxTileLines 100
- name BlinkScript4
- tile_color 0xd600ff
- label "Modified for Proxy"
- xpos -940
- ypos -115
- }
- set Nb6ee010 [stack 0]
- push $Nb6e4b80
- BlinkScript {
- ProgramGroup 1
- 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=="
- 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"
- useGPUIfAvailable {{parent.BlinkScript1.useGPUIfAvailable}}
- rebuild ""
- X_Aton_size {{length}}
- X_Aton_center {{parent.use_3d==1?Reconcile3D1.output:parent.center} {parent.use_3d==1?Reconcile3D1.output:parent.center}}
- X_Aton_iterations {{iterations}}
- X_Aton_decay {{decay}}
- X_Aton_normalize_output {{normalize}}
- X_Aton_mode {{(parent.mode!=3)?parent.mode:parent.mode*(parent.diffuse!=0)}}
- rebuild_finalise ""
- maxTileLines 100
- name BlinkScript3
- xpos -840
- ypos -116
- }
- Switch {
- inputs 2
- which {{parent.bilinear_interpolation}}
- name Switch3
- xpos -840
- ypos -60
- }
- Switch {
- inputs 2
- which {{(mode==3)*(diffuse!=0)}}
- name Switch1
- xpos -740
- ypos -10
- }
- Grade {
- multiply {{1/parent.multiply} {1/parent.multiply} {1/parent.multiply} 1}
- gamma {{1/parent.gamma} {1/parent.gamma} {1/parent.gamma} 1}
- reverse true
- name Grade1
- xpos -740
- ypos 40
- }
- push $Na591630
- Dot {
- name Dot5
- xpos -1006
- ypos -506
- }
- Dot {
- name Dot4
- xpos -1006
- ypos 94
- }
- Merge2 {
- inputs 2
- operation copy
- name Merge1
- xpos -740
- ypos 88
- }
- Output {
- name Output1
- xpos -740
- ypos 140
- }
- push $Nb6ee010
- push $Nb6ee010
- Viewer {
- inputs 2
- frame_range 1-100
- colour_sample_bbox {-0.2958333194 -0.2166666687 -0.2947916687 -0.215625003}
- samplepoints {{-0.2958333194 -0.2166666687}
- }
- viewerProcess "rec709 (default)"
- name Viewer1
- xpos -33
- ypos -132
- }
- end_group
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement