         // Trowbridge-Reitz / GGX microfacet model (Walter et al)
         // https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.html
 
-        MicrofacetDistributionSample ggx = GGX(vec2(u, v), roughness);
+        MicrofacetDistributionSample ggx = GGX(xi, roughness);
         cosTheta = ggx.cosTheta;
         sinTheta = ggx.sinTheta;
         phi = ggx.phi;

    {
        // Cosine weighted hemisphere sampling
        // http://www.pbr-book.org/3ed-2018/Monte_Carlo_Integration/2D_Sampling_with_Multidimensional_Transformations.html#Cosine-WeightedHemisphereSampling
        cosTheta = sqrt(1.0 - u);
        sinTheta = sqrt(u); // equivalent to `sqrt(1.0 - cosTheta*cosTheta)`;
        phi = 2.0 * MATH_PI * v;

        pdf = cosTheta / MATH_PI; // evaluation for solid angle, therefore drop the sinTheta
    }


    // evaluate sampling equations
    float alpha = roughness * roughness;
    ggx.cosTheta = sqrt(1.0 - alpha * alpha * xi.y / (1.0 - xi.y));
    ggx.sinTheta = alpha * sqrt(xi.y) / (sqrt(1.0 - xi.y) * ggx.cosTheta);
    ggx.phi = 2.0 * MATH_PI * xi.x;

    // evaluate GGX pdf (for half vector)
    ggx.probability = D_GGX(ggx.cosTheta, roughness) * ggx.cosTheta; // drop sinTheta as we are evaluating for solid angle
