     vec2 brdf = texture(u_brdfLUT, brdfSamplePoint).rg;
 
     vec4 diffuseSample = texture(u_DiffuseEnvSampler, n);
-
     vec4 specularSample = textureLod(u_SpecularEnvSampler, reflection, lod);
+
+    //clearcoat sample
+    lod = clamp(u_ClearcoatRoughnessFactor * float(u_MipCount), 0.0, float(u_MipCount));
+    brdfSamplePoint = clamp(vec2(NdotV, materialInfo.perceptualRoughness), vec2(0.0, 0.0), vec2(1.0, 1.0));
+    vec4 specularSampleClearcoat = textureLod(u_SpecularEnvSampler, reflection, lod);
 
 #ifdef USE_HDR
     // Already linear.
     vec3 diffuseLight = diffuseSample.rgb;
     vec3 specularLight = specularSample.rgb;
+    vec3 specularLightClearcoat = specularSampleClearcoat.rgb;
 #else
     vec3 diffuseLight = SRGBtoLINEAR(diffuseSample).rgb;
     vec3 specularLight = SRGBtoLINEAR(specularSample).rgb;
+    vec3 specularLightClearcoat = SRGBtoLINEAR(specularLightClearcoat).rgb;
 #endif
 
     vec3 diffuse = diffuseLight * materialInfo.diffuseColor;
     vec3 specular = specularLight * (materialInfo.specularColor * brdf.x + brdf.y);
-
+    vec3 specularClearcoat = specularLightClearcoat * (materialInfo.specularColor * brdf.x + brdf.y);
+
+    //apply clearcoat only if clearcoatFactor > 0
+    if(u_ClearcoatFactor > 0.0)
+    {
+        vec3 l = -n;
+        vec3 h = normalize(l + v);
+        float NdotL = clamp(dot(n, l), 0.0, 1.0); // l = 1.0
+        float VdotH = clamp(dot(h, v), 0.0, 1.0); // h = normal( l + v );
+        vec3 factor0 = (1.0 - u_ClearcoatFactor * fresnel(vec3(0.04), NdotV)) * (1.0 - u_ClearcoatFactor * fresnel(vec3(0.04), NdotL));
+        vec3 factor1 = u_ClearcoatFactor * fresnel(vec3(0.04), VdotH);
+        return (diffuse + specular) * factor0 + specularClearcoat * factor1;
+        //return vec3(factor0.x / factor1.x, 0.0, 0.0);
+    }
     return diffuse + specular;
 }
 #endif

uniform float u_AlphaCutoff;
#endif

uniform vec3 u_Camera;

uniform int u_MipCount;

    diffuseColor = baseColor.rgb * (vec3(1.0) - f0) * (1.0 - metallic);

    specularColor = mix(f0, baseColor.rgb, metallic);

    //assuming that in the metallicRoughness setting f0 stays vec3(0.04)
    clearcoatColor = mix(f0,baseColor.rgb,metallic);

#endif // ! MATERIAL_METALLICROUGHNESS

