Basic Caustics Setup
Rendering caustics is a two stage process. At first stage rays (photons) are fired from light sources and stored in caustics photon map. Second phase is actual rendering with gathering caustics from caustics map.
Caustics test scene
Here is our caustics test scene rendered in Raytrace mode. We have reflective ring and refractive ball here, area light with Inverse square^2 falloff and Ambient light set to 0%.
For better understanding how caustics are rendered we will turn on manual mode for them. We go to Photons tab and choose Custom for caustics. Then we turn off Use autophotons and set Max. We don't bother N and Step because they are ignored anyway when Max is zero. Our initial setup should look like this:
We should also turn off Auto for GI resolution and set it manually to 100mm.
Now we can enable caustics (General tab Diffuse model)...
... and render.
Caustics rendered, but looks noisy. We can see every particular caustic photon. We can avoid this by increasing caustics filter radius. This is Radius parameter in caustics section of Photons tab. Why is it expressed in % not in meters? Radius like many other parameters in Kray is expressed relative to GI resolution. This is helpful when we want to scale all settings for another scene. We don't need to change every size related parameter, just GI resolution. In our scene we don't use neighter global photons nor final gathering so it does not matter what we will change GI resolution or Radius. If we have full GI scene changing GI resolution will affect all size related GI parameters while Radius will only affect caustics.
I have changed Radius from 25% to 100% (so it is now 100mm, equal to GI resolution).
Caustics photons number
As we can see caustics are less noisy then before, but they are also little blurred so details are not so well visible. If we want better quality increasing filter even more will not help (will blur caustics to much). Instead of increasing filter we can increase number of Caustics photons. Lets see what happens when I increase Caustics photons 10 times (from 100000 to 1000000).
Quality has improved a lot. Of course not without speed impact, but I think it was worth it.
For this render we have used 1000000 photons fired from light source. Not all fired photons were stored on photon map. Some of them did not hit neighter reflective nor reflective surface. Such photons does not cause caustics and are not stored in photon map. If we check Kray log, we can see how many photons actually were stored on the map.
We can see that Kray fired actually 1000001 photons (difference of one is because of how photons are fired) and 436486 photons were stored on photon map (43% of fired photons). Instead of controlling number of fired photons (emitted) we can control number of stored photons (received). This is what Emitted/Received switch does.
Max, Steps and N
One of the problems with adjusting photons filter size is that their distribution is not even on the whole scene. In one part of scene there are plenty of them and we need small filter there to avoid too much blurring details. On the other side of scene there are few bright dots only and we need larger filter to blur them.
We can tell Kray to adjust filter size depending on photons density on the scene. Instead of expressing filter size in meters, we can set number of photons (N) that should fit in filter size. These are settings I've used:
This means for Kray "Try 20% filter size, if number of photons in filter is smaller then 500 increase filter, but not use larger filter then 200%. Use maximum 3 steps of filter incrementation between 20% and 200%". Here is a result:
Note that caustic inside the rings is less blurred while caustic on red wall is less noisy.
Multiplier is just caustic brightness. Default value of 1 means physical accurate computing. We can violate laws of physics to achieve more dramatic effect. Here is our scene with Multiplier=3.
Setting Radius, Max and Step manually is not very comfortable. We never know how many photons will fit in given filter radius. That is where Autophotons can help.
In preprocessing phase of rendering, Autophotons computes distribution of photons on the scene and sets according to this distribution. Low and High percentages are equivalents of Min and Max radius, but they are expressed in relation to the real photon density of the scene. If Low value is too big, regions in scene with a high photon density (low radius) may contain too few (less than N) photons. If High value is too low, areas with a low photon density (big radius) will contain much more photons than N. Setting the Low value too low and High value too high will increase the rendering time. Dynamic is equivalent of Steps, but it automatically adapts to the real distance between regions of high and low photons density. That means if for example Dynamic is set to 10 and density of photons of the scene is even, the autophoton system will set Step to 1. But in case the photon density varies in different scene locations the Steps value may be higher, but not bigger than 10. Too low a Dynamic value may appear as noise on caustics. Too high a value may slow down the rendering process. |}