Skip to content

Commit 5d8de78

Browse files
committed
Tweaks to how sphere lights work
Specifically when you get too close to them.
1 parent 9759a12 commit 5d8de78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/flitter/render/window/glsl/standard_lighting.frag

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,12 @@ void main() {
130130
passes = 2;
131131
attenuation = clamp(1.0 - (light_radius / light_distance), 0.0, 1.0);
132132
if (pass == 0) {
133-
light_distance = max(0.0, light_distance - light_radius*0.99);
133+
light_distance -= min(light_radius, light_distance*0.99);
134134
} else {
135135
vec3 R = reflect(V, N);
136136
vec3 l = dot(L, R) * R - L;
137137
L += l * min(0.99, light_radius/length(l));
138+
light_distance = length(L);
138139
}
139140
}
140141
L = normalize(L);

0 commit comments

Comments
 (0)