From c4045a10662127f2b322aaf47d6f56ebe198b2be Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Thu, 31 Jan 2013 21:19:28 -0500 Subject: [PATCH] further restricted roughness range to prevent numerical overflow issues on single precision --- src/bsdfs/microfacet.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bsdfs/microfacet.h b/src/bsdfs/microfacet.h index 16799e97..9fbf7538 100644 --- a/src/bsdfs/microfacet.h +++ b/src/bsdfs/microfacet.h @@ -84,7 +84,11 @@ public: * (For lower roughness values, please switch to the smooth BSDF variants) */ Float transformRoughness(Float value) const { - value = std::max(value, (Float) 1e-5f); + #if defined(SINGLE_PRECISION) + value = std::max(value, (Float) 1e-3f); + #else + value = std::max(value, (Float) 1e-5f); + #endif if (m_type == EPhong || m_type == EAshikhminShirley) value = std::max(2 / (value * value) - 2, (Float) 0.1f); return value;