View Full Version : First steps with Nuke

02 February 2010, 07:01 AM
Hey guys :)

I'm extremely new to Nuke (literally was playing around with it for for no more than an hour and watched few hours of tutorials) but I'm very comfortable with node based systems (Maya's hypershade for example).

Probably as every newbie in Nuke I was trying to get a nice Bokeh effect :). So I got my Maya's render. To get nice Bokeh effect I though I'd use "Convlolve" node so I plugged the render to one of the inputs and a small image of a white circle on black background to another input and it gave me great result but the blur was the same across entire image. I recon if I plugged Zdepth pass as mask it would give me a bled between blurred version and the original one.

So I was wondering if I could control somehow the size of the Bokeh effect by my ZDepth. I realized that the blur gets smaller if the second input of Convolve node is smaller (the mentioned circle). That made me thinking that I could use a Transform node to control size of the circle. That would be multiplied by ZDepth so wherever Zdepth is dark it would scale down the circle. Anything below 1 on ZDepth would scale down the size of the circle, one would give original size, anything above one would scale it up. That's the way I'd approach similar problem in Maya's Hyperhsade.

The problem where I'm stuck is how do I plug anything to "scale" attribute of "Transform" node? Is that even possible?

Or perhaps I'm over thinking it and making it waaaay too complicated? Any suggestions are more than welcome!

Thanks so much for your help in advance!

02 February 2010, 08:49 AM
Convolve can't be run on a per-pixel basis which is what you would need for a 3D DOF.

By the way the faster way to get bokeh is to just use the "Defocus" node. But like the convolve it's a uniform amount across the entire image.

There isn't a very good depth of field node built into Nuke. It's a definite blind spot in its toolset.

02 February 2010, 09:21 AM
Maybe not very good, but you can give the zBlur tool a try.

02 February 2010, 10:36 PM
Thanks guys, much appreciated. I have to say I'm a bit shocked it doesn't allow you to run it per pixel but I am very new to composing concept so perhaps I just had wrong idea what it is about. I might try to play around with breaking the scene on few planes (along Z) and put different DOF values for each of them and than blend it with the sharp picture. Will play around once I get my data done 100% in Maya. Thanks again!

02 February 2010, 01:32 AM
Hmmmm..... Writing an expression node for this sounds like a fun little challenge. If you have a multichannel EXR that you're trying to get this effect on, post it. Most of my renders don't have high contrast backgrounds & large DOF, so the effect won't be obvious

P.S. I assume you want an an even circular effect, rather than a mere gradating blur that zdepth gives you....where the circles are bigger or smaller depending on the z-depth.

02 February 2010, 02:37 AM
Started writing one, but then I noticed zBlur already supports this feature. No reason to reinvent the wheel.

Create a zBlur node, and set the "Filter shape" to 1.

02 February 2010, 02:06 PM
PhantomDesign, WOW, I really appreciate your help! But ZBlur does seem to be doing what you wanted to write. What I was after is to have different size of the circles depending on ZDepth (I can only assume this is how it works in real lens).
Sorry, no high contrast EXR from me either... I have t get one like that done for a change ;)

Thanks a lot, really appreciate it.

02 February 2010, 04:19 PM
You may have to adjust your sliders.... but zBlur is working for me, creating different sizes of circles depending on the distance.

If you want me to take a look, post your scene and source-images.

02 February 2010, 08:34 PM
You may have to adjust your sliders.... but zBlur is working for me, creating different sizes of circles depending on the distance.

If you want me to take a look, post your scene and source-images.

Thanks man! Will post for sure later this week. Still fighting with mentalray for Maya to spit out the passes I'm after... failing so far.

02 February 2010, 05:31 PM
hi caro this tutorial shows at the end a process to export passes out of maya for nuke

hope it helps!

02 February 2010, 10:59 PM
caro, you can use ZDefocus of Sapphire plugins. Are available in OFX, this is grateful for Nuke.

ZDefocus have a simply one slider control for Bokeh effect. But you can be to consider how and why happen this effect. Also it have a dia shape (circular, 6-sides, etc)

CGTalk Moderation
02 February 2010, 10:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.