RaZ icon indicating copy to clipboard operation
RaZ copied to clipboard

[Cook-Torrance] Investigate UE4's Fresnel Shlick optimization

Open Razakhel opened this issue 3 years ago • 0 comments

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:

Standard formula

vec3 fresnel = baseReflectivity + (1.0 - baseReflectivity) * pow(1.0 - cosTheta, 5.0);

would become:

Optimization formula

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):

Fresnel artifacts Fresnel optimization

This optimization should probably be investigated, as the artifacts may come from a small blunder in the implementation.

Razakhel avatar Aug 18 '20 09:08 Razakhel