+ vec3 f0 = mix(vec3(0.04), base_color, metalness);
+ vec2 scale_bias = texture(fresnel_lookup, vec2(roughness, max(dot(normal, -look), 0.0))).rg;
+ vec3 k_spec = f0*scale_bias.x+scale_bias.y;
+ vec3 k_diff = (1.0-k_spec)*(1.0-metalness);
+
+ if(use_image_based_lighting)
+ {
+ vec3 irradiance = get_irradiance_sample(normal);
+ vec3 reflection = get_environment_sample(reflect(look, normal), roughness).rgb;
+
+ return k_diff*irradiance*base_color+k_spec*reflection;
+ }