I'm trying to figure out if my BRDF approach is correct or not.
// Calculate sun BRDF color
vec3 sunBrdf = brdf(tsLightSourceDir, tsEyeDir,
tsNormal, vtsTangent, vtsBinormal,
albedo.rgb,
NdotL, NdotV,
tRoughness, tMetallic, specular);
// brdf multiplied by incoming sun radiance -> color
vec3 irradiance = sunAmbientRadiance + sunDiffuseRadiance * NdotL;
vec3 brdfColor = sunBrdf * irradiance;
// Add base ambient color
vec3 ambientColor = albedo.rgb * sunAmbientRadiance;
resultColor = ambientColor;
resultColor += brdfColor;
// Interpolate by shadow
resultColor = mix(ambientColor,
resultColor,
shadowAmount);
My question: I'm adding the ambient light 2x. 1x when calculating the ambient color and 1x by adding it to the amount of light coming into the BRDF.
I can't figure out if this is correct or not, since the BRDF needs the ambient light in my opinion since it's a part of the lighting that arrives onto the surface. But on the other hand, it's already calculated by multiplying it with the albedo color and added as a base color...
Any help is much appreciated!
The correct formula goes like this (in my opinion):
vec3 irradiance = sunDiffuseRadiance * NdotL;