Skip to content

Commit

Permalink
clamp weirdness
Browse files Browse the repository at this point in the history
  • Loading branch information
Retrisma committed Jun 4, 2024
1 parent bfb8b3d commit 97eca7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shaders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ basic.shader = love.graphics.newShader[[
float light_source(vec2 screen_coords, vec2 light, float falloff) {
float d = distance(screen_coords, world_transform(light));
float intensity = 1.5 - (d / falloff);
return clamp(intensity, 1.0, 0.0);
return clamp(intensity, 0.0, 1.0);
}
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) {
vec4 pixel = Texel(texture, texture_coords);
float intensity = clamp(light_source(screen_coords, light_pos[0], 1000) + light_source(screen_coords, player_pos, 150), 0.4, 1.0);
float intensity = clamp(light_source(screen_coords, light_pos[0], 1000) + light_source(screen_coords, player_pos, 150), 0.0, 1.0);
return pixel * intensity;
}
Expand Down

0 comments on commit 97eca7d

Please sign in to comment.