You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<<Compute for Henyey–Greenstein sample>>=
Float cosTheta;
if (std::abs(g) < 1e-3)
cosTheta = 1 - 2 * u[0];
else {
Float sqrTerm = (1 - g * g) /
(1 - g + 2 * g * u[0]);
cosTheta = (1 + g * g - sqrTerm * sqrTerm) / (2 * g); // HERE
}
There should be a negative sign in front of cosTheta RHS.
The code block is not consistent with , and is not consistent with
PhaseHG function definition: Float denom = 1 + g * g + 2 * g * cosTheta;, if no minus sign given, denom should be 1 + g * g - 2 * g * cosTheta. According to the ray direction convention in PBRT-v3, all 'incident ray' points outwards, therefore cosTheta RHS should have a minus sign.
The formula in that chapter, listed right above the code block.
Actual experiments... Initially I implemented h-g sampling based on the code above, which costed me two days to debug my code. The following experiments are based on pbrt-v3, and the code doesn't have the problem mentioned above. You will notice that we can not really distinguish between these two the incorrect results, even though one exhibits forward scattering and the other is backward.
correct g = 0.5
correct g = -0.5
incorrect g = 0.5
incorrect g =-0.5
The text was updated successfully, but these errors were encountered:
In chapter 15.2 - Sampling Volume Scattering, for H-G phase function sampling:
There should be a negative sign in front of
cosTheta
RHS.The code block is not consistent with , and is not consistent with
Float denom = 1 + g * g + 2 * g * cosTheta;
, if no minus sign given,denom
should be1 + g * g - 2 * g * cosTheta
. According to the ray direction convention in PBRT-v3, all 'incident ray' points outwards, thereforecosTheta
RHS should have a minus sign.The text was updated successfully, but these errors were encountered: