For quite some time I would like to fill some gaps in my understanding of the tracing/sampling method of Cycles. I believe I have some misconceptions, as when playing around with the Light Path node, the results do not match my expectations.
I try to explain in brief my understanding of the sampler. Please correct me, when you find something wrong with it.
When hitting a surface the material is evaluated and a new ray is created. There is always importance sampling used to determine the direction of the new ray. There are two different flavors of importance sampling, each of which is used for some rays.
- Rays are created depending on the shader (BSDF), preferring directions which the most light is scattered to, according to the BSDF.
- Rays are created in the direction of a light source. These are called shadow rays.
The intensities resulting from these 2 methods are combined with MIS. Shadow rays are only created toward light sources with the MIS flag enabled.
Now to the tricky questions:
- What happens when a shadow ray does not reach the light source, but is blocked by a surface? Is it discarded? Or the path continued by creating a new ray with one of the methods above? Backtracked to the last surface and creating a new ray from there?
- When does the Light Path node set the Shadow Ray flag? When a shadow ray hits a surface? Or already one bounce before, implying that the sampler decidey to create a shadow ray before evaluating the material? Can it only be found set when evaluating a lamp material (or a surface with an emission shader)?
- Do Shadow rays still get one of ‘Reflection Ray’ or ‘Transmission Ray’ set?
- What happens when a shadow rays hits a transparent material? Is the Shadow Ray flag still set after the transmission?
- What happens when a shadow ray hits a semi-transparent material (transparent shader mixed with something else)? Normal path continuation? Always picking transparent passthrough with intensity weighted with the transparency mix factor?
I could go on with a few more questions along these lines, but I guess you got what I’m interested in. Any insights into the matter are welcome.
I might post a blend file with results I find counterintuitive in a few days (I’m on travel).