Tuesday, August 23, 2011

INDIRECT LIGHT: Caustics


With Houdini 11, several areas of the lighting/shading/rendering pipeline have undergone some serious overhaul, caustics included. Instead of generating photon maps under the PBR tab of your Mantra node, all of the caustics set-up is done with the new Caustics Light (which can be found in the Indirect Light node).

 
Pros:
> Automatically generates and reads in a photon map (no more having to create and constantly update a separate mantra node just for baking out photon maps)
> Enables you to have most of the parameters you need on the object level

Cons:
> Not as much direct-ability
> There is a constant battle between wonderfully sharp but noisy caustics and amazingly smooth but blurred caustics

No Light Mask or Photon Target Defined
Light Mask or Photon Target Defined
Upon application, the caustics light may or may not give you a funky-looking caustic. That’s because, with default settings, the photon map is spreading out across the entire scene.  It is not collecting in specific areas. First things first, make sure that the caustic light's Light Mask parameter is set to a specific light and the Photon Target parameter is set to a specific target such as your main refracting/reflecting object (the more specific, the more direct-ability, and the more photons will accumulate in the areas you want them to). It’s good practice to have a separate caustic light for every light in the scene that you want to contribute to caustics (for better direct-ability).

Side note:  If you're not seeing any change in your render view, be sure that Auto-Update is unchecked. You have to reload your photon map in order to see the differences, and Auto-Update does not do that for you (despite the ‘auto’ in the name).

Filter Samples vs Prefilter Samples:

Is Filter and Prefiltering sampling similar to sampling in the render node (with raytracing)? You're doing a prefilter photon map and you have your samples set to 100. It samples each photon 100 times, takes the average of those 100 samples, and applies the result to the photon. If it works this way, maybe that is why a high filter and a high pre-filter sampling rate results in a 'blurier' caustic and lower rates give you a 'sharper' caustic.

The smaller the sample number,  the noiser it will be (more aliasing) but it will also be sharper

Filter Samples:  When reading from the photon map, this is the number of photons to filter (if you aren't pre-filtering, then you need a high number of Filter Samples)

Photon Map Generation
Filter @ Render Time (when it's reading the photon map to render)

Prefilter Photon Map:  After photon map generation but before rendering, prefilter the photon map so that much fewer photon samples are required for rendering

Prefilter Samples are the number of photons to filter during prefiltering (the higher the number, the "blurier" it is -- same for Filter Samples)

Photon map Generation
Filter
Render Time

The Prefilter Ratio is the ratio of prefiltered photons over photons that were initially sent out before cacheingThis means that if your pre-filter ratio is set to, say, 0.1, your pre-filtered photon map (the map used at render-time) will only store 1/10 of the photons in the original, non-filtered map. The larger the pre-filtered ratio number, the more photons in your pre-filtered map (( See example images ))
Prefilter Ratio set to 0.1
Prefilter Ratio set to 0.8

Photon Map Generation


Here’s a general idea of how photon map generation works in computer graphics:

  • A light fires a photon out into the scene within the light's cone angle (I assume along a ray of some sort -- depending on the render engine. The caustic photon distribution is pretty random)
  • That photon will either encounter a diffuse object or a reflected/refracted object and then a diffuse object
  • Once the photon encounters the diffuse object, the photon then records its position and the intensity of the refracted/reflected light that is hitting that photon/point in space
  • Lather, Rinse, Repeat until the number of photons is reached in the Photon Count parameter (in Houdini)
  • Come render time, the created photon map then contributes to the light intensity to which that map belongs (ex:  the light averages all of the points in the photon map that are within a certain distance of that point in space, then adds the results to the light intensity at that point on the object). Since photons do not hit every point on the object, the point that's getting rendered may not have a photon sample at that exact point, but if there are hits very close by, the renderer assumes their average will appropriately approximate the current location's caustic.