     vec3 wiW; // direction of sampled direct light (*towards* the light)
     float lightPdf;
     float Li = sampleLightInVolume(XYZ, rnd, wiW, lightPdf);
-    float V = Visibility(pW, wiW, rnd, inVolume);
+    float V = Visibility(pW, wiW, XYZ, rnd, inVolume);
     Li *= abs(1.0 - shadowStrength*(1.0-V));
-
     float f = phaseFunction(dot(woW, -wiW));
     float fOverPdf = min(radianceClamp, f/max(PDF_EPSILON, lightPdf));
     return fOverPdf * Li;

uniform float surfaceRoughness;
uniform float surfaceIor;

#define DENOM_TOLERANCE 1.0e-7
#define PDF_EPSILON 1.0e-6
#define THROUGHPUT_EPSILON 1.0e-5

                        inout vec3 wiL, inout float pdfOut, inout vec4 rnd )
{
    float ior = IOR_DIELE(wavelength_nm);
    float dielectricAlbedo = DIELECTRIC_SPEC_REFL_EVAL(X, woL, basis, XYZ);
    float Fr = dielectricAlbedo * fresnelDielectricReflectance(woL.z, ior, 1.0);
    float roughness = DIELECTRIC_ROUGHNESS(dieleRoughness, X, basis.nW);
    vec3 m = microfacetSample(rnd, roughness); // Sample microfacet normal m
