[SOLVED] Why dGlossiniess * dGlossiniess in getFresnel()?

hello developers:

void getFresnel() {
    float fresnel = 1.0 - max(dot(dNormalW, dViewDirW), 0.0);
    float fresnel2 = fresnel * fresnel;
    fresnel *= fresnel2 * fresnel2;
    fresnel *= dGlossiness * dGlossiness;
    dSpecularity = dSpecularity + (1.0 - dSpecularity) * fresnel;
}

May I ask why playcanvas does fresnel *= dGlossiness * dGlossiness;
instead of

vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness)
{
    return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(1.0 - cosTheta, 5.0);
} 

thanks very much :slight_smile:

It’s a rough approximation that reduces reflectivity when roughness increases. Basically serves similar purpose to the split-sum approximation in other renderers, but simplier. I’ve seen such approach used in one of the versions of Marmoset Toolbag.

2 Likes