PBRGeometry.glsl 354 B

12345678910111213
  1. //! Calculates geometry factor for Cook-Torrance BRDF.
  2. float occPBRGeometry (in float theCosV,
  3. in float theCosL,
  4. in float theRoughness)
  5. {
  6. float k = theRoughness + 1.0;
  7. k *= 0.125 * k;
  8. float g1 = 1.0;
  9. g1 /= theCosV * (1.0 - k) + k;
  10. float g2 = 1.0;
  11. g2 /= theCosL * (1.0 - k) + k;
  12. return g1 * g2;
  13. }