Skip to content

Commit fbc584f

Browse files
committed
Merge pull request #102272 from clayjohn/omni-attenuation-epsilon
Use a smaller epsilon for omni and spot attenuation cutoff
2 parents 7c0ce4e + 6611c86 commit fbc584f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, bool is_di
120120
#endif
121121

122122
// We skip checking on attenuation on directional lights to avoid a branch that is not as beneficial for directional lights as the other ones.
123-
const float EPSILON = 1e-3f;
123+
const float EPSILON = 1e-6f;
124124
if (is_directional || attenuation > EPSILON) {
125125
float cNdotL = max(NdotL, 0.0);
126126
#if defined(DIFFUSE_BURLEY) || defined(SPECULAR_SCHLICK_GGX) || defined(LIGHT_CLEARCOAT_USED)
@@ -405,7 +405,7 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v
405405
vec3 binormal, vec3 tangent, float anisotropy,
406406
#endif
407407
inout vec3 diffuse_light, inout vec3 specular_light) {
408-
const float EPSILON = 1e-3f;
408+
const float EPSILON = 1e-6f;
409409

410410
// Omni light attenuation.
411411
vec3 light_rel_vec = omni_lights.data[idx].position - vertex;
@@ -700,7 +700,7 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v
700700
#endif
701701
inout vec3 diffuse_light,
702702
inout vec3 specular_light) {
703-
const float EPSILON = 1e-3f;
703+
const float EPSILON = 1e-6f;
704704

705705
// Spot light attenuation.
706706
vec3 light_rel_vec = spot_lights.data[idx].position - vertex;

0 commit comments

Comments
 (0)