着色器技术飞跃

框架跟进
This commit is contained in:
MrZ_26
2022-04-03 02:41:49 +08:00
parent a6c63c41b6
commit 716a08b31d
27 changed files with 59 additions and 120 deletions

View File

@@ -1,4 +1,4 @@
extern float a;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
return vec4(1.,1.,1.,sign(Texel(tex,tex_coords).a)*a);
uniform float a;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
return vec4(1.,1.,1.,sign(texture2D(tex,texCoord).a)*a);
}

View File

@@ -1,42 +1,14 @@
#define PI 3.1415926535897932384626
extern float w,h;
extern float t;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
float x=scr_coords.x/w;
float y=scr_coords.y/h;
float dx,dy;
uniform float phase;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
float x=scrCoord.x/love_ScreenSize.x;
float y=scrCoord.y/love_ScreenSize.y;
vec3 V=vec3(0.);
V.r=V.r+smoothstep(1.26,0.,length(vec2(0.5+cos(phase*3.*0.26)*0.4-x,0.5-sin(phase*3.*0.62)*0.4-y)));
V.g=V.g+smoothstep(1.26,0.,length(vec2((0.5+cos(phase*3.*0.32)*0.4)-x,(0.5-sin(phase*3.*0.80)*0.4)-y)));
V.b=V.b+smoothstep(1.26,0.,length(vec2((0.5-cos(phase*3.*0.49)*0.4)-x,(0.5+sin(phase*3.*0.18)*0.4)-y)));
V.rg+=vec2(smoothstep(0.626,0.,length(vec2((0.5+cos(phase*0.53)*0.4)-x,(0.5-sin(phase*0.46)*0.4)-y))));
V.rb+=vec2(smoothstep(0.626,0.,length(vec2((0.5+cos(phase*0.98)*0.4)-x,(0.5+sin(phase*0.57)*0.4)-y))));
V.gb+=vec2(smoothstep(0.626,0.,length(vec2((0.5-cos(phase*0.86)*0.4)-x,(0.5-sin(phase*0.32)*0.4)-y))));
dx=0.5+cos(t*3.*0.26)*0.4-x;
dy=0.5-sin(t*3.*0.62)*0.4-y;
dx=sqrt(dx*dx+dy*dy);
V.r=V.r+smoothstep(1.26,0.,dx);
dx=(0.5+cos(t*3.*0.32)*0.4)-x;
dy=(0.5-sin(t*3.*0.80)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.g=V.g+smoothstep(1.26,0.,dx);
dx=(0.5-cos(t*3.*0.49)*0.4)-x;
dy=(0.5+sin(t*3.*0.18)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.b=V.b+smoothstep(1.26,0.,dx);
dx=(0.5+cos(t*0.53)*0.4)-x;
dy=(0.5-sin(t*0.46)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.rg+=vec2(smoothstep(0.626,0.,dx));
dx=(0.5+cos(t*0.98)*0.4)-x;
dy=(0.5+sin(t*0.57)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.rb+=vec2(smoothstep(0.626,0.,dx));
dx=(0.5-cos(t*0.86)*0.4)-x;
dy=(0.5-sin(t*0.32)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.gb+=vec2(smoothstep(0.626,0.,dx));
dx=1.626*max(max(V.r,V.g),V.b);
return vec4(V/dx,0.4);
return vec4(V/max(max(V.r,V.g),V.b)/1.626,0.4);
}

View File

@@ -1,10 +1,10 @@
extern float k,b;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
vec4 texcolor=Texel(tex,tex_coords);
uniform float k,b;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
vec4 texcolor=texture2D(tex,texCoord);
return vec4(
(b+texcolor.r*k)*color.r,
(b+texcolor.g*k)*color.g,
(b+texcolor.b*k)*color.b,
(texcolor.r*k+b)*color.r,
(texcolor.g*k+b)*color.g,
(texcolor.b*k+b)*color.b,
texcolor.a*color.a
);
}

View File

@@ -1,10 +1,10 @@
extern float k,b;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
vec4 texcolor=Texel(tex,tex_coords);
uniform float k,b;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
vec4 texcolor=texture2D(tex,texCoord);
return vec4(
(b+texcolor.r*k)*color.r,
(b+texcolor.g*k)*color.g,
(b+texcolor.b*k)*color.b,
(texcolor.r*k+b)*color.r,
(texcolor.g*k+b)*color.g,
(texcolor.b*k+b)*color.b,
texcolor.a*color.a
);
}

View File

@@ -1,9 +1,9 @@
extern float t,w;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
float x=scr_coords.x/w;
uniform float phase;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
float x=scrCoord.x/love_ScreenSize.x;
return vec4(
.8-x*.6,
.3+.2*sin(t),
.3+.2*sin(phase),
.15+x*.7,
.4
);

View File

@@ -1,10 +1,10 @@
extern float t,h;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
float y=scr_coords.y/h;
uniform float phase;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
float y=scrCoord.y/love_ScreenSize.y;
return vec4(
.8-y*.6,
.2+y*.4,
.3+.1*sin(t),
.3+.1*sin(phase),
.4
);
}

View File

@@ -1,5 +1,5 @@
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
vec4 texcolor=Texel(tex,tex_coords);
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
vec4 texcolor=texture2D(tex,texCoord);
return vec4(
pow(texcolor.r+.26,.7023),
pow(texcolor.g+.26,.7023),

View File

@@ -1,11 +1,11 @@
extern float t,w,h;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
float x=scr_coords.x/w;
float y=scr_coords.y/h;
uniform float phase;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
float x=scrCoord.x/love_ScreenSize.x;
float y=scrCoord.y/love_ScreenSize.y;
return vec4(
.8-y*.7+.2*sin(t/6.26),
.2+y*.5+.15*sin(t/4.),
.2+x*.6-.1*sin(t/2.83),
.8-y*.7+.2*sin(phase/6.26),
.2+y*.5+.15*sin(phase/4.),
.2+x*.6-.1*sin(phase/2.83),
.4
);
}

View File

@@ -1,11 +1,11 @@
extern float t,w,h;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
float x=scr_coords.x/w;
float y=scr_coords.y/h;
uniform float phase;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
float x=scrCoord.x/love_ScreenSize.x;
float y=scrCoord.y/love_ScreenSize.y;
return vec4(
.8-y*.8-.1*sin(t/6.26),
.4+.1*sin(t/4.)*(y+2.)/(y+5.),
abs(.7-x*1.4+y*.5*sin(t/16.)),
.8-y*.8-.1*sin(phase/6.26),
.4+.1*sin(phase/4.)*(y+2.)/(y+5.),
abs(.7-x*1.4+y*.5*sin(phase/16.)),
.4
);
}

View File

@@ -1,6 +1,6 @@
extern float w,level;
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
float dx=abs(scr_coords.x/w-0.5);
uniform float level;
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
float dx=abs(scrCoord.x/love_ScreenSize.x-0.5);
float a=(dx*2.6-.626)*level;
return vec4(1.,0.,0.,a);
}