0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
[occt.git] / src / Shaders / PBRGeometry.glsl
diff --git a/src/Shaders/PBRGeometry.glsl b/src/Shaders/PBRGeometry.glsl
new file mode 100644 (file)
index 0000000..18987e7
--- /dev/null
@@ -0,0 +1,13 @@
+//! Calculates geometry factor for Cook-Torrance BRDF.
+float occPBRGeometry (in float theCosV,
+                      in float theCosL,
+                      in float theRoughness)
+{
+  float k = theRoughness + 1.0;
+  k *= 0.125 * k;
+  float g1 = 1.0;
+  g1 /= theCosV * (1.0 - k) + k;
+  float g2 = 1.0;
+  g2 /= theCosL * (1.0 - k) + k;
+  return g1 * g2;
+}