Houdini workflow

A video showing how to setup lentil in Houdini. The scene file is provided at the bottom of the page.

The bidirectional component runs after the light integration has already been completed. When looping over all the samples at the filtering stage, it detects high intensity samples with a luminance exceeding param: bidir_min_luminance (Trigger Treshold). When one of these high intensity samples is found, it will re-integrate its energy over many rays shot backwards through the lens.

1. Create a Lentil camera

In the /shop context, create an Arnold Shader Network. Inside, add either a lentil_camera node. Create a Camera Output node and connect. The automatically created Material Output node can be removed.

The next step is to link the shader to a Houdini camera. In the /obj context, select your camera node. In the camera parameters, inside of the arnold submenu there's a parameter Camera Shader. Enter the path to the shader there.

From here on, the parameters in the depth of field tab will not work any more. Instead, you need to control the parameters (focal length, focus distance, ...) on the lentil_camera node in the /shop context.

2. Set up parameters in the camera attributes

Set the Units param: units. Set this to meters if you work in the default houdini scale (1unit=1meter). You can set this to centimeter if you consider 1 unit 1 centimeter, etc. Note that this is for internal conversion, e.g the focus_distance is always supplied in centimeters, even if the unit param would be set to M.

Set the bidirectional sample multiplier param: bidir_sample_mult. The bokeh samples are decoupled from the AA sample count. A good interactive baseline is around 1-5, although you might want to increase this to 50-100 when dealing with very small highlights, or decrease it when dealing with larger high luminance areas. Lentil will automatically modulate the sample count based on the screenspace area footprint of the bokeh.

Set the minimum luminance a sample needs to have to be re-integrated using param: bidir_min_luminance (Trigger Treshold). Luminance equals r*0.21 + g*0.71 + b*0.072.

3. Add the Lentil Operator

In the /out context, add a lentil_operator node and connect it to the arnold ROP. This operator will duplicate all AOV's at rendertime and automatically insert the correct lentil filter.

4. Add & connect the Lentil Imager

In the /out context, create an Arnold Imager Builder. Inside, add a lentil_imager node & connect to Imager Output node.

The next step is to link the imager inside the Arnold ROP. Simply put the path to the recently created lentil_imager.

5. (optional) Double check the samples that will trigger the bidirectional component

A debug mode is provided to check which samples are going to be triggering the bidirectional sampling. Enable it with the bidir_debug parameter in the camera settings. Make sure you adjust param: bidir_min_luminance to keep the white area around the highlights. Supersampling large diffuse areas is simply a waste of time.

RGBA You're going to waste time Excellent!

Final checklist

The bidirectional sampling only kicks into action when:

  • The AA samples are larger or equal to 3.
  • An operator of type: lentil_operator has been added & connected.
  • An imager of type: lentil_imager has been added & connected.
  • param: bidir_min_luminance (Trigger Treshold) is not 0.
  • param: bidir_sample_mult is not 0.