0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
[occt.git] / src / Shaders / Shaders_PBRCookTorrance_glsl.pxx
1 // This file has been automatically generated from resource file src/Shaders/PBRCookTorrance.glsl
2
3 static const char Shaders_PBRCookTorrance_glsl[] =
4   "//! Calculates Cook-Torrance BRDF.\n"
5   "vec3 occPBRCookTorrance (in vec3  theView,\n"
6   "                         in vec3  theLight,\n"
7   "                         in vec3  theNormal,\n"
8   "                         in vec3  theBaseColor,\n"
9   "                         in float theMetallic,\n"
10   "                         in float theRoughness,\n"
11   "                         in float theIOR)\n"
12   "{\n"
13   "  vec3 aHalf = normalize (theView + theLight);\n"
14   "  float aCosV = max(dot(theView, theNormal), 0.0);\n"
15   "  float aCosL = max(dot(theLight, theNormal), 0.0);\n"
16   "  float aCosH = max(dot(aHalf, theNormal), 0.0);\n"
17   "  float aCosVH = max(dot(aHalf, theView), 0.0);\n"
18   "  vec3 aCookTorrance = occPBRDistribution (aCosH, theRoughness)\n"
19   "                     * occPBRGeometry     (aCosV, aCosL, theRoughness)\n"
20   "                     * occPBRFresnel      (theBaseColor, theMetallic, theIOR, aCosVH);\n"
21   "  aCookTorrance /= 4.0;\n"
22   "  return aCookTorrance;\n"
23   "}\n";