Fix T38615: cycles rendering beckmann/GGX refraction wrong with IOR equal to 1.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 12 Feb 2014 21:50:31 +0000 (22:50 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 12 Feb 2014 21:50:31 +0000 (22:50 +0100)
intern/cycles/kernel/closure/bsdf_microfacet.h

index 737cffb0f1859cba9c3dc8ed368bd6616bc51da0..dfa8886c113117afa82c7c0c8b7a1ca171eaca34 100644 (file)
@@ -219,7 +219,7 @@ ccl_device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, fl
                                *domega_in_dy = dTdy;
 #endif
 
-                               if (m_ag <= 1e-4f) {
+                               if (m_ag <= 1e-4f || fabsf(m_eta - 1.0f) < 1e-4f) {
                                        // some high number for MIS
                                        *pdf = 1e6f;
                                        *eval = make_float3(1e6f, 1e6f, 1e6f);
@@ -450,7 +450,7 @@ ccl_device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 N
                                *domega_in_dx = dTdx;
                                *domega_in_dy = dTdy;
 #endif
-                               if (m_ab <= 1e-4f) {
+                               if (m_ab <= 1e-4f || fabsf(m_eta - 1.0f) < 1e-4f) {
                                        // some high number for MIS
                                        *pdf = 1e6f;
                                        *eval = make_float3(1e6f, 1e6f, 1e6f);