After implementing a path tracer, I'm now working on implementing bidirectional path tracing. I've been working my way through Veach's thesis and PBRT, and I have a few questions about how vertex probabilities are calculated. Hoping someone here can point me in the right direction. The following image contains some text from pg 303 (10.2 Mathematical Formulation) of the thesis... and a diagram of light rays bouncing away from a light source:
Questions for light vertex generation:
1. Quantity in A: It seems like the definition of PA(Yi) defined in A conflicts with the definition of Pi for i>=2 defined in the last line of the text. Specifically, PA(Yi) refers to Yi1 and Yi, which makes intuitive sense to me, but Pi at the bottom is defined in terms of Yi2 and Yi1. Why the difference?
2. Quantity in B: What is the meaning of PA(y0)? I've been assuming this would be the pdf of the point on the light source, but I'm not sure that that's correct. If so, is it supposed to be with respect to surface area or solid angle?
3. Quantity in C: I assume this should be calculated by the BRDF at Y1? (although, again, why does it refer to Yi2 and Yi1, instead of Yi1 and Y)?
Thanks!
BDPT implementation issues
Re: BDPT implementation issues
Watch out the notation  P and p_i are different quantities (in upper and lower case respectively). P(y_i) denotes the probability of sampling vertex y_i w.r.t. surface area. Then, p_i is a quantity that Veach defines to "represent the probabilities for the first i vertices...", which are the all the subpath vertices that come before y_i.
So p(y_i) is the pdf of vertex y_i and p_i is the product of the pdfs of vertices y_0, y_1, ..., y_{i1}. And yes, P_A(y_0) is the pdf of sampling y_0 on the light source, in surface area measure.
So p(y_i) is the pdf of vertex y_i and p_i is the product of the pdfs of vertices y_0, y_1, ..., y_{i1}. And yes, P_A(y_0) is the pdf of sampling y_0 on the light source, in surface area measure.
Click here. You'll thank me later.

 Posts: 7
 Joined: Sat Sep 12, 2015 6:59 pm
Re: BDPT implementation issues
OK, thanks for the clarification. If this were a real scene then, with one sphere light and two cuboids (each with perfect Lambert BRDF), the probabilities should work out to be:
p0L = 1
p1L = pdf of point on light source. Assuming the light source is a sphere with radius r and it radiates uniformly, this would be (1 / 4 * PI).
My question then is how to compute p2L:
 A is the formula described earlier populated with the actual values for i = 2.
 B: I'm guessing P_sigma is the BRDF at Y1 for the incoming direction from y0? Since it's a Lambertian BRDF, it should be 1/PI for all directions. Although based on the wording "we let P_sigma(x > y) denote the density for choosing the direction from x to y, measured with respect to projected solid angle", I'm not sure that this is correct. What do we mean when we say the density for choosing the direction?
 C: Populating the formula for G with i = 2.
 D: p2L, populated with computed values from B and C (assuming y0 and y1 are visible to each other, V() = 1). The cos*cos / dist^2 term can be calculated directly, and we already know p1L as discussed previously.
Does this look right, or am I missing something? Thanks.
p0L = 1
p1L = pdf of point on light source. Assuming the light source is a sphere with radius r and it radiates uniformly, this would be (1 / 4 * PI).
My question then is how to compute p2L:
 A is the formula described earlier populated with the actual values for i = 2.
 B: I'm guessing P_sigma is the BRDF at Y1 for the incoming direction from y0? Since it's a Lambertian BRDF, it should be 1/PI for all directions. Although based on the wording "we let P_sigma(x > y) denote the density for choosing the direction from x to y, measured with respect to projected solid angle", I'm not sure that this is correct. What do we mean when we say the density for choosing the direction?
 C: Populating the formula for G with i = 2.
 D: p2L, populated with computed values from B and C (assuming y0 and y1 are visible to each other, V() = 1). The cos*cos / dist^2 term can be calculated directly, and we already know p1L as discussed previously.
Does this look right, or am I missing something? Thanks.
Re: BDPT implementation issues
Correct. Though keep in mind that the pdfs you need to evaluate do not necessarily directly correspond to the physical properties of the materials and light sources. That is, the light source may not radiate uniformly but you may still choose to sample a point on it uniformly (for simplicity of implementation). In that case the pdf of the point will still be 1/ (4 * PI).danielthompson wrote:p1L = pdf of point on light source. Assuming the light source is a sphere with radius r and it radiates uniformly, this would be (1 / 4 * PI).
P_sigma is the pdf at Y0 for sampling the direction toward Y1. You're right that diffuse emission/BRDF has a 1/PI density, however one typically uses cosinedistribution to sample directions with pdf cos(theta0)/PI. This goes back to my point above that you don't necessarily have 1to1 correspondence between physical scattering properties and sampling techniques. Here pdf and density are used as synonyms, though strictly speaking the "pdf" (or probability density function) is a function, whereas "density" is the value of that function at a particular location.danielthompson wrote:B: I'm guessing P_sigma is the BRDF at Y1 for the incoming direction from y0? Since it's a Lambertian BRDF, it should be 1/PI for all directions. Although based on the wording "we let P_sigma(x > y) denote the density for choosing the direction from x to y, measured with respect to projected solid angle", I'm not sure that this is correct. What do we mean when we say the density for choosing the direction?
Click here. You'll thank me later.

 Posts: 7
 Joined: Sat Sep 12, 2015 6:59 pm
Re: BDPT implementation issues
OK, that makes sense. For this example, let's keep it simple and assume that the light source radiates uniformly.Though keep in mind that the pdfs you need to evaluate do not necessarily directly correspond to the physical properties of the materials and light sources. That is, the light source may not radiate uniformly but you may still choose to sample a point on it uniformly (for simplicity of implementation).
Ah, interesting. I had figured that since the sphere light emits uniformly, we would also sample it uniformly. But as you say below, that's not necessarily true. So I guess if we're sampling directions at Y0 with a cosineweighted distribution for ThetaO, sort of implicit in that is that we have to calculate ThetaO based on the surface normal on the light at Y0. I think that makes sense.P_sigma is the pdf at Y0 for sampling the direction toward Y1. You're right that diffuse emission/BRDF has a 1/PI density, however one typically uses cosinedistribution to sample directions with pdf cos(theta0)/PI.