From 9b225443a45cebea2ea383d8be7adf11a8182198 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 30 Jun 2015 11:16:48 +0200 Subject: [PATCH] Fixed an incorrect radiance conversion factor in 'coating' and 'roughcoating' reported by Attila Afra. The models now produce the right falloff compared to Monte Carlo reference renderings with explicitly instantiated layers --- src/bsdfs/coating.cpp | 14 +++++--------- src/bsdfs/roughcoating.cpp | 8 +++----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/bsdfs/coating.cpp b/src/bsdfs/coating.cpp index e8288676..51126516 100644 --- a/src/bsdfs/coating.cpp +++ b/src/bsdfs/coating.cpp @@ -246,12 +246,10 @@ public: (1/std::abs(Frame::cosTheta(bRecInt.wi)) + 1/std::abs(Frame::cosTheta(bRecInt.wo)))).exp(); - if (measure == ESolidAngle) { - /* Solid angle compression & irradiance conversion factors */ + /* Solid angle compression & irradiance conversion factors */ + if (measure == ESolidAngle) result *= m_invEta * m_invEta * - Frame::cosTheta(bRec.wi) * Frame::cosTheta(bRec.wo) - / (Frame::cosTheta(bRecInt.wi) * Frame::cosTheta(bRecInt.wo)); - } + Frame::cosTheta(bRec.wo) / Frame::cosTheta(bRecInt.wo); return result; } @@ -364,11 +362,9 @@ public: result *= (1 - R12) * (1 - R21); - if (BSDF::getMeasure(bRec.sampledType) == ESolidAngle) { - /* Solid angle compression & irradiance conversion factors */ - result *= Frame::cosTheta(bRec.wi) / Frame::cosTheta(wiPrime); + /* Solid angle compression & irradiance conversion factors */ + if (BSDF::getMeasure(bRec.sampledType) == ESolidAngle) pdf *= m_invEta * m_invEta * Frame::cosTheta(bRec.wo) / Frame::cosTheta(woPrime); - } return result; } diff --git a/src/bsdfs/roughcoating.cpp b/src/bsdfs/roughcoating.cpp index a4817cdb..c26ada9b 100644 --- a/src/bsdfs/roughcoating.cpp +++ b/src/bsdfs/roughcoating.cpp @@ -306,12 +306,10 @@ public: (1/std::abs(Frame::cosTheta(bRecInt.wi)) + 1/std::abs(Frame::cosTheta(bRecInt.wo)))).exp(); - if (measure == ESolidAngle) { - /* Solid angle compression & irradiance conversion factors */ + /* Solid angle compression & irradiance conversion factors */ + if (measure == ESolidAngle) nestedResult *= m_invEta * m_invEta * - Frame::cosTheta(bRec.wi) * Frame::cosTheta(bRec.wo) - / (Frame::cosTheta(bRecInt.wi) * Frame::cosTheta(bRecInt.wo)); - } + Frame::cosTheta(bRec.wo) / Frame::cosTheta(bRecInt.wo); result += nestedResult; }