     {
         // 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;
+        cosTheta = sqrt(1.0 - xi.y);
+        sinTheta = sqrt(xi.y); // equivalent to `sqrt(1.0 - cosTheta*cosTheta)`;
+        phi = 2.0 * MATH_PI * xi.x;
 
         pdf = cosTheta / MATH_PI; // evaluation for solid angle, therefore drop the sinTheta
     }

{
    // generate a quasi monte carlo point in the unit square [0.1)^2
    vec2 xi = hammersley2d(sampleIndex, u_sampleCount);
    float u = xi.x;
    float v = xi.y;

    // declare importance sample parameters
    float phi = 0.0; // theoretically there could be a distribution that defines phi differently

        // Trowbridge-Reitz / GGX microfacet model (Walter et al)
        // https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.html

        MicrofacetDistributionSample ggx = GGX(xi, roughness);
        cosTheta = ggx.cosTheta;
        sinTheta = ggx.sinTheta;
        phi = ggx.phi;
