     if (1.0 - abs(NdotUp) <= epsilon)
     {
         // Sampling +Y or -Y, so we need a more robust bitangent.
- 		if (NdotUp > 0.0)
- 		{
- 			bitangent = vec3(0.0, 0.0, 1.0);
- 		}
- 		else
- 		{
- 			bitangent = vec3(0.0, 0.0, -1.0);
- 		}
+        if (NdotUp > 0.0)
+        {
+            bitangent = vec3(0.0, 0.0, 1.0);
+        }
+        else
+        {
+            bitangent = vec3(0.0, 0.0, -1.0);
+        }
     }
 
     vec3 tangent = normalize(cross(bitangent, normal));
     bitangent = cross(normal, tangent);
 
-	return mat3(tangent, bitangent, normal);
+    return mat3(tangent, bitangent, normal);
 }
 
 // NDF

// entry point
void main()
{
	vec2 newUV = texCoord ;

	newUV = newUV*2.0-1.0;

	vec3 scan = uvToXYZ(u_currentFace, newUV);

	vec3 direction = normalize(scan);
	direction.y = -direction.y;

	vec3 color = filterColor(direction);

	fragmentColor = vec4(color,1.0);

}


float PDF(vec3 H, vec3 N, float roughness)
{
    float NdotH = dot(N, H);
    if(u_distribution == cLambertian)
    {
        return max(NdotH * (1.0 / MATH_PI), 0.0);
    }
    else if(u_distribution == cGGX)
    {
        float D = D_GGX(NdotH, roughness);
        return max(D / 4.0, 0.0);
    }
    else if(u_distribution == cCharlie)
    {
        float D = D_Charlie(roughness, NdotH);
        return max(D / 4.0, 0.0);
    }

    return 0.f;
}

// getImportanceSample returns an importance sample direction with pdf in the .w component
