From 12b7850d4fcd420f23f80c16a85f08d7cd9158f5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 31 Jul 2015 13:43:36 +0200 Subject: Cycles: Fix for transmissive microfacet sampling This is an alternate fix for T40964 which resolves bad handling of caustics reported in T45609. There were too much transmission rays being discarded by the original fix, which caused by caustic light being totally disabled. There is still some room for investigation why exactly original paper didn't work that well, could be caused by the way how the pdf is calculated. In any case current results seems rather correct now. --- intern/cycles/kernel/closure/bsdf_microfacet.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'intern') diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index 6a50bbed3b3..2a0e8f62e7c 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -382,10 +382,6 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con float cosHO = dot(Ht, I); float cosHI = dot(Ht, omega_in); - /* those situations makes chi+ terms in eq. 33, 34 be zero */ - if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f) - return make_float3(0.0f, 0.0f, 0.0f); - float D, G1o, G1i; /* eq. 33: first we calculate D(m) with m=Ht: */ @@ -412,7 +408,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con * pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */ float common = D * (m_eta * m_eta) / (cosNO * Ht2); float out = G * fabsf(cosHI * cosHO) * common; - *pdf = G1o * cosHO * fabsf(cosHI) * common; + *pdf = G1o * fabsf(cosHO * cosHI) * common; return make_float3(out, out, out); } @@ -735,10 +731,6 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc float cosHO = dot(Ht, I); float cosHI = dot(Ht, omega_in); - /* those situations makes chi+ terms in eq. 25, 27 be zero */ - if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f) - return make_float3(0.0f, 0.0f, 0.0f); - /* eq. 25: first we calculate D(m) with m=Ht: */ float alpha2 = alpha_x * alpha_y; float cosThetaM = min(dot(N, Ht), 1.0f); @@ -764,7 +756,7 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc * pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */ float common = D * (m_eta * m_eta) / (cosNO * Ht2); float out = G * fabsf(cosHI * cosHO) * common; - *pdf = G1o * cosHO * fabsf(cosHI) * common; + *pdf = G1o * fabsf(cosHO * cosHI) * common; return make_float3(out, out, out); } -- cgit v1.2.3