Files
loop/shader/lighting/texture.frag
T

18 lines
395 B
GLSL

#version 450 core
uniform vec3 lightPos;
uniform vec4 lumRad;
uniform sampler2D screenTexture;
in vec2 vTexPos;
out vec4 fColor;
float rad = lumRad.a;
void main() {
vec3 distVec = texture(screenTexture, vTexPos).xyz - lightPos;
float dist = dot(distVec, distVec);
if (dist > rad) {
discard;
}
float x = 1 - dist / rad;
vec3 c = (x * x * x) * lumRad.rgb;
fColor = vec4(c, 0);
}