OpticalZDefocus v1.0


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Jed Smith
OpticalZDefocus is a physically accurate ZDefocus, which controls circle of confusion (coc) size based on lens geometry using the depth of field equation. Set your lens and film-back characteristics, your focus distance, and adjust the size of your bokeh with the aperture size, just like a real lens.
Requirements:
11.0, 10.5, 10.0, 9.0, 7.1, 7.0 or later
Linux, Mac, Windows
03 Jun 2017
641

OpticalZDefocus screenshot

 

OpticalZDefocus is a physically accurate ZDefocus, which controls circle of confusion (coc) size based on lens geometry using the depth of field equation.

Set your lens and film-back characteristics, your focus distance, and adjust the size of your bokeh with the aperture size, just like a real lens.

Features

  • Unpremultiply your depth channel by the selected alpha
  • Sample the z-depth value at a given x/y coordinate
  • Supports multiple depth units: mm, cm, m, dm, inches, feet
  • Automatically snarf lens geometry data from a selected camera node
  • Min z-depth value to avoid long processing times on cg with transparent alphas
  • Fast constant defocus mode which will not calculate depth of field

The latest version will always be here: https://gist.github.com/jedypod/50a3b68f9b5bbe487e1a

There is also a video about depth of field which includes a section about how to use the tool here, for those that are curious: Simulating Physically Accurate Depth of Field

Please login in order to download these files.

Comments   

 
# Warrachat Khamfun 2017-05-28 05:41
Very Nice script :-)
 
 
# Jorge M 2017-06-07 21:49
thanks man ! it's really impressive!
 
 
# Jorge M 2017-06-07 21:59
Do you know if it would be a difference if I use the depth from the deep data and plugin it into your OpticalZdefocus instead of a regular depth ?
 
 
# Jed Smith 2017-08-31 01:36
Sorry for the late reply.

Normally the deep.front and deep.back channels that are output from a DeepToImage or DeepHoldout will work as a depth channel. The distance values will be the same as an unfiltered depth.Z from a lighting render of the same objects, though the edges might vary since these channels represent the front and back samples of the edges of your fg objects.

The OpticalZDefocus tool expects distance in front of camera style z-depth (the "depth" type in the zdefocus node), there is currently no option for 1/z z-depth, though this would be easy to add.

In short it should work! Just need to point the tool to the right channel to use.
 
 
# Rich Bobo 2017-06-21 00:12
Jed,

Holy cow!! I can't even begin to say how *awesome* this is! I have been suffering with Nuke's ZDefocus for so long - and now there's a ZDepth tool that actually works the way it should! Thank you, thank you, thank you! If I ever see you, remind me that I owe you several drinks. I'm serious.

Already added it to our facility's toolset and I've been experimenting with it on a bunch of previous comps of all kinds. Our Head Creative Director even said we should go back and re-render one of our jobs, just so it looks better on our reel!

Thanks a ton,

Rich
 
 
# Jed Smith 2017-08-31 01:39
Thanks Rich, glad it's working well for you :)
 
 
# Rich Bobo 2017-12-04 19:36
Quoting Jed Smith:
Thanks Rich, glad it's working well for you :)


I have a question...

I have noticed that I am getting errors in the Nuke console like this:
ERROR: OpticalZDefocus .Generate_Direc t_Z.scale: Nothing is named "parent.scale"

I see the error inside the Group, I'm just wondering what knob the scale value is supposed to be linked to...? It looks like it is supposed to be linked to a multiplier for the depth values, so you can more easily switch units for the depth range?

Thanks,
Rich
 
 
# Mohamed Selim 2017-09-29 18:12
I was just thinking of attempting this. Thank you! Works great and gives very similar results to the pgBokeh plugin.
 

You have no rights to post comments

We have 3165 guests and 114 members online