0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
[occt.git] / src / Shaders / Shaders_PBRFresnel_glsl.pxx
1 // This file has been automatically generated from resource file src/Shaders/PBRFresnel.glsl
2
3 static const char Shaders_PBRFresnel_glsl[] =
4   "//! Functions to calculate fresnel coefficient and approximate zero fresnel value.\n"
5   "vec3 occPBRFresnel (in vec3  theBaseColor,\n"
6   "                    in float theMetallic,\n"
7   "                    in float theIOR)\n"
8   "{\n"
9   "  theIOR = (1.0 - theIOR) / (1.0 + theIOR);\n"
10   "  theIOR *= theIOR;\n"
11   "  vec3 f0 = vec3(theIOR);\n"
12   "  f0 = mix (f0, theBaseColor.rgb, theMetallic);\n"
13   "  return f0;\n"
14   "}\n"
15   "\n"
16   "vec3 occPBRFresnel (in vec3  theBaseColor,\n"
17   "                    in float theMetallic,\n"
18   "                    in float theIOR,\n"
19   "                    in float theCosVH)\n"
20   "{\n"
21   "  vec3 f0 = occPBRFresnel (theBaseColor, theMetallic, theIOR);\n"
22   "  theCosVH = 1.0 - theCosVH;\n"
23   "  theCosVH *= theCosVH;\n"
24   "  theCosVH *= theCosVH * theCosVH * theCosVH * theCosVH;\n"
25   "  return f0 + (vec3 (1.0) - f0) * theCosVH;\n"
26   "}\n"
27   "\n"
28   "vec3 occPBRFresnel (in vec3  theBaseColor,\n"
29   "                    in float theMetallic,\n"
30   "                    in float theRoughness,\n"
31   "                    in float theIOR,\n"
32   "                    in float theCosV)\n"
33   "{\n"
34   "  vec3 f0 = occPBRFresnel (theBaseColor, theMetallic, theIOR);\n"
35   "  theCosV = 1.0 - theCosV;\n"
36   "  theCosV *= theCosV;\n"
37   "  theCosV *= theCosV * theCosV * theCosV * theCosV;\n"
38   "  return f0 + (max(vec3(1.0 - theRoughness), f0) - f0) * theCosV;\n"
39   "}\n";