diff options
author | Schoen <schoepas@deher1m1598.emea.adsint.biz> | 2017-04-03 08:52:05 +0300 |
---|---|---|
committer | Schoen <schoepas@deher1m1598.emea.adsint.biz> | 2017-04-03 09:47:02 +0300 |
commit | 90778901c9ea1e16d5907981e91bceba25ff207d (patch) | |
tree | 00bf16ee403c3ab1b507a5ec90b098a22e050f7c /intern/cycles/kernel/closure/bsdf_microfacet_multi.h | |
parent | 76eebd9379a5dad519ff01cf215fbe3db6de931e (diff) | |
parent | 3bf0026bec6f839ae0f7c40bde845299ce22e8de (diff) |
Merge branch 'master' into cycles_disney_brdfcycles_disney_brdf
Diffstat (limited to 'intern/cycles/kernel/closure/bsdf_microfacet_multi.h')
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_microfacet_multi.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h index a49b0717a3d..57f1e733ee7 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h @@ -43,7 +43,7 @@ ccl_device_forceinline float D_ggx_aniso(const float3 wm, const float2 alpha) ccl_device_forceinline float2 mf_sampleP22_11(const float cosI, const float2 randU) { if(cosI > 0.9999f || cosI < 1e-6f) { - const float r = sqrtf(randU.x / (1.0f - randU.x)); + const float r = sqrtf(randU.x / max(1.0f - randU.x, 1e-7f)); const float phi = M_2PI_F * randU.y; return make_float2(r*cosf(phi), r*sinf(phi)); } @@ -83,7 +83,7 @@ ccl_device_forceinline float3 mf_sample_vndf(const float3 wi, const float2 alpha const float3 wi_11 = normalize(make_float3(alpha.x*wi.x, alpha.y*wi.y, wi.z)); const float2 slope_11 = mf_sampleP22_11(wi_11.z, randU); - const float2 cossin_phi = normalize(make_float2(wi_11.x, wi_11.y)); + const float3 cossin_phi = safe_normalize(make_float3(wi_11.x, wi_11.y, 0.0f)); const float slope_x = alpha.x*(cossin_phi.x * slope_11.x - cossin_phi.y * slope_11.y); const float slope_y = alpha.y*(cossin_phi.y * slope_11.x + cossin_phi.x * slope_11.y); @@ -313,18 +313,18 @@ ccl_device_forceinline float mf_glass_pdf(const float3 wi, const float3 wo, cons #define MF_PHASE_FUNCTION glass #define MF_MULTI_GLASS -#include "bsdf_microfacet_multi_impl.h" +#include "kernel/closure/bsdf_microfacet_multi_impl.h" /* The diffuse phase function is not implemented as a node yet. */ #if 0 #define MF_PHASE_FUNCTION diffuse #define MF_MULTI_DIFFUSE -#include "bsdf_microfacet_multi_impl.h" +#include "kernel/closure/bsdf_microfacet_multi_impl.h" #endif #define MF_PHASE_FUNCTION glossy #define MF_MULTI_GLOSSY -#include "bsdf_microfacet_multi_impl.h" +#include "kernel/closure/bsdf_microfacet_multi_impl.h" ccl_device void bsdf_microfacet_multi_ggx_blur(ShaderClosure *sc, float roughness) { |