Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-07-15 13:56:40 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-07-15 13:59:00 +0400
commita378f8d2d8f7d30eb699ee2f16e111f60b7900df (patch)
treeb3f93df07de6d36fd2646218b4eacb0a42559443 /intern/cycles/kernel/closure/bsdf_microfacet.h
parent2f03cccecd1eaa5c95daa7a75b3d0c57e7d0e038 (diff)
Fix T40964: Massive shading failures with glass node mixing, whiteouts and blackouts
Diffstat (limited to 'intern/cycles/kernel/closure/bsdf_microfacet.h')
-rw-r--r--intern/cycles/kernel/closure/bsdf_microfacet.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h
index df0644becee..870b56803bb 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet.h
@@ -513,6 +513,10 @@ 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: */
@@ -862,7 +866,11 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
float cosHO = dot(Ht, I);
float cosHI = dot(Ht, omega_in);
- /* eq. 33: first we calculate D(m) with m=Ht: */
+ /* 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);
float cosThetaM2 = cosThetaM * cosThetaM;