## Questions on BDPT and Sampling

Practical and theoretical implementation discussion.
sriravic
Posts: 20
Joined: Fri Jun 22, 2012 6:48 pm

### Questions on BDPT and Sampling

Hello all

I've got a question with regards to BDPT and sampling. In BDPT in order to efficiently generate paths, we do a correlated path sampling scheme by connecting all vertices of the camera path to all the vertices of the light path. Assume the length of eye path as N_E and the light path as N_L. So in essence we have N_E x N_L connections done and resulting in the same number of paths. Assume all paths are valid (visibility is true for all connected pairs). In order to simplify lets take an example case of N_E = 3 and N_L = 3. We can derive the following table to understand this better.

Assume 'k' to be the path length. Assume that we cannot directly intersect with the camera and the light source (pinhole camera and point light) thereby making the connections explicit.

-------------------------
E | L | K |
-------------------------
1 1 1
1 2 2
1 3 3
2 1 2
2 2 3
2 3 4
3 1 3
3 2 4
3 3 5
-------------------------

As we can see we have the following counts of paths of various lengths

-----------------------
K | n_K |
-----------------------
1 1
2 2
3 3
4 2
5 1
------------------------

All these paths now contribute to the same pixel. My questions are the following.

1. Should we average the path contributions on per path length basis? For example we are considering '3' different path lengths of 'k = 3'. By monte carlo sampling framework this represents three different random paths which would mean that we do an average of all three f(x)/p(x) of each path.
2. Assume we are generating a lot of camera samples for each pixel. How do we go about correctly averaging the results for the entire pixel.?

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

### Re: Questions on BDPT and Sampling

First of all, please clarify the difference between the number of subpath vertices and the length of a subpath.
You wrote in the table that when E and L are 1, K is 1. However, I think its correct length is 3, not 1.
This is not a essential problem, but it makes something complicated.

1. Per path length basis.
In Veach's thesis, the rendering equation is transformed into a simple integral over the whole path space(including all of path length).
However, you should basically consider it as the sum of integrals. Each integral's domain is the whole path space of a certain path length.
2. It depends on a reference you think.
For example, many of standard path tracing implementations don't consider about dividing a contribution by the PDF of generating the first vertex (next to the lens vertex) in a scene.
In case you want to make the result of BPT the same as in such PTs, your BPT also have to consider the factor (even if it seems to be incorrect from point of view of Monte Carlo Integration)

sriravic
Posts: 20
Joined: Fri Jun 22, 2012 6:48 pm

### Re: Questions on BDPT and Sampling

Hello

Sorry for the confusion. I think I messed up the description and the table. Let me make myself clear as to what my actual doubt is.

In Veach's thesis, each pixel's sample contribution is given by sum of light carrying paths of increasing lengths from 1 - infinity. Each component in the sum is an actual integral that can be evaluated using monte carlo methods of different sample sizes. In BDPT, when using correlated connections to create multiple path lengths (which are referred to as techniques in Veach's thesis ), do we divide by number of paths of same length? (Assuming we correctly compute the MIS weights for each technique)

For example, let {x0, x1, x2} be the camera vertices and {y0, y1} be the light vertices. Paths of length '3' (k) can be made by the following combinations. path1 = [x0,x1,x2,y0] and path2 = [x0,x1,y1,y0] (assuming all are diffuse vertices and they are all valid paths). Now each path is a separate path of length '3' that contributes to the same pixel. Each contribution can be correctly weighted according to MIS (different techniques by varying (s,t) parameters for path1 and path2). My question is after computing the correct contributions for path1 and path2 should we average them (because they both being of same length) according to the monte carlo framework because each can be considered as a sample in path space.

I hope I am clear with the question I have posed.

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

### Re: Questions on BDPT and Sampling

You don't need average the samples.

Let's consider intuitively about the MC contribution of the paths you mentioned.
path1:
w1 * (C1 / p1)
path2:
w2 * (C2 / p2)

The factors (C* / p*) are usual MC contributions. w* are MIS weights, so the values of both are less than 1.
If p1 and p2 are accidentally the same. w1 and w2 are 0.5 using balance or power heuristic.
What you want to do by averaging is included in these weights.

*note that
w1 and w2 are less than 1 but the sum of these is not equal to 1. Because path1 and path2 are different.