Page 1 of 1

Weighted delta tracking question

Posted: Sat Nov 11, 2017 3:57 pm
Hello,

I read the recent paper on Spectral and Decomposition Tracking by Kutz et al.
http://drz.disneyresearch.com/~jnovak/p ... index.html

I want to use weighted tracking methods in my own toy path tracer.

Following the PBRT book pg 889, the incident radiance is composed of two terms: the radiance arriving from the distant hit point Tr*Lo and the inscattered radiance integrated along the viewing ray.
pbrt_pg889.png (8.24 KiB) Viewed 4094 times

I evaluate only one of these terms probabilistically. The first, term if no collision was generated, otherwise there is a scattering or absorption even.

As per PBRT I need to weight Tr*Lo with the probability that no interaction takes place, i.e. the probability to hit the surface p_surf. Thus the estimator is Tr*Lo/p_surf.

However, I cannot figure out how to determine the weight Tr/p_surf.

So how is the inscattered radiance combined with the background?

I also took a brief look at Novak's Ratio Tracking paper but there I also failed to find an answer.

Cheers,

Re: Weighted delta tracking question

Posted: Sun Nov 19, 2017 11:49 am
Hi,

In my understanding, T_r / p_surf becomes the weight computed by cumulatively multiplying the following single step weight:
single_step_weight.png (7.03 KiB) Viewed 3983 times

as in the SD tracking paper.

If this is implemented by following PBRT's interface for example for GridDensityMedium::Sample(),
it returns the above weight if no interaction found, otherwise returns
weight_for_scattering.png (8.98 KiB) Viewed 3983 times

, where w is the cumulative weight until this step.

In the conventional delta tracking,
P_n(x) = \mu_n(x) / \bar{\mu} (this leads the single step weight to 1.)
\bar{\mu} = \mu_a(x) + \mu_s(x) + \mu_n(x).
Therefore, this implementation matches the current PBRT-v3's implementation.

Re: Weighted delta tracking question

Posted: Sat Nov 25, 2017 2:45 pm
Thanks! It's true. I had the impression that there needs to be another factor 1/p_surf. But you are right.

I made a quick implementation in python https://github.com/DaWelter/ToyTrace/bl ... racking.py.
It seems to work fine as you say, with the minor exception that I take 1/P_s instead of 1/(1-P_n). (Where did you get that from?)

Using two channels with different u_s and u_a (or sigma, as I named it). Reference:
The Integral = [ 0.60379031 0.04641034]
Transmission to the end = [ 0.33283447 0.86069506]

10k samples:
-----------------
spectral_tracking
-----------------
Interacting fraction: 0.4491
Escaping fraction: 0.5509
Integral estimate: 0.597721 +/- 0.008839, 0.046448 +/- 0.000701
Transmission estimate: 0.331000 +/- 0.004706, 0.879645 +/- 0.011789
-------------------------------
spectral_tracking_no_absorption
-------------------------------
Interacting fraction: 0.4186
Escaping fraction: 0.5814
Integral estimate: 0.609066 +/- 0.008566, 0.046662 +/- 0.000669
Transmission estimate: 0.329594 +/- 0.004540, 0.860574 +/- 0.010576

Looks good. I want to use it to simulate atmospheric scattering. If I understand correctly, strong variation of sigma_t across lambda causes high variance. But since my pathtracer was build for RGB channels I can change things to trace three nearby wavelengths simultaneously.

Re: Weighted delta tracking question

Posted: Sat Nov 25, 2017 4:02 pm
The reason why I wrote 1 / (1 - P_n(x)) is that PBRT-v3's delta tracking implementation only cares about the interaction is null-collision or not, while the integral formulation in the paper simultaneously cares about three types of interaction (scattering, absorption(emission), null-collision).

Therefore, there are two steps until determining that the interaction is scattering in that implementation.
The first is whether the interaction is null-collision or not.
The second is whether the interaction is scattering out of scattering and absorption(emission).
weight_for_scattering_PBRT_style.png (14.32 KiB) Viewed 3853 times

The above expression shows how these steps form the weight.
The first fraction is division by the probability that the interaction is NOT null-collision.
The second fraction is division by the probability that the interaction is scattering out of scattering and absorption.

The denominator of the second fraction becomes scattering albedo in the standard delta tracking, and might be used for Russian roulette decision to continue constructing a light path.

Re: Weighted delta tracking question

Posted: Sun Nov 26, 2017 10:44 am
Ah all right.

The sky is blue. It works!
Single Lambda.
atmosphere_single_lambda.jpg (526.8 KiB) Viewed 3818 times

Spectral. Same number of samples per pixel. Higher render time but the result is worth it.
atmosphere_spectral.jpg (420.79 KiB) Viewed 3818 times

Edit. I managed to do a crude derivation of why this works. Basically taking the delta-source from appendix B into the derivation of the scattering integral estimator.
delta_tracking_derivation.png (381.57 KiB) Viewed 3797 times