1 //! Functions to calculate fresnel coefficient and approximate zero fresnel value.
2 vec3 occPBRFresnel (in vec3 theBaseColor,
6 theIOR = (1.0 - theIOR) / (1.0 + theIOR);
8 vec3 f0 = vec3(theIOR);
9 f0 = mix (f0, theBaseColor.rgb, theMetallic);
13 vec3 occPBRFresnel (in vec3 theBaseColor,
18 vec3 f0 = occPBRFresnel (theBaseColor, theMetallic, theIOR);
19 theCosVH = 1.0 - theCosVH;
21 theCosVH *= theCosVH * theCosVH * theCosVH * theCosVH;
22 return f0 + (vec3 (1.0) - f0) * theCosVH;
25 vec3 occPBRFresnel (in vec3 theBaseColor,
27 in float theRoughness,
31 vec3 f0 = occPBRFresnel (theBaseColor, theMetallic, theIOR);
32 theCosV = 1.0 - theCosV;
34 theCosV *= theCosV * theCosV * theCosV * theCosV;
35 return f0 + (max(vec3(1.0 - theRoughness), f0) - f0) * theCosV;