1.0.0n
This commit is contained in:
@@ -20,7 +20,7 @@ extern MY_HIGHP_OR_MEDIUMP number scanlines;
|
||||
vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc)
|
||||
{
|
||||
//Keep the original texture coords
|
||||
vec2 orig_tc = tc;
|
||||
MY_HIGHP_OR_MEDIUMP vec2 orig_tc = tc;
|
||||
|
||||
//recenter
|
||||
tc = tc*2.0 - vec2(1.0);
|
||||
@@ -31,17 +31,17 @@ vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc)
|
||||
|
||||
//smoothly transition the edge to black
|
||||
//buffer for the outer edge, this gets wonky if there is no buffer
|
||||
number mask = (1.0 - smoothstep(1.0-feather_fac,1.0,abs(tc.x) - BUFF))
|
||||
MY_HIGHP_OR_MEDIUMP number mask = (1.0 - smoothstep(1.0-feather_fac,1.0,abs(tc.x) - BUFF))
|
||||
* (1.0 - smoothstep(1.0-feather_fac,1.0,abs(tc.y) - BUFF));
|
||||
|
||||
//undo the recenter
|
||||
tc = (tc + vec2(1.0))/2.0;
|
||||
|
||||
//Create the horizontal glitch offset effects
|
||||
number offset_l = 0.;
|
||||
number offset_r = 0.;
|
||||
MY_HIGHP_OR_MEDIUMP number offset_l = 0.;
|
||||
MY_HIGHP_OR_MEDIUMP number offset_r = 0.;
|
||||
if(glitch_intensity > 0.01){
|
||||
number timefac = 3.0*time;
|
||||
MY_HIGHP_OR_MEDIUMP number timefac = 3.0*time;
|
||||
offset_l = 50.0*(-3.5+sin(timefac*0.512 + tc.y*40.0)
|
||||
+ sin(-timefac*0.8233 + tc.y*81.532)
|
||||
+ sin(timefac*0.333 + tc.y*30.3)
|
||||
@@ -65,18 +65,18 @@ vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc)
|
||||
}
|
||||
|
||||
//Apply mask and bulging effect
|
||||
vec4 crt_tex = Texel( tex, tc);
|
||||
MY_HIGHP_OR_MEDIUMP vec4 crt_tex = Texel( tex, tc);
|
||||
|
||||
//intensity multiplier for any visual artifacts
|
||||
float artifact_amplifier = (abs(clamp(offset_l, clamp(offset_r, -1.0, 0.0), 1.0))*glitch_intensity > 0.9 ? 3. : 1.);
|
||||
MY_HIGHP_OR_MEDIUMP float artifact_amplifier = (abs(clamp(offset_l, clamp(offset_r, -1.0, 0.0), 1.0))*glitch_intensity > 0.9 ? 3. : 1.);
|
||||
|
||||
//Horizontal Chromatic Aberration
|
||||
float crt_amout_adjusted = (max(0., (crt_intensity)/(0.16*0.3)))*artifact_amplifier;
|
||||
MY_HIGHP_OR_MEDIUMP float crt_amout_adjusted = (max(0., (crt_intensity)/(0.16*0.3)))*artifact_amplifier;
|
||||
if(crt_amout_adjusted > 0.0000001) {
|
||||
crt_tex.r = crt_tex.r*(1.-crt_amout_adjusted) + crt_amout_adjusted*Texel( tex, tc + vec2(0.0005*(1. +10.*(artifact_amplifier - 1.))*1600./love_ScreenSize.x, 0.)).r;
|
||||
crt_tex.g = crt_tex.g*(1.-crt_amout_adjusted) + crt_amout_adjusted*Texel( tex, tc + vec2(-0.0005*(1. +10.*(artifact_amplifier - 1.))*1600./love_ScreenSize.x, 0.)).g;
|
||||
}
|
||||
vec3 rgb_result = crt_tex.rgb*(1.0 - (1.0*crt_intensity*artifact_amplifier));
|
||||
MY_HIGHP_OR_MEDIUMP vec3 rgb_result = crt_tex.rgb*(1.0 - (1.0*crt_intensity*artifact_amplifier));
|
||||
|
||||
//post processing on the glitch effect to amplify green or red for a few lines of pixels
|
||||
if (sin(time + tc.y*200.0) > 0.85) {
|
||||
@@ -85,7 +85,7 @@ vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc)
|
||||
}
|
||||
|
||||
//Add the pixel scanline overlay, a repeated 'pixel' mask that doesn't actually render the real image. If these pixels were used to render the image it would be too harsh
|
||||
vec3 rgb_scanline = 1.0*vec3(
|
||||
MY_HIGHP_OR_MEDIUMP vec3 rgb_scanline = 1.0*vec3(
|
||||
clamp(-0.3+2.0*sin( tc.y * scanlines-3.14/4.0) - 0.8*clamp(sin( tc.x*scanlines*4.0), 0.4, 1.0), -1.0, 2.0),
|
||||
clamp(-0.3+2.0*cos( tc.y * scanlines) - 0.8*clamp(cos( tc.x*scanlines*4.0), 0.0, 1.0), -1.0, 2.0),
|
||||
clamp(-0.3+2.0*cos( tc.y * scanlines -3.14/3.0) - 0.8*clamp(cos( tc.x*scanlines*4.0-3.14/4.0), 0.0, 1.0), -1.0, 2.0));
|
||||
@@ -93,9 +93,9 @@ vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc)
|
||||
rgb_result += crt_tex.rgb * rgb_scanline * crt_intensity * artifact_amplifier;
|
||||
|
||||
//Add in some noise
|
||||
number x = (tc.x - mod(tc.x, 0.002)) * (tc.y - mod(tc.y, 0.0013)) * time * 1000.0;
|
||||
MY_HIGHP_OR_MEDIUMP number x = (tc.x - mod(tc.x, 0.002)) * (tc.y - mod(tc.y, 0.0013)) * time * 1000.0;
|
||||
x = mod( x, 13.0 ) * mod( x, 123.0 );
|
||||
number dx = mod( x, 0.11 )/0.11;
|
||||
MY_HIGHP_OR_MEDIUMP number dx = mod( x, 0.11 )/0.11;
|
||||
rgb_result = (1.0-clamp( noise_fac*artifact_amplifier, 0.0,1.0 ))*rgb_result + dx * clamp( noise_fac*artifact_amplifier, 0.0,1.0 ) * vec3(1.0,1.0,1.0);
|
||||
|
||||
//contrast and brightness correction for the CRT effect, also adjusting brightness for bloom
|
||||
@@ -104,17 +104,17 @@ vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc)
|
||||
rgb_result += vec3(0.5);
|
||||
|
||||
//Prepare the final colour to return
|
||||
vec4 final_col = vec4( rgb_result*1.0, 1.0 );
|
||||
MY_HIGHP_OR_MEDIUMP vec4 final_col = vec4( rgb_result*1.0, 1.0 );
|
||||
|
||||
//Finally apply bloom
|
||||
vec4 col = vec4(0.0);
|
||||
float bloom = 0.0;
|
||||
MY_HIGHP_OR_MEDIUMP vec4 col = vec4(0.0);
|
||||
MY_HIGHP_OR_MEDIUMP float bloom = 0.0;
|
||||
|
||||
if (bloom_fac > 0.00001 && crt_intensity > 0.000001){
|
||||
bloom = 0.03*(max(0., (crt_intensity)/(0.16*0.3)));
|
||||
float bloom_dist = 0.0015*float(BLOOM_AMT);
|
||||
vec4 samp;
|
||||
float cutoff = 0.6;
|
||||
MY_HIGHP_OR_MEDIUMP float bloom_dist = 0.0015*float(BLOOM_AMT);
|
||||
MY_HIGHP_OR_MEDIUMP vec4 samp;
|
||||
MY_HIGHP_OR_MEDIUMP float cutoff = 0.6;
|
||||
|
||||
for (int i = -BLOOM_AMT; i <= BLOOM_AMT; ++i)
|
||||
for (int j = -BLOOM_AMT; j <= BLOOM_AMT; ++j){
|
||||
@@ -144,9 +144,9 @@ vec4 position( mat4 transform_projection, vec4 vertex_position )
|
||||
if (hovering <= 0.){
|
||||
return transform_projection * 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.002*(-0.03 - 0.3*max(0., 0.3-mid_dist))
|
||||
MY_HIGHP_OR_MEDIUMP float mid_dist = length(vertex_position.xy - 0.5*love_ScreenSize.xy)/length(love_ScreenSize.xy);
|
||||
MY_HIGHP_OR_MEDIUMP vec2 mouse_offset = (vertex_position.xy - mouse_screen_pos.xy)/screen_scale;
|
||||
MY_HIGHP_OR_MEDIUMP float scale = 0.002*(-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);
|
||||
|
Reference in New Issue
Block a user