mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-01 17:36:21 +03:00
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.
29 lines
1.3 KiB
GLSL
29 lines
1.3 KiB
GLSL
//! Calculates direct illumination using Cook-Torrance BRDF.
|
|
vec3 occPBRIllumination (in vec3 theView,
|
|
in vec3 theLight,
|
|
in vec3 theNormal,
|
|
in vec4 theBaseColor,
|
|
in float theMetallic,
|
|
in float theRoughness,
|
|
in float theIOR,
|
|
in vec3 theLightColor,
|
|
in float theLightIntensity)
|
|
{
|
|
vec3 aHalf = normalize (theView + theLight);
|
|
float aCosVH = max(dot(theView, aHalf), 0.0);
|
|
vec3 aFresnel = occPBRFresnel (theBaseColor.rgb, theMetallic, theIOR, aCosVH);
|
|
vec3 aSpecular = occPBRCookTorrance (theView,
|
|
theLight,
|
|
theNormal,
|
|
theBaseColor.rgb,
|
|
theMetallic,
|
|
theRoughness,
|
|
theIOR);
|
|
vec3 aDiffuse = vec3(1.0) - aFresnel;
|
|
aDiffuse *= 1.0 - theMetallic;
|
|
aDiffuse *= INV_PI;
|
|
aDiffuse *= theBaseColor.rgb;
|
|
aDiffuse = mix (vec3(0.0), aDiffuse, theBaseColor.a);
|
|
return (aDiffuse + aSpecular) * theLightColor * theLightIntensity * max(0.0, dot(theLight, theNormal));
|
|
}
|