 {
     return f0 + (1.0 - f0) * pow(clamp(1.0 - (NdotL), 0.0, 1.0), 5.0);
 }
+
 // Calculation of the lighting contribution from an optional Image Based Light source.
 // Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
 // See our README.md on Environment Maps [3] for additional discussion.
 #ifdef USE_IBL
-vec3 getIBLContribution(MaterialInfo materialInfo, vec3 n, vec3 v)
-{
+vec3 getIBLContribution(MaterialInfo materialInfo, vec3 v)
+{
+    vec3 n = materialInfo.normal;
+
     float NdotV = clamp(dot(n, v), 0.0, 1.0);
 
     float lod = clamp(materialInfo.perceptualRoughness * float(u_MipCount), 0.0, float(u_MipCount));

    vec3 reflectance90;           // reflectance color at grazing angle
    vec3 specularColor;           // color contribution from specular lighting

    float clearcoatFactor;
    float clearcoatRoughness;
    vec3 clearcoatNormal;
};

//based on Schlicks approximation of Fresnel


    // Calculate lighting contribution from image based lighting source (IBL)
#ifdef USE_IBL
    color += getIBLContribution(materialInfo, view);
    if(u_ClearcoatFactor > 0.0)
    {
        color += getIBLContribution(clearCoatInfo, view);
    }
#endif

