 // use for debugging.
 varying lowp vec3 color;
 
-mediump float G1(mediump float dottedFactor, mediump float k)
-{
-  return dottedFactor / (dottedFactor * (1.0 - k) + k);
-}
+#define G1(dottedFactor, k) \
+  (dottedFactor / (dottedFactor * (1.0 - k) + k))
 
 // [FGS]
 // F0 : fresnel refrectance of material.

    mediump vec3 f = max((D * F * G) / (4.0 * dotNL * dotNV), 0.0);
    Ispec += lightColor * attenuation * f;
#else
	mediump vec3 F0 = CalcF0(col.rgb, metallicAndRoughness.x);
	mediump float dotNV = max(dot(normal, eyeVector), 0.0001);
#endif


    // F(v, h) = F0 + (1.0 - F0) * 2^(-5.55473*dot(v, h) - 6.98316)*dot(v, h)
    lowp float metallic = metallicAndRoughness.x;
    mediump float dotVH = dot(eyeVector, halfVector);
	mediump vec3 F0;
	CalcF0(F0, col.rgb, metallic);
    mediump vec3 F = FresnelSchlick(F0, dotVH);

    // k = (roughness + 1)^2 / 8
