Skip to content
20 changes: 10 additions & 10 deletions assets/shaders/eeshader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ float noise(vec2 p, float freq ){
vec2 ij = floor(p/unit);
vec2 xy = mod(p,unit)/unit;
//xy = 3.*xy*xy-2.*xy*xy*xy;
xy = .5*(1.-cos(PI*xy));
xy = .5*(1.0 - cos(PI*xy));
float a = rand((ij+vec2(0.,0.)));
float b = rand((ij+vec2(1.,0.)));
float c = rand((ij+vec2(0.,1.)));
Expand Down Expand Up @@ -112,9 +112,9 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
vec2 real_uv = screen_coords;
vec2 uv = screen_coords;

float dummy = 2;
if(shadow) {dummy = 3;}
if(uv.x > uv.x * 2) {uv = eeshader*dissolve*burn_colour_1.x*burn_colour_2.x*time*dummy;}
float dummy = 2.;
if(shadow) {dummy = 3.;}
if(uv.x > uv.x * 2.) {uv = eeshader*dissolve*burn_colour_1.x*burn_colour_2.x*time*dummy;}

float sprite_width = texture_details.z / image_details.x; // Normalized width
float min_x = texture_details.x * sprite_width; // min X
Expand All @@ -134,7 +134,7 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
a=sqrt(a);
uv += uv.y*0.15;
vec2 q = uv.xy;
vec2 p = -1.0+2.0*q;
vec2 p = vec2(-1.0) + 2.0*q;
//p.x *= image_details.x/image_details.y;
// Rain
vec4 col2 = vec4(0,0,0,1);
Expand All @@ -145,7 +145,7 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
col2 += f*8.;
col2.g = 0.0;
col2.b = 0.0;
col2.a = 1;
col2.a = 1.;

return tex*0.65 + col2;
}
Expand Down Expand Up @@ -204,9 +204,9 @@ vec4 position( mat4 transform_projection, vec4 vertex_position )
}
float mid_dist = length(vertex_position.xy - 0.5*love_ScreenSize.xy)/length(love_ScreenSize.xy);
vec2 mouse_offset = (vertex_position.xy - mouse_screen_pos.xy)/screen_scale;
float scale = 0.2*(-0.03 - 0.3*max(0., 0.3-mid_dist))
*hovering*(length(mouse_offset)*length(mouse_offset))/(2. -mid_dist);
float scale = 0.2*(-0.03 - 0.3*max(0., 0.3 - mid_dist))
*hovering*(length(mouse_offset)*length(mouse_offset))/(2. - mid_dist);

return transform_projection * vertex_position + vec4(0,0,0,scale);
return transform_projection * vertex_position + vec4(0.,0.,0.,scale);
}
#endif
#endif
14 changes: 7 additions & 7 deletions assets/shaders/flashlight.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ float rand(vec2 c){
}

float psin(float x) {
return (1+sin(x))/2;
return (1.0 + sin(x)) / 2.0;
}

float hash(vec2 p) {
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
}

float noise(vec2 p) {
vec2 i = floor(p);
vec2 ip = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(
mix(hash(i + vec2(0.0, 0.0)), hash(i + vec2(1.0, 0.0)), u.x),
mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x),
mix(hash(ip + vec2(0.0, 0.0)), hash(ip + vec2(1.0, 0.0)), u.x),
mix(hash(ip + vec2(0.0, 1.0)), hash(ip + vec2(1.0, 1.0)), u.x),
u.y
);
}

float fbm(vec2 p) {
float val = 0.0;
float amp = 0.5;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
val += amp * noise(p);
p *= 2.0;
amp *= 0.5;
Expand Down Expand Up @@ -75,7 +75,7 @@ vec4 effect( vec4 colour, Image texture, vec2 tc, vec2 screen_coords )
vec3 baseColor = mix(vec3(skyBase), orangeSky, 0.6);
vec3 finalColor = baseColor + warmFlash + lightningAura;

tex.rgb = tex.rgb * ((dist - distance(center_pos, screen_coords))/dist) + finalColor * (1 - ((dist - distance(center_pos, screen_coords))/dist)) * 0.25;
tex.rgb = tex.rgb * ((dist - distance(center_pos, screen_coords)) / dist) + finalColor * (1.0 - ((dist - distance(center_pos, screen_coords)) / dist)) * 0.25;

return tex;
}
Expand All @@ -87,4 +87,4 @@ vec4 position( mat4 transform_projection, vec4 vertex_position )
{
return transform_projection * vertex_position;
}
#endif
#endif
216 changes: 108 additions & 108 deletions assets/shaders/invertradius.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,155 +12,155 @@ float lindist(float a,float b){
return abs(a-b);
}

number hue(number s, number t, number h)
float hue(float s, float t, float h)
{
number hs = mod(h, 1.)*6.;
if (hs < 1.) return (t-s) * hs + s;
if (hs < 3.) return t;
if (hs < 4.) return (t-s) * (4.-hs) + s;
return s;
float hs = mod(h, 1.0) * 6.0;
if (hs < 1.0) return (t - s) * hs + s;
if (hs < 3.0) return t;
if (hs < 4.0) return (t - s) * (4.0 - hs) + s;
return s;
}

vec4 RGB(vec4 c)
{
if (c.y < 0.0001)
return vec4(vec3(c.z), c.a);
if (c.y < 0.0001)
return vec4(vec3(c.z), c.a);

number t = (c.z < .5) ? c.y*c.z + c.z : -c.y*c.z + (c.y+c.z);
number s = 2.0 * c.z - t;
return vec4(hue(s,t,c.x + 1./3.), hue(s,t,c.x), hue(s,t,c.x - 1./3.), c.w);
float t = (c.z < 0.5) ? c.y * c.z + c.z : -c.y * c.z + (c.y + c.z);
float s = 2.0 * c.z - t;
return vec4(hue(s, t, c.x + 1.0/3.0), hue(s, t, c.x), hue(s, t, c.x - 1.0/3.0), c.w);
}

vec4 HSL(vec4 c)
{
number low = min(c.r, min(c.g, c.b));
number high = max(c.r, max(c.g, c.b));
number delta = high - low;
number sum = high+low;

vec4 hsl = vec4(.0, .0, .5 * sum, c.a);
if (delta == .0)
return hsl;

hsl.y = (hsl.z < .5) ? delta / sum : delta / (2.0 - sum);

if (high == c.r)
hsl.x = (c.g - c.b) / delta;
else if (high == c.g)
hsl.x = (c.b - c.r) / delta + 2.0;
else
hsl.x = (c.r - c.g) / delta + 4.0;

hsl.x = mod(hsl.x / 6., 1.);
return hsl;
float low = min(c.r, min(c.g, c.b));
float high = max(c.r, max(c.g, c.b));
float delta = high - low;
float sum = high + low;

vec4 hsl = vec4(0.0, 0.0, 0.5 * sum, c.a);
if (delta == 0.0)
return hsl;

hsl.y = (hsl.z < 0.5) ? delta / sum : delta / (2.0 - sum);

if (high == c.r)
hsl.x = (c.g - c.b) / delta;
else if (high == c.g)
hsl.x = (c.b - c.r) / delta + 2.0;
else
hsl.x = (c.r - c.g) / delta + 4.0;

hsl.x = mod(hsl.x / 6.0, 1.0);
return hsl;
}

vec2 polar_coords(vec2 pos,vec2 origin){
vec2 normalized=pos-origin;
origin=vec2(0.,0.);
float r=distance(normalized,origin);
float theta=atan(normalized.y,normalized.x);

return vec2(r,theta);
vec2 polar_coords(vec2 pos, vec2 origin){
vec2 normalized = pos - origin;
origin = vec2(0.0, 0.0);
float r = distance(normalized, origin);
float theta = atan(normalized.y, normalized.x);
return vec2(r, theta);
}

float min_dist=dist;
float max_dist=2*dist;

float get_t(vec2 pos){
float d=distance(center_pos,pos);
float t=0.;
if(min_dist<d&&d<max_dist){
t=1.;
}
return t;
float d = distance(center_pos, pos);
float minDist = dist;
float maxDist = 2.0 * dist;
return (minDist < d && d < maxDist) ? 1.0 : 0.0;
}

vec3 hash( vec3 p ) // replace this by something better
vec3 hash(vec3 p)
{
p = vec3( dot(p,vec3(127.1,311.7, 74.7)),
dot(p,vec3(269.5,183.3,246.1)),
dot(p,vec3(113.5,271.9,124.6)));

return -1.0 + 2.0*fract(sin(p)*43758.5453123);
p = vec3(dot(p, vec3(127.1,311.7,74.7)),
dot(p, vec3(269.5,183.3,246.1)),
dot(p, vec3(113.5,271.9,124.6)));
return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);
}
float noise( in vec3 p )

float noise(in vec3 p)
{
vec3 i = floor( p );
vec3 f = fract( p );

vec3 u = f*f*(3.0-2.0*f);

return mix( mix( mix( dot( hash( i + vec3(0.0,0.0,0.0) ), f - vec3(0.0,0.0,0.0) ),
dot( hash( i + vec3(1.0,0.0,0.0) ), f - vec3(1.0,0.0,0.0) ), u.x),
mix( dot( hash( i + vec3(0.0,1.0,0.0) ), f - vec3(0.0,1.0,0.0) ),
dot( hash( i + vec3(1.0,1.0,0.0) ), f - vec3(1.0,1.0,0.0) ), u.x), u.y),
mix( mix( dot( hash( i + vec3(0.0,0.0,1.0) ), f - vec3(0.0,0.0,1.0) ),
dot( hash( i + vec3(1.0,0.0,1.0) ), f - vec3(1.0,0.0,1.0) ), u.x),
mix( dot( hash( i + vec3(0.0,1.0,1.0) ), f - vec3(0.0,1.0,1.0) ),
dot( hash( i + vec3(1.0,1.0,1.0) ), f - vec3(1.0,1.0,1.0) ), u.x), u.y), u.z );
vec3 i = floor(p);
vec3 f = fract(p);
vec3 u = f * f * (3.0 - 2.0 * f);

return mix(
mix(
mix(dot(hash(i + vec3(0.0,0.0,0.0)), f - vec3(0.0,0.0,0.0)),
dot(hash(i + vec3(1.0,0.0,0.0)), f - vec3(1.0,0.0,0.0)), u.x),
mix(dot(hash(i + vec3(0.0,1.0,0.0)), f - vec3(0.0,1.0,0.0)),
dot(hash(i + vec3(1.0,1.0,0.0)), f - vec3(1.0,1.0,0.0)), u.x), u.y),
mix(
mix(dot(hash(i + vec3(0.0,0.0,1.0)), f - vec3(0.0,0.0,1.0)),
dot(hash(i + vec3(1.0,0.0,1.0)), f - vec3(1.0,0.0,1.0)), u.x),
mix(dot(hash(i + vec3(0.0,1.0,1.0)), f - vec3(0.0,1.0,1.0)),
dot(hash(i + vec3(1.0,1.0,1.0)), f - vec3(1.0,1.0,1.0)), u.x), u.y), u.z);
}

// This is what actually changes the look of card
vec4 effect(vec4 colour,Image texture,vec2 tc,vec2 screen_coords)
vec4 effect(vec4 colour, Image texture, vec2 tc, vec2 screen_coords)
{
vec4 tex=Texel(texture,tc);
float t=0.;
float c=3;
float iterated=0.;
vec2 sc=screen_coords;//alias
vec2 cep=center_pos;//ditto
for(float ix=-c;ix<=c;ix++){
for(float iy=-c;iy<=c;iy++){
t+=get_t(vec2(screen_coords.x+ix,screen_coords.y+iy));
vec4 tex = Texel(texture, tc);

float t = 0.0;
float c = 3.0;
float iterated = 0.0;
vec2 sc = screen_coords; // alias
vec2 cep = center_pos; // ditto

for (float ix = -c; ix <= c; ix++) {
for (float iy = -c; iy <= c; iy++) {
t += get_t(vec2(screen_coords.x + ix, screen_coords.y + iy));
iterated++;
}
}
t/=iterated;

vec4 inverted=tex;
inverted.g=0;
inverted.b = 0;
t /= iterated;

vec4 inverted = tex;
inverted.g = 0.0;
inverted.b = 0.0;
inverted = HSL(inverted);
inverted.r = time/3.;
inverted.r = time / 3.0;
inverted = RGB(inverted);

vec3 stars_direction = normalize(vec3((screen_coords/love_ScreenSize.xy) * 2.0f - 1.0f, 1.0f)); // could be view vector for example
float stars_threshold = 8.0f; // modifies the number of stars that are visible
float stars_exposure = 200.0f; // modifies the overall strength of the stars
float stars = pow(clamp(noise(stars_direction * 200.0f), 0.0f, 1.0f), stars_threshold) * stars_exposure;
stars *= mix(0.4, 1.4, noise(stars_direction * 100.0f + vec3(time * 5.))); // time based flickering
vec3 stars_direction = normalize(vec3((screen_coords / love_ScreenSize.xy) * 2.0 - 1.0, 1.0)); // could be view vector for example
float stars_threshold = 8.0; // modifies the number of stars that are visible
float stars_exposure = 200.0; // modifies the overall strength of the stars
float stars = pow(clamp(noise(stars_direction * 200.0), 0.0, 1.0), stars_threshold) * stars_exposure;
stars *= mix(0.4, 1.4, noise(stars_direction * 100.0 + vec3(time * 5.0))); // time based flickering

inverted += vec4(vec3(stars),1.0);
inverted += vec4(vec3(stars), 1.0);

tex=(t*inverted)+((1-t)*tex);
float strength=lindist(t,0.5);
if(strength<.2){
tex.rgb=vec3(0);
tex = (t * inverted) + ((1.0 - t) * tex);

float strength = lindist(t, 0.5);
if (strength < 0.2) {
tex.rgb = vec3(0.0);
}

float cdist=distance(center_pos,screen_coords);
float max_mult = 2;

float cdist = distance(center_pos, screen_coords);
float minDist = dist;
float maxDist = 2.0 * dist;
float max_mult = 2.0;
float rad = dist / 10.0;
if (cdist < min_dist) {
float str = (rad - abs(min_dist-cdist)) / rad;
tex.rgb *= max(str*max_mult,1.0);

if (cdist < minDist) {
float str = (rad - abs(minDist - cdist)) / rad;
tex.rgb *= max(str * max_mult, 1.0);
}

if (cdist > max_dist) {
float str = (rad - abs(max_mult-cdist)) / rad;
tex.rgb *= max(str*max_mult,1.0);
if (cdist > maxDist) {
float str = (rad - abs(maxDist - cdist)) / rad;
tex.rgb *= max(str * max_mult, 1.0);
}

return tex;
}

#ifdef VERTEX
vec4 position(mat4 transform_projection,vec4 vertex_position)
vec4 position(mat4 transform_projection, vec4 vertex_position)
{
return transform_projection*vertex_position;
return transform_projection * vertex_position;
}
#endif
#endif
4 changes: 2 additions & 2 deletions assets/shaders/vignette.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
a = 2. * (1. - a);
if (a > 1.) {a = 1.;};
a = 1. - a;
return tex * vec4(1-a, 1-a, 1-a, 1);
return tex * vec4(1.-a, 1.-a, 1.-a, 1.);
}

#ifdef VERTEX
vec4 position( mat4 transform_projection, vec4 vertex_position )
{
return transform_projection * vertex_position;
}
#endif
#endif