@@ -35,7 +35,6 @@ APPLY_TONEMAPPING = true
3535// these are false, we are doing a directional light pass.
3636ADDITIVE_OMNI = false
3737ADDITIVE_SPOT = false
38- ADDITIVE_AREA = false
3938RENDER_MATERIAL = false
4039SECOND_REFLECTION_PROBE = false
4140LIGHTMAP_BICUBIC_FILTER = false
@@ -216,7 +215,7 @@ scene_data;
216215
217216#ifdef USE_ADDITIVE_LIGHTING
218217
219- #if defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA)
218+ #if defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT)
220219struct PositionalShadowData {
221220 highp mat4 shadow_matrix;
222221 highp vec3 light_position;
@@ -253,7 +252,7 @@ layout(std140) uniform DirectionalShadows { // ubo:11
253252
254253uniform lowp uint directional_shadow_index;
255254
256- #endif // !(defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA))
255+ #endif // !(defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT)
257256#endif // USE_ADDITIVE_LIGHTING
258257
259258#ifdef USE_VERTEX_LIGHTING
@@ -267,7 +266,7 @@ out vec3 additive_specular_light_interp;
267266#endif // USE_ADDITIVE_LIGHTING
268267
269268// Directional light data.
270- #if ! defined(DISABLE_LIGHT_DIRECTIONAL) || (! defined(ADDITIVE_OMNI) && ! defined(ADDITIVE_SPOT) && ! defined(ADDITIVE_AREA) && defined(USE_ADDITIVE_LIGHTING))
269+ #if ! defined(DISABLE_LIGHT_DIRECTIONAL) || (! defined(ADDITIVE_OMNI) && ! defined(ADDITIVE_SPOT) && defined(USE_ADDITIVE_LIGHTING))
271270
272271struct DirectionalLightData {
273272 mediump vec3 direction;
@@ -290,7 +289,7 @@ layout(std140) uniform DirectionalLights { // ubo:8
290289#endif // !DISABLE_LIGHT_DIRECTIONAL
291290
292291// Omni, spot, and area light data.
293- #if ! defined(DISABLE_LIGHT_OMNI) || ! defined(DISABLE_LIGHT_SPOT) || ! defined(DISABLE_LIGHT_AREA) || (defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA) && defined(USE_ADDITIVE_LIGHTING))
292+ #if ! defined(DISABLE_LIGHT_OMNI) || ! defined(DISABLE_LIGHT_SPOT) || ! defined(DISABLE_LIGHT_AREA) || (defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) && defined(USE_ADDITIVE_LIGHTING))
294293
295294struct LightData { // This structure needs to be as packed as possible.
296295 highp vec3 position;
@@ -334,17 +333,17 @@ uniform uint spot_light_count;
334333#endif // BASE_PASS
335334#endif // DISABLE_LIGHT_SPOT
336335
337- #if ! defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_AREA)
336+ #if ! defined(DISABLE_LIGHT_AREA)
338337layout (std140) uniform AreaLightData { // ubo:7
339338 LightData area_lights[MAX_LIGHT_DATA_STRUCTS];
340339};
341340#if defined(BASE_PASS) && ! defined(USE_VERTEX_LIGHTING)
342341uniform uint area_light_indices[MAX_FORWARD_LIGHTS];
343342uniform uint area_light_count;
344343#endif // defined(BASE_PASS) && !defined(USE_VERTEX_LIGHTING)
345- #endif // !defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_AREA)
344+ #endif // !defined(DISABLE_LIGHT_AREA)
346345
347- #endif // !defined(DISABLE_LIGHT_OMNI) || !defined(DISABLE_LIGHT_SPOT) || (!defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA) && defined(USE_ADDITIVE_LIGHTING))
346+ #endif // !defined(DISABLE_LIGHT_OMNI) || !defined(DISABLE_LIGHT_SPOT) || (!defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) && defined(USE_ADDITIVE_LIGHTING))
348347
349348#ifdef USE_ADDITIVE_LIGHTING
350349#ifdef ADDITIVE_OMNI
@@ -353,9 +352,6 @@ uniform lowp uint omni_light_index;
353352#ifdef ADDITIVE_SPOT
354353uniform lowp uint spot_light_index;
355354#endif
356- #ifdef ADDITIVE_AREA
357- uniform lowp uint area_light_index;
358- #endif
359355#endif // USE_ADDITIVE_LIGHTING
360356
361357#if ! defined(MODE_RENDER_DEPTH) && ! defined(MODE_UNSHADED) && defined(USE_VERTEX_LIGHTING)
@@ -442,7 +438,7 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, float
442438}
443439#endif // !defined(DISABLE_LIGHT_SPOT) || (defined(ADDITIVE_SPOT) && defined(USE_ADDITIVE_LIGHTING))
444440
445- #if ! defined(DISABLE_LIGHT_AREA) || (defined(ADDITIVE_AREA) && defined(USE_ADDITIVE_LIGHTING))
441+ #if ! defined(DISABLE_LIGHT_AREA) && defined(USE_ADDITIVE_LIGHTING))
446442void light_process_area(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness,
447443 inout vec3 diffuse_light, inout vec3 specular_light) {
448444 vec3 light_rel_vec = area_lights[idx].position - vertex;
@@ -465,7 +461,7 @@ void light_process_area(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, float
465461 diffuse_light,
466462 specular_light);
467463}
468- #endif // !defined(DISABLE_LIGHT_AREA) || (defined(ADDITIVE_AREA) && defined(USE_ADDITIVE_LIGHTING))
464+ #endif // !defined(DISABLE_LIGHT_AREA) && defined(USE_ADDITIVE_LIGHTING))
469465
470466#endif // !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED) && defined(USE_VERTEX_LIGHTING)
471467
@@ -718,7 +714,7 @@ void main() {
718714
719715 // Calculate shadows.
720716#ifdef USE_ADDITIVE_LIGHTING
721- #if defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA)
717+ #if defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT)
722718 // Apply normal bias at draw time to avoid issues with scaling non-fused geometry.
723719 vec3 light_rel_vec = positional_shadows[positional_shadow_index].light_position - vertex_interp;
724720 float light_length = length (light_rel_vec);
@@ -730,11 +726,6 @@ void main() {
730726 shadow_coord = positional_shadows[positional_shadow_index].shadow_matrix * vec4 (vertex_interp + normal_offset, 1.0 );
731727#endif
732728
733- #ifdef ADDITIVE_AREA
734- // Calculate coord here so we can take advantage of prefetch.
735- shadow_coord = positional_shadows[positional_shadow_index].shadow_matrix * vec4 (vertex_interp + normal_offset, 1.0 );
736- #endif
737-
738729#ifdef ADDITIVE_OMNI
739730 // Can't interpolate unit direction nicely, so forget about prefetch.
740731 shadow_coord = vec4 (vertex_interp + normal_offset, 1.0 );
@@ -756,7 +747,7 @@ void main() {
756747 shadow_coord4 = directional_shadows[directional_shadow_index].shadow_matrix4 * vec4 (vertex_interp + normal_offset, 1.0 );
757748#endif // LIGHT_USE_PSSM4
758749
759- #endif // !(defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA) )
750+ #endif // !(defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT))
760751#endif // USE_ADDITIVE_LIGHTING
761752
762753#if defined(RENDER_SHADOWS) && ! defined(RENDER_SHADOWS_LINEAR)
@@ -839,12 +830,12 @@ void main() {
839830#ifdef USE_ADDITIVE_LIGHTING
840831 additive_diffuse_light_interp = vec3 (0.0 );
841832 additive_specular_light_interp = vec3 (0.0 );
842- #if ! defined(ADDITIVE_OMNI) && ! defined(ADDITIVE_SPOT) && ! defined(ADDITIVE_AREA)
833+ #if ! defined(ADDITIVE_OMNI) && ! defined(ADDITIVE_SPOT)
843834
844835 light_compute(normal_interp, normalize (directional_lights[directional_shadow_index].direction), normalize (view), directional_lights[directional_shadow_index].color * directional_lights[directional_shadow_index].energy, true, roughness,
845836 additive_diffuse_light_interp.rgb,
846837 additive_specular_light_interp.rgb);
847- #endif // !defined(ADDITIVE_OMNI) && !defined(ADDITIVE_SPOT) && !defined(ADDITIVE_AREA)
838+ #endif // !defined(ADDITIVE_OMNI) && !defined(ADDITIVE_SPOT)
848839
849840#ifdef ADDITIVE_OMNI
850841 light_process_omni(omni_light_index, vertex_interp, view, normal_interp, roughness,
@@ -856,11 +847,6 @@ void main() {
856847 additive_diffuse_light_interp.rgb, additive_specular_light_interp.rgb);
857848#endif // ADDITIVE_SPOT
858849
859- #ifdef ADDITIVE_AREA
860- light_process_area(area_light_index, vertex_interp, view, normal_interp, roughness,
861- additive_diffuse_light_interp.rgb, additive_specular_light_interp.rgb);
862- #endif // ADDITIVE_AREA
863-
864850#endif // USE_ADDITIVE_LIGHTING
865851#endif // !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
866852#endif // USE_VERTEX_LIGHTING
@@ -1130,7 +1116,7 @@ uniform highp sampler2DShadow directional_shadow_atlas; // texunit:-3
11301116#endif // !DISABLE_LIGHT_DIRECTIONAL
11311117
11321118// Omni, spot, and area light data.
1133- #if ! defined(DISABLE_LIGHT_OMNI) || ! defined(DISABLE_LIGHT_SPOT) || ! defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA)
1119+ #if ! defined(DISABLE_LIGHT_OMNI) || ! defined(DISABLE_LIGHT_SPOT) || ! defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT)
11341120
11351121struct LightData { // This structure needs to be as packed as possible.
11361122 highp vec3 position;
@@ -1174,7 +1160,7 @@ uniform uint spot_light_count;
11741160#endif // defined(BASE_PASS) && !defined(USE_VERTEX_LIGHTING)
11751161#endif // !defined(DISABLE_LIGHT_SPOT) || defined(ADDITIVE_SPOT)
11761162
1177- #if ! defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_AREA)
1163+ #if ! defined(DISABLE_LIGHT_AREA)
11781164layout (std140) uniform AreaLightData { // ubo:7
11791165 LightData area_lights[MAX_LIGHT_DATA_STRUCTS];
11801166};
@@ -1185,9 +1171,9 @@ uniform highp sampler2D ltc_lut2; // texunit:-11
11851171uniform uint area_light_indices[MAX_FORWARD_LIGHTS];
11861172uniform uint area_light_count;
11871173#endif // defined(BASE_PASS) && !defined(USE_VERTEX_LIGHTING)
1188- #endif // !defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_AREA)
1174+ #endif // !defined(DISABLE_LIGHT_AREA)
11891175
1190- #endif // !defined(DISABLE_LIGHT_OMNI) || !defined(DISABLE_LIGHT_SPOT) || !defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA)
1176+ #endif // !defined(DISABLE_LIGHT_OMNI) || !defined(DISABLE_LIGHT_SPOT) || !defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT)
11911177
11921178#ifdef USE_ADDITIVE_LIGHTING
11931179#ifdef ADDITIVE_OMNI
@@ -1198,12 +1184,8 @@ uniform lowp uint omni_light_index;
11981184uniform highp sampler2DShadow spot_shadow_texture; // texunit:-3
11991185uniform lowp uint spot_light_index;
12001186#endif
1201- #ifdef ADDITIVE_AREA
1202- uniform highp sampler2DShadow area_shadow_texture; // texunit:-3
1203- uniform lowp uint area_light_index;
1204- #endif
12051187
1206- #if defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT) || defined(ADDITIVE_AREA)
1188+ #if defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT)
12071189struct PositionalShadowData {
12081190 highp mat4 shadow_matrix;
12091191 highp vec3 light_position;
@@ -1237,7 +1219,7 @@ layout(std140) uniform DirectionalShadows { // ubo:11
12371219};
12381220
12391221uniform lowp uint directional_shadow_index;
1240- #endif // !(defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT)) || defined(ADDITIVE_AREA)
1222+ #endif // !(defined(ADDITIVE_OMNI) || defined(ADDITIVE_SPOT))
12411223
12421224#if ! defined(ADDITIVE_OMNI)
12431225float sample_shadow(highp sampler2DShadow shadow, float shadow_pixel_size, vec4 pos) {
@@ -1602,7 +1584,7 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 f
16021584}
16031585#endif // !DISABLE_LIGHT_OMNI
16041586
1605- #if ! defined(DISABLE_LIGHT_AREA) || defined(ADDITIVE_AREA)
1587+ #if ! defined(DISABLE_LIGHT_AREA)
16061588float integrate_edge_hill(vec3 p0, vec3 p1) {
16071589 // Approximation suggested by Hill and Heitz, calculating the integral of the spherical cosine distribution over the line between p0 and p1.
16081590 // Runs faster than the exact formula of Baum et al. (1989).
@@ -2752,7 +2734,7 @@ void main() {
27522734 specular_light = additive_specular_light_interp * f0;
27532735#endif // USE_VERTEX_LIGHTING
27542736
2755- #if ! defined(ADDITIVE_OMNI) && ! defined(ADDITIVE_SPOT) && ! defined(ADDITIVE_AREA)
2737+ #if ! defined(ADDITIVE_OMNI) && ! defined(ADDITIVE_SPOT)
27562738
27572739#ifndef SHADOWS_DISABLED
27582740// Baked shadowmasks
@@ -2923,7 +2905,7 @@ void main() {
29232905 diffuse_light *= directional_shadow;
29242906 specular_light *= directional_shadow;
29252907#endif // !USE_VERTEX_LIGHTING
2926- #endif // !defined(ADDITIVE_OMNI) && !defined(ADDITIVE_SPOT) && !defined(ADDITIVE_AREA)
2908+ #endif // !defined(ADDITIVE_OMNI) && !defined(ADDITIVE_SPOT)
29272909
29282910#ifdef ADDITIVE_OMNI
29292911 float omni_shadow = 1 .0f;
@@ -2988,36 +2970,6 @@ void main() {
29882970
29892971#endif // ADDITIVE_SPOT
29902972
2991- #ifdef ADDITIVE_AREA
2992- float area_shadow = 1 .0f;
2993- #ifndef SHADOWS_DISABLED
2994- area_shadow = sample_shadow(area_shadow_texture, positional_shadows[positional_shadow_index].shadow_atlas_pixel_size, shadow_coord);
2995- area_shadow = mix (1.0 , area_shadow, area_lights[area_light_index].shadow_opacity);
2996- #endif // SHADOWS_DISABLED
2997-
2998- #ifndef USE_VERTEX_LIGHTING
2999- light_process_area(area_light_index, vertex, view, normal, f0, roughness, metallic, area_shadow, albedo, alpha, screen_uv,
3000- #ifdef LIGHT_BACKLIGHT_USED
3001- backlight,
3002- #endif
3003- #ifdef LIGHT_RIM_USED
3004- rim,
3005- rim_tint,
3006- #endif
3007- #ifdef LIGHT_CLEARCOAT_USED
3008- clearcoat, clearcoat_roughness, geo_normal,
3009- #endif // LIGHT_CLEARCOAT_USED
3010- #ifdef LIGHT_ANISOTROPY_USED
3011- binormal, tangent, anisotropy,
3012- #endif
3013- diffuse_light, specular_light);
3014- #else
3015- // Just apply shadows to vertex lighting.
3016- diffuse_light *= area_shadow;
3017- specular_light *= area_shadow;
3018- #endif // !USE_VERTEX_LIGHTING
3019- #endif // ADDITIVE_AREA
3020-
30212973 diffuse_light *= albedo;
30222974 diffuse_light *= 1.0 - metallic;
30232975 vec3 additive_light_color = diffuse_light + specular_light;
0 commit comments