1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00
occt/resources/Shaders/PBRCookTorrance.glsl
Pasukhin Dmitry df4b931988
Configuration - Resource structure reorganization
Reorganized resources to keep source part in src and real-time scripts in resource folder.
For the installation result no changes, still installed to src for windows.
2025-03-18 22:54:43 +00:00

21 lines
873 B
GLSL

//! Calculates Cook-Torrance BRDF.
vec3 occPBRCookTorrance (in vec3 theView,
in vec3 theLight,
in vec3 theNormal,
in vec3 theBaseColor,
in float theMetallic,
in float theRoughness,
in float theIOR)
{
vec3 aHalf = normalize (theView + theLight);
float aCosV = max(dot(theView, theNormal), 0.0);
float aCosL = max(dot(theLight, theNormal), 0.0);
float aCosH = max(dot(aHalf, theNormal), 0.0);
float aCosVH = max(dot(aHalf, theView), 0.0);
vec3 aCookTorrance = occPBRDistribution (aCosH, theRoughness)
* occPBRGeometry (aCosV, aCosL, theRoughness)
* occPBRFresnel (theBaseColor, theMetallic, theIOR, aCosVH);
aCookTorrance /= 4.0;
return aCookTorrance;
}