Wicked-Depths/lightsphere.gdshader

24 lines
373 B
Plaintext

shader_type canvas_item;
uniform float r = 0.5;
uniform float visibility = 1.0;
void fragment()
{
vec2 uv = UV - 0.5;
int div = 127;
vec2 st = (vec2(ivec2( uv * float(div) ))+0.5)/float(div);
float d = length(st);
float c = 1.0;
float alpha = visibility;
if (d<r){
c = 0.0;
}
else{
alpha = 0.0;
}
c = smoothstep(r,r,1);
COLOR = vec4(vec3(c),alpha);
}