    return R0 + (1.0 - R0)*pow(1.0 - dot(light, normal), 5.0);
 }
 
-float cookTorrance(float m)
+float cookTorrance(float m, float iR)
 {
     vec3 V, Nf, H, Ln;
-    float cook, D, G, vdotn;
+    float cook, D, G, F, vdotn;
 
     Nf = normalize(N);
     Ln = normalize(L.xyz);

    H = normalize(Ln + V);
    D = distro(Nf, H, m);
    G = geom(Nf, H, Ln, V);

    cook  = D*G;
    vdotn = dot(V, Nf);

void main (void)  
{
    vec4 cFinal;
    float iDiff, iSpec, F;

    iDiff = seelinger();
    //iSpec = minnaert(0.5f);
    iSpec = cookTorrance(0.2, 0.5);

    cFinal = (cLightAmbt*cMatAmbt) + iDiff*(cLightDiff*cMatDiff) + iSpec*(cLightSpec*cMatSpec);

    F = fresnel(Nn, normalize(L.xyz), 0.8, 0.8, 1.5);
    cFinal.w = 1.0;

    gl_FragColor = F*cFinal;
}
