1
0
dIntDesJam/2016-uge2/stars.glsl

12 lines
356 B
Plaintext
Raw Normal View History

2016-02-10 14:57:47 +00:00
extern vec2 stars[30];
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords)
{
float dist = 1000;
for (int i = 0; i<30; i++) {
dist = min(dist, pow(stars[i].x - screen_coords.x, 2) + pow(stars[i].y - screen_coords.y, 2));
}
return max(Texel(texture, texture_coords), vec4(1.0,1.0,1.0,1.0)/sqrt(dist));
}