The dot product may sometimes be very slightly over 1.0, making the
first argument to pow negative and giving undefined results.
{
// 0.04 is a decent approximation for dielectric base reflectivity
vec3 f0 = mix(vec3(0.04), base_color, metalness);
- return mix(f0, vec3(1.0), pow(1.0-dot(halfway, look), 5.0));
+ return mix(f0, vec3(1.0), pow(max(1.0-dot(halfway, look), 0.0), 5.0));
}
/* Computes the full contribution of a single light */