[Bf-blender-cvs] [12b7850] master: Cycles: Fix for transmissive microfacet sampling

Sergey Sharybin noreply at git.blender.org
Fri Jul 31 13:50:09 CEST 2015


Commit: 12b7850d4fcd420f23f80c16a85f08d7cd9158f5
Author: Sergey Sharybin
Date:   Fri Jul 31 13:43:36 2015 +0200
Branches: master
https://developer.blender.org/rB12b7850d4fcd420f23f80c16a85f08d7cd9158f5

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.

===================================================================

M	intern/cycles/kernel/closure/bsdf_microfacet.h

===================================================================

diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h
index 6a50bbe..2a0e8f6 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);
 }




More information about the Bf-blender-cvs mailing list