## Multi-wavelength free path sampling using ratio tracking

Practical and theoretical implementation discussion.
shocker_0x15
Posts: 67
Joined: Sun Aug 19, 2012 3:24 pm

### Multi-wavelength free path sampling using ratio tracking

Hi,

I'm curious about whether using ratio tracking for estimating Monte Carlo constribution (f(x) / p(x), not transmittance) with delta tracking for heterogeneous media is unbiased.

We can get a MC contribution of free path sampling by delta tracking for a wavelength used for the procedure.
There is a demand to know MC contributions for other wavelengths simultaneously,
but we don't have the transmittance and PDF as separated values.
Therefore it's not possible to apply delta tracking to estimate MC contributions for multiple wavelengths.

On the other hand, estimating transmittance for a given segment in participating media for multiple wavelengths in unbiased fashion is possible by performing ratio tracking for every wavelengths.

I consider things like following:
perform delta tracking to sample free path for the wavelength wl_i and get the distance d.
PDF of the procedure is
p(d, wl_i) = sigma_e(d, wl_i) * exp(-int_0^d sigma_e(s, wl_i) ds)
Transmittance for another wavelength wl_j is
T(d, wl_j) = exp(-int_0^d sigma_e(s, wl_j) ds)
Therefore, MC contribution for the wavelength wl_j is
T(d, wl_j) / p(d, wl_i) = 1 / sigma_e(d, wl_i) * exp(-int_0^d (sigma_e(s, wl_j) - sigma_e(s, wl_i)) ds)

sigma_e(s, wl_j) - sigma_e(s, wl_i) can be a negative value, but ratio tracking is able to handle correctly.

Does this become unbiased estimate when I integrate this procedure into a light transport algorithm?

Thanks,

yiningkarlli
Posts: 11
Joined: Tue Jun 26, 2012 9:07 pm
Contact:

### Re: Multi-wavelength free path sampling using ratio tracking

Funny you should mention this, we have a SIGGRAPH 2017 paper on this topic. =)

We just released it online here: http://drz.disneyresearch.com/~jnovak/p ... index.html

shocker_0x15
Posts: 67
Joined: Sun Aug 19, 2012 3:24 pm

### Re: Multi-wavelength free path sampling using ratio tracking

great!!!

Thanks!

Posts: 21
Joined: Fri Oct 17, 2014 4:19 am

### Re: Multi-wavelength free path sampling using ratio tracking

Residual ratio tracking is very promising, but I wonder how it's used for evaluating multiple scattering? Specifically, how to apply it to sample a free length? I only figured out how to apply it to estimate transmittance for direct illumination. As far as I remember, high variance for high albedo dense media mainly came from multiple scattering, which basically requires massive sampling on the "line of sight" of integration. Conversely, direct lighting can be importance sampled in case the environment map has peaks, and the accuracy of transmittance by delta tracking is sufficient.

Posts: 21
Joined: Fri Oct 17, 2014 4:19 am

### Re: Multi-wavelength free path sampling using ratio tracking

OK, now I get it what you meant with the code . I write it down in case someone else wonders.
compensation.png (88.43 KiB) Viewed 3112 times

And I took some time to pick up my old volumetric path tracer, improved it with the fancy stuff (hosted here, https://github.com/RNG65536/volpath), and did some comparisons.
It may seem unbiased w.r.t. color, albeit within minor error due to limited samples, etc. The left most one is sampled with delta tracking for separate channels, avoiding the sampling PDF problem. The next ones have different channels sampled all together, and compensated afterwards using ratio tracking. From left to right, red, green, blue and a random channel is used.
comparison.png (250.91 KiB) Viewed 3112 times

Maybe equi-angular sampling is better on this matter, as I learned from a variant of smallpaint. The MIS method of Mitsuba may also work, but I only examined it for homogeneous media.

Posts: 21
Joined: Fri Oct 17, 2014 4:19 am

### Re: Multi-wavelength free path sampling using ratio tracking

After more tests I still find some bias in the image. Maybe it's also necessary to also consider the compensation for passtrough rays that leave the volume. Or just use an infinite medium to compare.

ps. I just worked out a compensation for passthrough rays. Seems to match multichannel and blue channel sampling results well.
compensation2.png (26.94 KiB) Viewed 3093 times

shocker_0x15
Posts: 67
Joined: Sun Aug 19, 2012 3:24 pm

### Re: Multi-wavelength free path sampling using ratio tracking

Nice work!

Maybe it's also necessary to also consider the compensation for passtrough rays that leave the volume.

Right, of course it needs consideration for such rays as you say.

It corresponds to my code at l.80 in the current implementation:
https://github.com/shocker-0x15/SLR/blo ... bution.cpp

Posts: 21
Joined: Fri Oct 17, 2014 4:19 am

### Re: Multi-wavelength free path sampling using ratio tracking

Actually, I'm most concerned with figure 11 in Karl's paper, which is a cumulus cloud with albedo = 1, and forward scattering g = 0.877. For some data, such as my binary checkerboard volume, delta tracking seems to outperform ratio tracking, as it skips most of the sigma_t queries when transmittance is really small. On the other hand, I have no idea what the scale of the scene should be, and it is the only difference between the two distinctly different looking clouds in that figure. Of course the distribution of the data is important, but using a blocky one could still provide some insights.

ps. I just noticed from their video that they might have used Russian Roulette to terminate deep rays. The thinners cloud requires even higher sampling than the thicker one??