67312b79 |
1 | // This file has been automatically generated from resource file src/Shaders/PBRIllumination.glsl |
2 | |
3 | static const char Shaders_PBRIllumination_glsl[] = |
4 | "//! Calculates direct illumination using Cook-Torrance BRDF.\n" |
5 | "vec3 occPBRIllumination (in vec3 theView,\n" |
6 | " in vec3 theLight,\n" |
7 | " in vec3 theNormal,\n" |
8 | " in vec4 theBaseColor,\n" |
9 | " in float theMetallic,\n" |
10 | " in float theRoughness,\n" |
11 | " in float theIOR,\n" |
12 | " in vec3 theLightColor,\n" |
13 | " in float theLightIntensity)\n" |
14 | "{\n" |
15 | " vec3 aHalf = normalize (theView + theLight);\n" |
16 | " float aCosVH = max(dot(theView, aHalf), 0.0);\n" |
17 | " vec3 aFresnel = occPBRFresnel (theBaseColor.rgb, theMetallic, theIOR, aCosVH);\n" |
18 | " vec3 aSpecular = occPBRCookTorrance (theView,\n" |
19 | " theLight,\n" |
20 | " theNormal,\n" |
21 | " theBaseColor.rgb,\n" |
22 | " theMetallic,\n" |
23 | " theRoughness,\n" |
24 | " theIOR);\n" |
25 | " vec3 aDiffuse = vec3(1.0) - aFresnel;\n" |
26 | " aDiffuse *= 1.0 - theMetallic;\n" |
27 | " aDiffuse *= INV_PI;\n" |
28 | " aDiffuse *= theBaseColor.rgb;\n" |
29 | " aDiffuse = mix (vec3(0.0), aDiffuse, theBaseColor.a);\n" |
30 | " return (aDiffuse + aSpecular) * theLightColor * theLightIntensity * max(0.0, dot(theLight, theNormal));\n" |
31 | "}\n"; |