Nuke Tips – Convolve or Defocus?

nuke_convolve_or_defocus

Yet another “This” or/vs “That” tips.

I guess regular visitor to the site will know how much I hate (ok that is a strong word) Nuke’s scanline render as it is pretty slow.

Besides that, some of Nuke node are still CPU based which is pretty slow too (as in some nodes hardly utilise or maybe fully utilise the CPU load with slow rendering speed).

When the Convolve node support GPU acceleration, I thought it should be interesting to test it out on my GTX 780 and while there is some improvement in rendering speed, I still say it is nothing to scream compared to the CPU-based Defocus node.

Well if Convolve support GPU. why bother with Defocus?

Defocus still works if a compositor desires a simple interface to work with while Convolve relies on a custom roto shape to generate the out-of-focus shapes. I believe Nuke 7.0 introduce the GPU acceleration for Convolve which helps to speed up the rendering.

Still anyone can pipe in a basic round roto shape into Convolve to create the same look as Defocus while benefiting from the GPU acceleration.

So given the choice, do a quick test on your comp and see if using Convolve (with the GPU support enabled) can speed up the rendering.

P/S: Also for future Nuke Tips update, I’ll be including some footages from my project so it is more practical than having me create pseudo images in Nuke.

P/S 2: Per tradition, those curious to try out a simple benchmark of convolve and defocus, paste this script into the node graph (I’m using Nuke 8.0v5 in this comparison):

set cut_paste_input [stack 0]
version 8.0 v5
push $cut_paste_input
Roto {
 output alpha
 curves {{{v x3f99999a}
  {f 0}
  {n
   {layer Root
    {f 0}
    {t x44800000 x44428000}
    {a}
    {curvegroup Ellipse1 512 bezier
     {{cc
       {f 8192}
       {px 1
        {xc2837198 0}
        {x4473c000 x43ae0000}
        {x428371a0 0}
        {0 xc2837198}
        {x4488c000 x43e98000}
        {0 x42837198}
        {x428371a0 0}
        {x4473c000 x44128000}
        {xc2837198 0}
        {0 x42837198}
        {x44560000 x43e98000}
        {0 xc2837198}}}
      {cc
       {f 8192}
       {p
        {{{1 xc2837198}}
      {{1 0}}}
        {{{1 0}}
      {{1 0}}}
        {{{1 x428371a0}}
      {{1 0}}}
        {{{1 0}}
      {{1 xc2837198}}}
        {{{1 0}}
      {{1 0}}}
        {{{1 0}}
      {{1 x42837198}}}
        {{{1 x428371a0}}
      {{1 0}}}
        {{{1 0}}
      {{1 0}}}
        {{{1 xc2837198}}
      {{1 0}}}
        {{{1 0}}
      {{1 x42837198}}}
        {{{1 0}}
      {{1 0}}}
        {{{1 0}}
      {{1 xc2837198}}}}}}
     {tx 1 x4473c000 x43e98000}
     {a osw x41200000 osf 0 str 1 spx x44800000 spy x44428000 sb 1 tt x40e00000}}}}}}
 toolbox {selectAll {
  { selectAll str 1 ssx 1 ssy 1 sf 1 }
  { createBezier str 1 ssx 1 ssy 1 sf 1 sb 1 tt 4 }
  { createBezierCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createBSpline str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createEllipse str 1 ssx 1 ssy 1 sf 1 sb 1 tt 7 }
  { createRectangle str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createRectangleCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { brush str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { eraser src 2 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { clone src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { reveal src 3 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { dodge src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { burn src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { blur src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { sharpen src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { smear src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
} }
 toolbar_brush_hardness 0.200000003
 toolbar_source_transform_scale {1 1}
 toolbar_source_transform_center {1024 778}
 colorOverlay {0 0 0 0}
 lifetime_type "all frames"
 motionblur_shutter_offset_type centred
 source_black_outside true
 createNewTrack {{-1} "-1\t(none)\t-1" "1000\tNew Track Layer\t1000"}
 name RotoCIRCLE
 selected true
 xpos 56
 ypos -211
}
Roto {
 inputs 0
 output alpha
 curves {{{v x3f99999a}
  {f 0}
  {n
   {layer Root
    {f 0}
    {t x44700000 x44070000}
    {a}
    {curvegroup Bezier1 512 bezier
     {{cc
       {f 8192}
       {px 1
        {x3f374c00 xc1f09380}
        {x4414cae1 x443935c3}
        {xc0651e00 xc1bd0620}
        {x41d9aa00 x3fb74c00}
        {x440bd7ae x44289021}
        {x41df6460 xc0b74b80}
        {xc0651e00 x41d3efa0}
        {x44135c49 x4418fd71}
        {xbfb74c00 x41e51ec0}
        {xc1a61cc0 xc0897880}
        {x441b0eb9 x4428347b}
        {xc1b74be0 x40651f00}}}     idem}
     {tx 1 x4459a000 x440fc000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 tt x40800000}}}}}}
 toolbox {selectAll {
  { selectAll str 1 ssx 1 ssy 1 sf 1 }
  { selectCurves str 1 ssx 1 ssy 1 sf 1 }
  { createBezier str 1 ssx 1 ssy 1 sf 1 sb 1 tt 4 }
  { createBezierCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createBSpline str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createEllipse str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createRectangle str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createRectangleCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { brush str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { eraser src 2 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { clone src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { reveal src 3 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { dodge src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { burn src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { blur src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { sharpen src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { smear src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
} }
 toolbar_brush_hardness 0.200000003
 toolbar_source_transform_scale {1 1}
 toolbar_source_transform_center {960 540}
 colorOverlay {0 0 0 0}
 lifetime_type "all frames"
 motionblur_shutter_offset_type centred
 source_black_outside true
 createNewTrack {{-1} "-1\t(none)\t-1" "1000\tNew Track Layer\t1000"}
 name RotoBLING
 selected true
 xpos 172
 ypos -210
}
Roto {
 inputs 0
 curves {{{v x3f99999a}
  {f 0}
  {n
   {layer Root
    {f 0}
    {t x44700000 x44070000}
    {a}
    {curvegroup Bezier6 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {0 0}
        {x44a91000 x4414c000}
        {0 0}
        {xc1480000 x40600000}
        {x44a6b000 x441c4000}
        {x41480000 xc0600000}
        {0 0}
        {x44a8f000 x4417a000}
        {0 0}
        {xbf000000 x41700000}
        {x44ab1000 x441c8000}
        {x3f000000 xc1700000}}}     idem}
     {tx x41a80000 x44a8f000 x44194800}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40800000}}
    {curvegroup Bezier5 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {0 0}
        {x448a2000 x44374000}
        {0 0}
        {xc0e00000 x40a00000}
        {x448ce000 x443c4000}
        {x40e00000 xc0a00000}}}     idem}
     {tx x41a80000 x448b8000 x4439c000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40800000}}
    {curvegroup Bezier4 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {xc0400000 0}
        {x448a0000 x44358000}
        {x40400000 0}
        {x41000000 x41100000}
        {x4485a000 x443b0000}
        {xc1000000 xc1100000}}}     idem}
     {tx x41a80000 x4487d000 x44384000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40800000}}
    {curvegroup Bezier3 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {0 0}
        {x4415fffe x43a83334}
        {0 0}
        {0 0}
        {x44288000 x43a70000}
        {0 0}
        {0 0}
        {x441c199a x434ffffe}
        {0 0}
        {0 0}
        {x440ce667 x43580000}
        {0 0}}}     idem}
     {tx x41a80000 x44192000 x438d0000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40800000}}
    {curvegroup Bezier2 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {0 0}
        {x442d0000 x43e20000}
        {0 0}
        {0 0}
        {x44838000 x43e80000}
        {0 0}
        {0 0}
        {x44868000 x43a90000}
        {0 0}
        {0 0}
        {x44740000 x434c0000}
        {0 0}
        {0 0}
        {x44630000 x434a0000}
        {0 0}
        {0 0}
        {x44730000 x439c0000}
        {0 0}
        {0 0}
        {x440a0000 x43980000}
        {0 0}
        {0 0}
        {x44008000 x43ac0000}
        {0 0}
        {0 0}
        {x44220000 x43b30000}
        {0 0}}}     idem}
     {tx x41a80000 x444d471c x43a571c7}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40800000}}
    {curvegroup Bezier1 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {0 0}
        {x44976666 x444d6667}
        {0 0}
        {0 0}
        {x44a48000 x444d0000}
        {0 0}
        {0 0}
        {x44a6199a x442f1999}
        {0 0}
        {0 0}
        {x44a10000 x442e8000}
        {0 0}
        {0 0}
        {x44a1c000 x43300000}
        {0 0}
        {0 0}
        {x449a0000 x43360000}
        {0 0}
        {0 0}
        {x449b8000 x44310000}
        {0 0}
        {0 0}
        {x44964ccd x44306666}
        {0 0}}}     idem}
     {tx x41a80000 x449e6800 x4416d000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40800000}}
    {curvegroup Ellipse5 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {xc18d6280 0}
        {x444b0000 x442d0000}
        {x418d6280 0}
        {0 xc165c000}
        {x44530000 x44338000}
        {0 x4165c000}
        {x418d6280 0}
        {x444b0000 x443a0000}
        {xc18d6280 0}
        {0 x4165c000}
        {x44430000 x44338000}
        {0 xc165c000}}}
      {cc
       {f 8192}
       {p
        {{{x41a80000 xc18d6280}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 x418d6280}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc165c000}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x4165c000}}}
        {{{x41a80000 x418d6280}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 xc18d6280}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x4165c000}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc165c000}}}}}}
     {tx x41a80000 x444b0000 x44338000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40e00000}}
    {curvegroup Ellipse4 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {xc14b3d80 0}
        {x4483e000 x431a0000}
        {x414b3d80 0}
        {0 xc15ce9f0}
        {x4486c000 x43330000}
        {0 x415ce9f0}
        {x414b3d80 0}
        {x4483e000 x434c0000}
        {xc14b3d80 0}
        {0 x415ce9f0}
        {x44810000 x43330000}
        {0 xc15ce9f0}}}
      {cc
       {f 8192}
       {p
        {{{x41a80000 xc14b3d80}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 x414b3d80}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc15ce9f0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x415ce9f0}}}
        {{{x41a80000 x414b3d80}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 xc14b3d80}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x415ce9f0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc15ce9f0}}}}}}
     {tx x41a80000 x4483e000 x43330000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40e00000}}
    {curvegroup Ellipse3 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {xc1e5c020 0}
        {x44070000 x43ca0000}
        {x41e5c020 0}
        {0 xc1bdfc60}
        {x44140000 x43df8000}
        {0 x41bdfc60}
        {x41e5c020 0}
        {x44070000 x43f50000}
        {xc1e5c020 0}
        {0 x41bdfc60}
        {x43f40000 x43df8000}
        {0 xc1bdfc60}}}
      {cc
       {f 8192}
       {p
        {{{x41a80000 xc1e5c020}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 x41e5c020}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc1bdfc60}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x41bdfc60}}}
        {{{x41a80000 x41e5c020}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 xc1e5c020}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x41bdfc60}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc1bdfc60}}}}}}
     {tx x41a80000 x44070000 x43df8000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40e00000}}
    {curvegroup Ellipse2 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {xc1d413c0 0}
        {x44bec000 x44150000}
        {x41d413c0 0}
        {0 xc1bdfc60}
        {x44c4c000 x441fc000}
        {0 x41bdfc60}
        {x41d413c0 0}
        {x44bec000 x442a8000}
        {xc1d413c0 0}
        {0 x41bdfc60}
        {x44b8c000 x441fc000}
        {0 xc1bdfc60}}}
      {cc
       {f 8192}
       {p
        {{{x41a80000 xc1d413c0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 x41d413c0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc1bdfc60}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x41bdfc60}}}
        {{{x41a80000 x41d413c0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 xc1d413c0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x41bdfc60}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc1bdfc60}}}}}}
     {tx x41a80000 x44bec000 x441fc000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40e00000}}
    {curvegroup Ellipse1 512 bezier
     {{cc
       {f 8192}
       {px x41a80000
        {xc1a7e500 0}
        {x438b0000 x443f0000}
        {x41a7e500 0}
        {0 xc1a7e500}
        {x439e0000 x44488000}
        {0 x41a7e500}
        {x41a7e500 0}
        {x438b0000 x44520000}
        {xc1a7e500 0}
        {0 x41a7e500}
        {x43700000 x44488000}
        {0 xc1a7e500}}}
      {cc
       {f 8192}
       {p
        {{{x41a80000 xc1a7e500}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 x41a7e500}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc1a7e500}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x41a7e500}}}
        {{{x41a80000 x41a7e500}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 xc1a7e500}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 x41a7e500}}}
        {{{x41a80000 0}}
      {{x41a80000 0}}}
        {{{x41a80000 0}}
      {{x41a80000 xc1a7e500}}}}}}
     {tx x41a80000 x438b0000 x44488000}
     {a osw x41200000 osf 0 str 1 spx x44700000 spy x44070000 sb 1 ltn x41a80000 ltm x41a80000 tt x40e00000}}}}}}
 toolbox {selectAll {
  { selectAll str 1 ssx 1 ssy 1 sf 1 }
  { createBezier str 1 ssx 1 ssy 1 sf 1 sb 1 tt 4 }
  { createBezierCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createBSpline str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createEllipse str 1 ssx 1 ssy 1 sf 1 sb 1 tt 7 }
  { createRectangle str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { createRectangleCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { brush str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { eraser src 2 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { clone src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { reveal src 3 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { dodge src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { burn src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { blur src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { sharpen src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
  { smear src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
} }
 toolbar_brush_hardness 0.200000003
 toolbar_source_transform_scale {1 1}
 toolbar_source_transform_center {960 540}
 colorOverlay {0 0 0 0}
 lifetime_type "all frames"
 lifetime_start 21
 lifetime_end 21
 motionblur_shutter_offset_type centred
 source_black_outside true
 createNewTrack {{-1} "-1\t(none)\t-1" "1000\tNew Track Layer\t1000"}
 name Roto1
 selected true
 xpos -122
 ypos -330
}
Transform {
 scale {{curve x1 1 x100 1.5}}
 center {960 540}
 name Transform1
 selected true
 xpos -122
 ypos -220
}
Crop {
 box {0 0 1920 1080}
 reformat true
 crop false
 name Crop1
 selected true
 xpos -122
 ypos -187
}
set Nb5c1aed0 [stack 0]
Convolve2 {
 inputs 2
 channels rgba
 name Convolve1
 selected true
 xpos -46
 ypos -77
}
push $Nb5c1aed0
Defocus {
 channels rgba
 defocus 100
 name Defocus1
 selected true
 xpos -208
 ypos -79
}
Viewer {
 inputs 2
 frame 27
 input_process false
 name Viewer1
 selected true
 xpos -46
 ypos 88
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.