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.
37 lines
1.2 KiB
GLSL
37 lines
1.2 KiB
GLSL
//! Functions to calculate fresnel coefficient and approximate zero fresnel value.
|
|
vec3 occPBRFresnel (in vec3 theBaseColor,
|
|
in float theMetallic,
|
|
in float theIOR)
|
|
{
|
|
theIOR = (1.0 - theIOR) / (1.0 + theIOR);
|
|
theIOR *= theIOR;
|
|
vec3 f0 = vec3(theIOR);
|
|
f0 = mix (f0, theBaseColor.rgb, theMetallic);
|
|
return f0;
|
|
}
|
|
|
|
vec3 occPBRFresnel (in vec3 theBaseColor,
|
|
in float theMetallic,
|
|
in float theIOR,
|
|
in float theCosVH)
|
|
{
|
|
vec3 f0 = occPBRFresnel (theBaseColor, theMetallic, theIOR);
|
|
theCosVH = 1.0 - theCosVH;
|
|
theCosVH *= theCosVH;
|
|
theCosVH *= theCosVH * theCosVH * theCosVH * theCosVH;
|
|
return f0 + (vec3 (1.0) - f0) * theCosVH;
|
|
}
|
|
|
|
vec3 occPBRFresnel (in vec3 theBaseColor,
|
|
in float theMetallic,
|
|
in float theRoughness,
|
|
in float theIOR,
|
|
in float theCosV)
|
|
{
|
|
vec3 f0 = occPBRFresnel (theBaseColor, theMetallic, theIOR);
|
|
theCosV = 1.0 - theCosV;
|
|
theCosV *= theCosV;
|
|
theCosV *= theCosV * theCosV * theCosV * theCosV;
|
|
return f0 + (max(vec3(1.0 - theRoughness), f0) - f0) * theCosV;
|
|
}
|