From bb70c67f77fbd3a8d1af5d73bad27acf1b986fc6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 10 Jun 2023 06:57:44 +0200 Subject: wip --- shaders/lightmap.frag | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'shaders') diff --git a/shaders/lightmap.frag b/shaders/lightmap.frag index 8690ffcb..cba5a269 100644 --- a/shaders/lightmap.frag +++ b/shaders/lightmap.frag @@ -5,9 +5,13 @@ layout (location = 1) uniform vec2 center; layout (location = 2) uniform uint falloff; layout (location = 3) uniform vec2 size; -out vec4 color; +out vec3 color; void main() { - vec3 color = color_intensity.xyz; - float dist = color_intensity.w; + vec2 pos = gl_FragCoord.xy; + float I = color_intensity.w; + vec2 tmp = pos - center; + float dist = sqrt(tmp.x*tmp.x + tmp.y*tmp.y); + float alpha = 1 - min(1, dist / I); + color = alpha * color_intensity.xyz; } -- cgit v1.2.3