Fix #131240: Cycles: Negative integration range in Huang Hair

It is possible that the valid range computed from `theta` and the range
visible to the current pixel do not overlap. In this case the hair
section has no contribution.

Pull Request: https://projects.blender.org/blender/blender/pulls/133337
This commit is contained in:
Weizhen Huang
2025-01-21 11:48:45 +01:00
committed by Weizhen Huang
parent e2e992a425
commit e6645bf06b

View File

@@ -875,6 +875,12 @@ 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;
if (!(bsdf->extra->gamma_m_min < bsdf->extra->gamma_m_max)) {
/* No overlap between the valid range and the visible range. Can happen at grazing `theta`
* angles. */
return zero_spectrum();
}
const float projected_area = cos_theta(local_I) * dh;
return (bsdf_hair_huang_eval_r(kg, sc, local_I, local_O) +