Fix #114780: Cycles: Principled Chiang Hair importance sampling correction #115241

Merged
Weizhen Huang merged 12 commits from HamilcarR/blender:cycles-114780_chiang-hair into main 2024-05-27 09:35:44 +02:00
1 changed files with 1 additions and 3 deletions
Showing only changes of commit ea85357491 - Show all commits

View File

@ -395,7 +395,7 @@ ccl_device int bsdf_hair_chiang_sample(KernelGlobals kg,
rand.z = max(rand.z, 1e-5f);
const float fac = 1.0f + v * logf(rand.z + (1.0f - rand.z) * expf(-2.0f / v));
float sin_theta_i = -fac * sintheta_temp_o +
cos_from_sin(fac) * cosf(M_2PI_F * rand.y) * costheta_temp_o;
sin_from_cos(fac) * cosf(M_2PI_F * rand.y) * costheta_temp_o;
HamilcarR marked this conversation as resolved Outdated

I do not like this naming, because this variable has a concrete meaning and is therefore not temp, and it does not following the naming convention of the nearby code.
I suggest sin_theta_o_tilted

I do not like this naming, because this variable has a concrete meaning and is therefore not temp, and it does not following the naming convention of the nearby code. I suggest `sin_theta_o_tilted`

agreed , this was poorly named.

agreed , this was poorly named.
float cos_theta_i = cos_from_sin(sin_theta_i);
float phi;
@ -407,8 +407,6 @@ ccl_device int bsdf_hair_chiang_sample(KernelGlobals kg,
}
const float phi_i = phi_o + phi;
hair_alpha_angles(sin_theta_o, cos_theta_o, bsdf->alpha, angles);
Spectrum F = zero_spectrum();
float F_energy = 0.0f;