Guest User

GGX microfacet fresnel hack

a guest
Jun 16th, 2016
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.04 KB | None | 0 0
  1. diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h
  2. --- a/intern/cycles/kernel/closure/bsdf_microfacet.h
  3. +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h
  4. @@ -342,8 +342,9 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, cons
  5.         float G = G1o * G1i;
  6.  
  7.         /* eq. 20 */
  8. +       float fresnel = fresnel_dielectric_cos(dot(m,I), 1.45f);
  9.         float common = D * 0.25f / cosNO;
  10. -       float out = G * common;
  11. +       float out = fresnel * G * common;
  12.  
  13.         /* eq. 2 in distribution of visible normals sampling
  14.          * pm = Dw = G1o * dot(m, I) * D / dot(N, I); */
  15. @@ -501,8 +503,9 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
  16.                         }
  17.  
  18.                         /* see eval function for derivation */
  19. +                       float fresnel = fresnel_dielectric_cos(dot(m,I), 1.45f);
  20.                         float common = (G1o * D) * 0.25f / cosNO;
  21. -                       float out = G1i * common;
  22. +                       float out = fresnel * G1i * common;
  23.                         *pdf = common;
  24.  
  25.                         *eval = make_float3(out, out, out);
Add Comment
Please, Sign In to add comment