Fix NaN in Principled Huang Hair sphg_dir()

thanks Christophe Hery for spotting and fixing the issue
This commit is contained in:
Weizhen Huang
2023-09-05 18:03:43 +02:00
parent d5b9127e1b
commit df26271db4

View File

@@ -152,7 +152,7 @@ ccl_device_inline float3 sphg_dir(float theta, float gamma, float b)
fast_sincosf(theta, &sin_theta, &cos_theta);
fast_sincosf(gamma, &sin_gamma, &cos_gamma);
if (b == 1.0f) {
if (b == 1.0f || fabsf(cos_gamma) < 1e-6f) {
sin_phi = sin_gamma;
cos_phi = cos_gamma;
}