diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-10 16:20:36 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-10 16:20:36 +0300 |
commit | b03ac8384389a4ad34bd6bcf0cc7be204c7ada9f (patch) | |
tree | 56a2a1fc83fda557418c1bc37174e9044de380f2 /intern/cycles/kernel/closure/bsdf_refraction.h | |
parent | 298d8681a0ac28ccc96e593a02ad34a5cef624c6 (diff) |
Cycles: Correction to glossy shaders not handling total internal reflection
The issue was caused by lack of check for whether fresnel term is actually
giving total internal reflection in refraction BSDFs. This lead to usage of
arbitrary vector of (0, 0, 0) as reflection, giving numeric issues in other
areas of the kernel.
This gives some visual changes of sharp reflection but it seems to be rather
proper now. Which also corresponds with rough glossy reflection with sharpness
set to 0.001 (previously it was totally different from sharpness of 0.0, which
is just weird).
Diffstat (limited to 'intern/cycles/kernel/closure/bsdf_refraction.h')
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_refraction.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_refraction.h b/intern/cycles/kernel/closure/bsdf_refraction.h index c96ac62fafa..02a06941afa 100644 --- a/intern/cycles/kernel/closure/bsdf_refraction.h +++ b/intern/cycles/kernel/closure/bsdf_refraction.h @@ -67,13 +67,14 @@ ccl_device int bsdf_refraction_sample(const ShaderClosure *sc, float3 Ng, float3 float3 dRdx, dRdy, dTdx, dTdy; #endif bool inside; - fresnel_dielectric(m_eta, N, I, &R, &T, + float fresnel; + fresnel = fresnel_dielectric(m_eta, N, I, &R, &T, #ifdef __RAY_DIFFERENTIALS__ dIdx, dIdy, &dRdx, &dRdy, &dTdx, &dTdy, #endif &inside); - if(!inside) { + if(!inside && fresnel != 1.0f) { /* Some high number for MIS. */ *pdf = 1e6f; *eval = make_float3(1e6f, 1e6f, 1e6f); |