     float G  = min(1.0, max(0.0, min(G1, G2)));
 
     // Compute the fresnel term
-    float F  = Reflectance + (1.0 - Reflectance) * pow(1.0 - NormalDotView, 5.0);
+    float F  = Fresnel(NormalDotView, Reflectance);
 
     // Compute the roughness term
     float R_2     = Roughness * Roughness;

    // Combine colors
    vec3 Final = Ambient * Diffuse + LightColor * Lighting;

    return Final;
}


vec3 mainFS()
{
#if defined(DistanceBasedCutting)
    if (distance(Position, ClipOrigin) > ClipDistance) discard;
#endif

    // Copy and correct the input
    vec3 Ambient = AmbientColor;
    vec3 Diffuse  = DiffuseColor;
    vec3 Specular = SpecularColor;
    vec2 Texcoord = Texcoord;

    vec3 Normal   = normalize(Normal);
    vec3 Tangent  = normalize(Tangent);
    vec3 Bitangent = normalize(Bitangent);
    vec3 ViewDir  = normalize(ViewDirection);
    vec3 LightDir = normalize(LightDirection);

#if defined(ExponentialMapping)
    Texcoord = Pow(fract(Texcoord) - 0.5, ExpScale) + 0.5;
#endif

#if defined(DiffuseMap_Present)
    // Read the diffuse map
    vec3 DiffuseTexColor = texture2D(DiffuseMap, Texcoord).xyz;

    // Adjust contrast if needed
#if defined(DiffuseMap_AdjustContrast)
    DiffuseTexColor = AdjustContrast(DiffuseTexColor, DiffuseContrastScaleBias);
#endif

    // Apply the diffuse map
    Diffuse *= DiffuseTexColor;
#endif

    // Apply the normal map and convert vectors to tangent space
#if defined(NormalMap_Present)
    mat3 TBN = mat3(Tangent, Bitangent, Normal);

