RaZ
RaZ copied to clipboard
[Cook-Torrance] Investigate UE4's Fresnel Shlick optimization
Instead of the common Fresnel calculation, Brian Karis suggests using a spherical gaussian approximation, which he deems more efficient with unnoticeable differences.
As such, the current Fresnel calculation:
vec3 fresnel = baseReflectivity + (1.0 - baseReflectivity) * pow(1.0 - cosTheta, 5.0);
would become:
vec3 fresnel = baseReflectivity + (1.0 - baseReflectivity) * pow(2.0, (-5.55473 * cosTheta - 6.98316) * cosTheta);
In RaZ's case, this actually fixes black artifacts when the light's position is strictly equivalent to the camera's (which should not happen in real life cases):
This optimization should probably be investigated, as the artifacts may come from a small blunder in the implementation.