Home Creators Posts Import Register Favorites Logout

Content

Arnold is an amazing renderer, but one area where it lacks a bit is creating clean, customizable bokeh and depth of field (DoF). The only option for eliminating noise in bokeh is increasing AA samples. This means that even if your scene looks fine at 5AA you might need to double that, or more, to clean up the bokeh. This significantly increases render time with no benefit to the underlying image.

In this sample there is a 25% increase in render time for the sole purpose of reducing noise in the bokeh (and it could still be pushed further):

The original Lentil camera plugin by Zeno Pelgrims was created to address this, as well as add many advanced DoF customization capabilities. My goal with Lentil-BHGC is to keep Lentil up to date with the Arnold SDK, make workflow improvements, fix bugs, and provide long term support for users.

When preparing Lentil-BHGC I decided to focus on Lentil's thin lens features. Lentil thin lens is a major upgrade to Arnold's native DoF and I think it's a must-have. In this article I'll walk you through an easy workflow in Lentil-BHGC that will improve the realism and speed of your renders!

Scene Setup

Platinum tier members can download the finished scene in another post, but you can follow along no problem with any scene you want. You'll also need Lentil-BHGC. It's available for purchase on Patreon and Gumroad. You could use an older open-source build, but that won't match the interface I'll be showing, will be missing some improvements and features, and likely wont work on recent versions of Arnold.

The first step is to enable Lentil. The Lentil-BHGC User Guide includes setup steps for Maya, Houdini, Cinema 4D and Gaffer, so be sure to refer to that if needed. I'll be using Maya here, but you can get the same final results in any DCC. Lentil-BHGC includes a simple Maya shelf tool to set up the required imager and operator. Click it and we're ready to go!

The next step, although optional, is very helpful. In a previous article I shared my focus visualizer tool for Maya. You can find setup instructions and download it here. By default it's set to work with Arnold cameras, but a simple code change makes it work with Lentil cameras: just replace aiFocusDistance with focusDist.

Now let's create a Lentil camera and set up the focus visualizer.  Select the render camera in the scene and change the Camera Type to lentil_camera.

Next, with the camera still selected, click the Visualize Camera Focus shelf tool. This will set up a group named after the camera, in this case cam_main_focus.

The visualizer disk may be a bit undersized depending on your scene size, so feel free to change the scale manually. I increased it to 10 here.

Next, go to the Focus Distance parameter and set it to your liking. The visualizer disk will follow your adjustments. Remember that in Maya you can hold Ctrl and left mouse drag for more fine-grained control. Here, the second dragon's face will be the focal point:

Let's fire up a test render and see what we've got. Already looking good!

To take the image to the next level, let's look at a reference image to get an idea what real-life bokeh looks like.

The most noticeable quality here is that the bokeh deforms as it gets further from the center of the frame.

Let's have a look at the User Guide to see which parameter we can use to create this effect. Two options seem to do the job, but in this case we want Optical Vignetting. Aberration (distortion) will not only distort the bokeh but will also create a fisheye effect on the entire image. That may be desirable in some cases, but we'll skip it here.

Set Optical Vignetting to a low-ish number and fire up a render. You can use Arnold's render region tool to focus on a specific area of the image. Feel free to leave the render live as you tweak parameters, it will update as you work.

Going back to the reference, notice that the bokeh circles have a slight halo and even a bit of "texture." You can reproduce this effect with parameters, but I highly recommend using a bokeh image instead. Lentil comes with a number of nice ones, and you can even make your own from a real photograph. Keep in mind that Lentil needs a square image, 500 x 500px or smaller. (For now, only the luminance of the image is considered, so a color image will still yield a grayscale bokeh mask. This is something I'd like to change in a future release.)

Let's use the included bokeh_02.jpg image in our scene. Combined with vignetting we're now getting a very realistic look.

Conclusion

And that's pretty much all there is to it. Beautiful, complex, organic and realistic bokeh and depth of field with little render overhead and just a few parameter tweaks!

Files

Comments

No comments found for this post.