0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
[occt.git] / src / Shaders / Shaders_PBRCookTorrance_glsl.pxx
diff --git a/src/Shaders/Shaders_PBRCookTorrance_glsl.pxx b/src/Shaders/Shaders_PBRCookTorrance_glsl.pxx
new file mode 100644 (file)
index 0000000..c2c8f88
--- /dev/null
@@ -0,0 +1,23 @@
+// This file has been automatically generated from resource file src/Shaders/PBRCookTorrance.glsl
+
+static const char Shaders_PBRCookTorrance_glsl[] =
+  "//! Calculates Cook-Torrance BRDF.\n"
+  "vec3 occPBRCookTorrance (in vec3  theView,\n"
+  "                         in vec3  theLight,\n"
+  "                         in vec3  theNormal,\n"
+  "                         in vec3  theBaseColor,\n"
+  "                         in float theMetallic,\n"
+  "                         in float theRoughness,\n"
+  "                         in float theIOR)\n"
+  "{\n"
+  "  vec3 aHalf = normalize (theView + theLight);\n"
+  "  float aCosV = max(dot(theView, theNormal), 0.0);\n"
+  "  float aCosL = max(dot(theLight, theNormal), 0.0);\n"
+  "  float aCosH = max(dot(aHalf, theNormal), 0.0);\n"
+  "  float aCosVH = max(dot(aHalf, theView), 0.0);\n"
+  "  vec3 aCookTorrance = occPBRDistribution (aCosH, theRoughness)\n"
+  "                     * occPBRGeometry     (aCosV, aCosL, theRoughness)\n"
+  "                     * occPBRFresnel      (theBaseColor, theMetallic, theIOR, aCosVH);\n"
+  "  aCookTorrance /= 4.0;\n"
+  "  return aCookTorrance;\n"
+  "}\n";