return (k_diff*base_color+k_spec)*ambient_color.rgb;
}
-vec3 cooktorrance_lighting(vec3 normal, vec3 look, vec3 base_color, float metalness, float roughness)
+vec3 cooktorrance_lighting(vec3 normal, vec3 look, vec3 base_color, float metalness, float roughness, float occlusion)
{
vec3 color = vec3(0.0);
for(int i=0; i<max_lights; ++i)
color += cooktorrance_one_light_direct(normal, look, incoming.direction, base_color, metalness, roughness)*incoming.color*shadow;
}
- float occlusion = get_occlusion_value();
color += cooktorrance_environment(normal, look, base_color, metalness, roughness)*occlusion;
- if(use_emission)
- color += get_emission_color();
-
return color;
}
float metalness = get_metalness_value();
float roughness = get_roughness_value();
+ float occlusion = get_occlusion_value();
- vec3 lit_color = cooktorrance_lighting(normal, look, base_color.rgb, metalness, roughness);
+ vec3 lit_color = cooktorrance_lighting(normal, look, base_color.rgb, metalness, roughness, occlusion);
+ if(use_emission)
+ lit_color += get_emission_color();
frag_color = vec4(lit_color, alpha);
}