1 //! Calculates direct illumination using Cook-Torrance BRDF.
2 vec3 occPBRIllumination (in vec3 theView,
10 in float theLightIntensity)
12 vec3 aHalf = normalize (theView + theLight);
13 float aCosVH = max(dot(theView, aHalf), 0.0);
14 vec3 aFresnel = occPBRFresnel (theBaseColor.rgb, theMetallic, theIOR, aCosVH);
15 vec3 aSpecular = occPBRCookTorrance (theView,
22 vec3 aDiffuse = vec3(1.0) - aFresnel;
23 aDiffuse *= 1.0 - theMetallic;
25 aDiffuse *= theBaseColor.rgb;
26 aDiffuse = mix (vec3(0.0), aDiffuse, theBaseColor.a);
27 return (aDiffuse + aSpecular) * theLightColor * theLightIntensity * max(0.0, dot(theLight, theNormal));