|
@@ -624,7 +624,7 @@ float SchlickFresnel(float u) {
|
|
return m2 * m2 * m; // pow(m,5)
|
|
return m2 * m2 * m; // pow(m,5)
|
|
}
|
|
}
|
|
|
|
|
|
-void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, float attenuation, vec3 f0, float roughness, float metallic, float specular_amount, vec3 albedo, inout float alpha,
|
|
|
|
|
|
+void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, bool is_directional, float attenuation, vec3 f0, float roughness, float metallic, float specular_amount, vec3 albedo, inout float alpha,
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
vec3 backlight,
|
|
vec3 backlight,
|
|
#endif
|
|
#endif
|
|
@@ -809,7 +809,7 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 f
|
|
size_A = max(0.0, 1.0 - 1.0 / sqrt(1.0 + t * t));
|
|
size_A = max(0.0, 1.0 - 1.0 / sqrt(1.0 + t * t));
|
|
}
|
|
}
|
|
|
|
|
|
- light_compute(normal, normalize(light_rel_vec), eye_vec, size_A, color, omni_attenuation, f0, roughness, metallic, omni_lights[idx].specular_amount, albedo, alpha,
|
|
|
|
|
|
+ light_compute(normal, normalize(light_rel_vec), eye_vec, size_A, color, false, omni_attenuation, f0, roughness, metallic, omni_lights[idx].specular_amount, albedo, alpha,
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
backlight,
|
|
backlight,
|
|
#endif
|
|
#endif
|
|
@@ -860,7 +860,7 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 f
|
|
size_A = max(0.0, 1.0 - 1.0 / sqrt(1.0 + t * t));
|
|
size_A = max(0.0, 1.0 - 1.0 / sqrt(1.0 + t * t));
|
|
}
|
|
}
|
|
|
|
|
|
- light_compute(normal, normalize(light_rel_vec), eye_vec, size_A, color, spot_attenuation, f0, roughness, metallic, spot_lights[idx].specular_amount, albedo, alpha,
|
|
|
|
|
|
+ light_compute(normal, normalize(light_rel_vec), eye_vec, size_A, color, false, spot_attenuation, f0, roughness, metallic, spot_lights[idx].specular_amount, albedo, alpha,
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
backlight,
|
|
backlight,
|
|
#endif
|
|
#endif
|
|
@@ -1189,7 +1189,7 @@ void main() {
|
|
#ifndef DISABLE_LIGHT_DIRECTIONAL
|
|
#ifndef DISABLE_LIGHT_DIRECTIONAL
|
|
//diffuse_light = normal; //
|
|
//diffuse_light = normal; //
|
|
for (uint i = uint(0); i < scene_data.directional_light_count; i++) {
|
|
for (uint i = uint(0); i < scene_data.directional_light_count; i++) {
|
|
- light_compute(normal, normalize(directional_lights[i].direction), normalize(view), directional_lights[i].size, directional_lights[i].color * directional_lights[i].energy, 1.0, f0, roughness, metallic, 1.0, albedo, alpha,
|
|
|
|
|
|
+ light_compute(normal, normalize(directional_lights[i].direction), normalize(view), directional_lights[i].size, directional_lights[i].color * directional_lights[i].energy, true, 1.0, f0, roughness, metallic, 1.0, albedo, alpha,
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
#ifdef LIGHT_BACKLIGHT_USED
|
|
backlight,
|
|
backlight,
|
|
#endif
|
|
#endif
|