From b2ccd962c94041fae72e1729e0435c5b465b8b8e Mon Sep 17 00:00:00 2001 From: crumblingstatue Date: Thu, 6 Apr 2023 19:29:00 +0200 Subject: [PATCH] Credit where credit is due, fix alpha issue with light shader --- shaders/lighting.glsl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shaders/lighting.glsl b/shaders/lighting.glsl index cd07e60..850c930 100644 --- a/shaders/lighting.glsl +++ b/shaders/lighting.glsl @@ -1,3 +1,5 @@ +// Based on https://github.com/romrz/Basic-2D-lighting + uniform sampler2D texture; uniform vec2 resolution; uniform vec2 mouse; @@ -38,7 +40,7 @@ void main() { // Applies the light to the pixel vec3 intensity = ambient + light; - vec3 final = pixel.rgb * intensity; + vec4 final = pixel * vec4(intensity.r, intensity.g, intensity.b, 1.0); - gl_FragColor = vec4(final, 1.0); + gl_FragColor = final; } \ No newline at end of file