Fix #131240: Cycles: Negative integration range in Huang Hair
The cause is numerical issues with `fast_sinf()`. While fixing `fast_sinf()` would ultimately fix the problem, it involves more complications in other code paths, and it is safer to clamp the integration range anyway. Pull Request: https://projects.blender.org/blender/blender/pulls/131689
This commit is contained in:
committed by
Weizhen Huang
parent
2fd3a633db
commit
a16879a5f0
@@ -856,6 +856,14 @@ ccl_device Spectrum bsdf_hair_huang_eval(KernelGlobals kg,
|
||||
bsdf->extra->gamma_m_min = gamma_m_min;
|
||||
bsdf->extra->gamma_m_max = gamma_m_max;
|
||||
|
||||
/* FIXME(weizhen): There is a problem of `fast_sinf(-1.57085085f)` returning 0 instead of
|
||||
* expected -1, causing the range to be incorrect. As that seems an uncommon case, it feels safer
|
||||
* to cover this case first, and look into solving the problem in `fast_sinf()` later. */
|
||||
kernel_assert(bsdf->extra->gamma_m_min < bsdf->extra->gamma_m_max);
|
||||
if (!(bsdf->extra->gamma_m_min < bsdf->extra->gamma_m_max)) {
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
const float projected_area = cos_theta(local_I) * dh;
|
||||
|
||||
return (bsdf_hair_huang_eval_r(kg, sc, local_I, local_O) +
|
||||
|
||||
Reference in New Issue
Block a user