message: fixed bug in MicrofacetDielectricLayer, which caused a darkening artifact near the edges
diff: #include "BSDF.ih"
  #include "GGXDistribution.ih"
  +/* Simplified Weidlich-Wilkie microfacet coating BSDF with the Smith microsurface model.
  + Refraction for all rays and Fresnel for exiting rays are ignored, but absorption is computed
  + from the refracted ray lengths. The advantages are that it does not suffer from energy loss,
  + absorption behaves the same as in the original approach, and it's faster.
  + [Weidlich and Wilkie, 2007, "Arbitrarily Layered Micro-Facet Surfaces"]
  + [Walter et al., 2007, "Microfacet Models for Refraction through Rough Surfaces"]
  +*/
  struct MicrofacetDielectricLayer
  {
  BSDF super;
  @@ -72,12 +79,11 @@ inline BSDF_EvalRes MicrofacetDielectricLayer_eval(const varying BSDF* uniform s
  // Compute the final substrate reflection
  // Ignore Fresnel for the exiting ray
  - float Ft = 1.0f-fresnelDielectric(cosThetaO, self->eta);
  - substrate.value = substrate.value * Ft;
  + substrate.value = substrate.value * (1.0f-F);
  // Compute the total reflection
  - float coatingPickProb = 1.0f-Ft;
  - float substratePickProb = Ft;
  + float coatingPickProb = fresnelDielectric(cosThetaO, self->eta); // have to use the macronormal for sampling
  + float substratePickProb = 1.0f - coatingPickProb;
  res.pdf = coatingPickProb * coating.pdf + substratePickProb * substrate.pdf;
  res.value = coating.value + substrate.value;
  @@ -97,9 +103,8 @@ inline BSDF_SampleRes MicrofacetDielectricLayer_sample(const varying BSDF* unifo
  vec3f wh;
  BSDF_EvalRes substrate;
  - float Ft = 1.0f-fresnelDielectric(cosThetaO, self->eta);
  - float coatingPickProb = 1.0f-Ft;
  - float substratePickProb = Ft;
  + float coatingPickProb = fresnelDielectric(cosThetaO, self->eta); // only the macronormal is available yet
  + float substratePickProb = 1.0f - coatingPickProb;
  if (ss < coatingPickProb)
  {
  @@ -154,7 +159,7 @@ inline BSDF_SampleRes MicrofacetDielectricLayer_sample(const varying BSDF* unifo
  substrate.value = substrate.value * pow(self->transmittance, self->thickness * (rcp(cosThetaO1) + rcp(cosThetaI1)));
  // Compute the final substrate reflection
  - substrate.value = substrate.value * Ft;
  + substrate.value = substrate.value * (1.0f-F);
  // Compute the total reflection
  res.pdf = coatingPickProb * coating.pdf + substratePickProb * substrate.pdf;
  