ソースを参照

lolfx: use square brackets to indicate shader sections.

master
Sam Hocevar 12年前
コミット
d4e07923e9
10個のファイルの変更171行の追加145行の削除
  1. +22
    -20
      neercs/video/blurh.lolfx
  2. +23
    -20
      neercs/video/blurv.lolfx
  3. +20
    -18
      neercs/video/color.lolfx
  4. +19
    -16
      neercs/video/copper.lolfx
  5. +9
    -7
      neercs/video/glow.lolfx
  6. +21
    -18
      neercs/video/noise.lolfx
  7. +38
    -35
      neercs/video/postfx.lolfx
  8. +10
    -7
      neercs/video/remanency.lolfx
  9. +7
    -4
      neercs/video/simple.lolfx
  10. +2
    -0
      neercs/video/text.lolfx

+ 22
- 20
neercs/video/blurh.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -16,19 +16,19 @@ uniform sampler2D texture;
uniform vec2 radius;

void main(void)
{
vec4 total=vec4(0.0);
vec2 p=gl_TexCoord[0].xy;
float mask=2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
float b=radius.x+radius.y*mask;
total+=texture2D(texture,vec2(p.x-b*4.0,p.y))*0.04;
total+=texture2D(texture,vec2(p.x-b*3.0,p.y))*0.08;
total+=texture2D(texture,vec2(p.x-b*2.0,p.y))*0.12;
total+=texture2D(texture,vec2(p.x-b ,p.y))*0.16;
total+=texture2D(texture,vec2(p.x ,p.y))*0.20;
total+=texture2D(texture,vec2(p.x+b ,p.y))*0.16;
total+=texture2D(texture,vec2(p.x+b*2.0,p.y))*0.12;
total+=texture2D(texture,vec2(p.x+b*3.0,p.y))*0.08;
total+=texture2D(texture,vec2(p.x+b*4.0,p.y))*0.04;
gl_FragColor=total;
}
{
vec4 total = vec4(0.0);
vec2 p = gl_TexCoord[0].xy;
float mask = 2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
float b = radius.x+radius.y*mask;
total += texture2D(texture,vec2(p.x-b*4.0,p.y))*0.04;
total += texture2D(texture,vec2(p.x-b*3.0,p.y))*0.08;
total += texture2D(texture,vec2(p.x-b*2.0,p.y))*0.12;
total += texture2D(texture,vec2(p.x-b ,p.y))*0.16;
total += texture2D(texture,vec2(p.x ,p.y))*0.20;
total += texture2D(texture,vec2(p.x+b ,p.y))*0.16;
total += texture2D(texture,vec2(p.x+b*2.0,p.y))*0.12;
total += texture2D(texture,vec2(p.x+b*3.0,p.y))*0.08;
total += texture2D(texture,vec2(p.x+b*4.0,p.y))*0.04;
gl_FragColor = total;
}

+ 23
- 20
neercs/video/blurv.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -16,19 +16,20 @@ uniform sampler2D texture;
uniform vec2 radius;

void main(void)
{
vec4 total=vec4(0.0);
vec2 p=gl_TexCoord[0].xy;
float mask=2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
float b=radius.x+radius.y*mask;
total+=texture2D(texture,vec2(p.x,p.y-b*4.0))*0.04;
total+=texture2D(texture,vec2(p.x,p.y-b*3.0))*0.08;
total+=texture2D(texture,vec2(p.x,p.y-b*2.0))*0.12;
total+=texture2D(texture,vec2(p.x,p.y-b ))*0.16;
total+=texture2D(texture,vec2(p.x,p.y ))*0.20;
total+=texture2D(texture,vec2(p.x,p.y+b ))*0.16;
total+=texture2D(texture,vec2(p.x,p.y+b*2.0))*0.12;
total+=texture2D(texture,vec2(p.x,p.y+b*3.0))*0.08;
total+=texture2D(texture,vec2(p.x,p.y+b*4.0))*0.04;
gl_FragColor=total;
}
{
vec4 total = vec4(0.0);
vec2 p = gl_TexCoord[0].xy;
float mask = 2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
float b = radius.x+radius.y*mask;
total += texture2D(texture,vec2(p.x,p.y-b*4.0))*0.04;
total += texture2D(texture,vec2(p.x,p.y-b*3.0))*0.08;
total += texture2D(texture,vec2(p.x,p.y-b*2.0))*0.12;
total += texture2D(texture,vec2(p.x,p.y-b ))*0.16;
total += texture2D(texture,vec2(p.x,p.y ))*0.20;
total += texture2D(texture,vec2(p.x,p.y+b ))*0.16;
total += texture2D(texture,vec2(p.x,p.y+b*2.0))*0.12;
total += texture2D(texture,vec2(p.x,p.y+b*3.0))*0.08;
total += texture2D(texture,vec2(p.x,p.y+b*4.0))*0.04;
gl_FragColor = total;
}


+ 20
- 18
neercs/video/color.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -19,17 +19,17 @@ uniform vec4 color;
uniform float flash;

void main(void)
{
vec2 p=gl_FragCoord.xy/screen_size.xy;
vec3 c=texture2D(texture,p).xyz;
float a=(c.x+c.y+c.z)/3.0;
c=mix(c,vec3(a),color.w); // grayscale
c*=filter; // filter
c+=color.z*0.1; // level
c*=color.x; // brightness
c=0.5+(c-0.5)*color.y; // contrast
c+=flash; // flash
gl_FragColor=vec4(c,1.0);
}
{
vec2 p = gl_FragCoord.xy/screen_size.xy;
vec3 c = texture2D(texture,p).xyz;
float a = (c.x+c.y+c.z)/3.0;
c = mix(c,vec3(a),color.w); // grayscale
c *= filter; // filter
c += color.z*0.1; // level
c *= color.x; // brightness
c = 0.5+(c-0.5)*color.y; // contrast
c += flash; // flash
gl_FragColor = vec4(c,1.0);
}

+ 19
- 16
neercs/video/copper.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -18,20 +18,21 @@ uniform float time;
uniform vec4 copper;

void main(void)
{
vec2 p=gl_TexCoord[0].xy;
vec3 source=texture2D(texture,p).xyz;
{
vec2 p = gl_TexCoord[0].xy;
vec3 source = texture2D(texture,p).xyz;

vec3 color=vec3(0.5);
vec3 color = vec3(0.5);

color.x+=0.5*cos(p.y*float(screen_size.y/copper.z)+time*2.0);
color.z+=0.5*sin(p.y*float(screen_size.y/copper.z)+time*2.0);
color.x += 0.5*cos(p.y*float(screen_size.y/copper.z)+time*2.0);
color.z += 0.5*sin(p.y*float(screen_size.y/copper.z)+time*2.0);

color*=copper.x+copper.y*cos(p.y*float(screen_size.x/copper.w)-time*2.0);
color *= copper.x+copper.y*cos(p.y*float(screen_size.x/copper.w)-time*2.0);

color.x=float(int(color.x*8.0)*32)/256.0;
color.y=float(int(color.y*8.0)*32)/256.0;
color.z=float(int(color.z*8.0)*32)/256.0;
color.x = float(int(color.x*8.0)*32)/256.0;
color.y = float(int(color.y*8.0)*32)/256.0;
color.z = float(int(color.z*8.0)*32)/256.0;

gl_FragColor = vec4((color==1.0)?color:source,1.0);
}

gl_FragColor=vec4((color==1.0)?color:source,1.0);
}

+ 9
- 7
neercs/video/glow.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -17,6 +17,6 @@ uniform sampler2D source;
uniform vec2 mix;

void main(void)
{
gl_FragColor=texture2D(source,gl_TexCoord[0].xy)*mix.x+texture2D(glow,gl_TexCoord[0].xy)*mix.y;
}
{
gl_FragColor = texture2D(source,gl_TexCoord[0].xy)*mix.x+texture2D(glow,gl_TexCoord[0].xy)*mix.y;
}

+ 21
- 18
neercs/video/noise.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -20,20 +20,21 @@ uniform float noise;
uniform vec3 retrace;

float rand(in vec2 p,in float t,in float v)
{
{
return fract(sin(dot(p+mod(t,2.0),vec2(12.9898,78.2333)))*v);
}
}

void main(void)
{
vec2 p=gl_FragCoord.xy/screen_size.xy;

float r1=rand(p,time,43758.5453);
float r2=rand(p,time,70425.2854);
vec2 o=(offset-offset*2.0*r1)/screen_size;

vec3 c=texture2D(texture,p+o).xyz; // offset
c*=1.0+(noise-noise*2.0*r1); // noise
c-=retrace.x*0.01*mod(p.y*retrace.y+time*retrace.z,1.0); // retrace
gl_FragColor=vec4(c,1.0);
}
{
vec2 p = gl_FragCoord.xy/screen_size.xy;

float r1 = rand(p,time,43758.5453);
float r2 = rand(p,time,70425.2854);
vec2 o = (offset-offset*2.0*r1)/screen_size;

vec3 c = texture2D(texture,p+o).xyz; // offset
c *= 1.0+(noise-noise*2.0*r1); // noise
c -= retrace.x*0.01*mod(p.y*retrace.y+time*retrace.z,1.0); // retrace
gl_FragColor = vec4(c,1.0);
}


+ 38
- 35
neercs/video/postfx.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -29,47 +29,48 @@ uniform float sync;
uniform float beat;

vec2 screen(in vec2 p,in float radius)
{
float d=deform.x+sync*0.0625+beat*0.0375;
{
float d = deform.x+sync*0.0625+beat*0.0375;
return p*(1.5-(radius*cos(p.x*d)+radius*cos(p.y*d)))-0.5;
}
}

vec3 get_color(in sampler2D tex,in vec2 p)
{
{
return texture2D(tex,clamp(p,-1.0,0.0)).xyz;
}
}

float letterbox(in vec2 p,in float w,in float radius,in float smooth)
{
{
return 1.0-smoothstep(smooth,1.0,length(max(abs(p*w+w/2.0)-vec2(radius),0.0))+radius);
}
}

void main(void)
{
vec2 q=gl_FragCoord.xy/screen_size.xy;
vec2 p=-1.0+2.0*gl_FragCoord.xy/screen_size.xy;
p.y+=0.025*sync;
vec2 z=screen(p,deform.y);
vec2 z1=screen(p,deform.y+ghost1.z*0.01);
vec2 z2=screen(p,deform.y+ghost2.z*0.01);
float mask=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);
{
vec2 q = gl_FragCoord.xy/screen_size.xy;
vec2 p = -1.0+2.0*gl_FragCoord.xy/screen_size.xy;
p.y += 0.025*sync;
vec2 z = screen(p,deform.y);
vec2 z1 = screen(p,deform.y+ghost1.z*0.01);
vec2 z2 = screen(p,deform.y+ghost2.z*0.01);
float mask = q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);

vec3 source=get_color(texture,z);
vec3 g1=get_color(texture,z1-ghost1.xy*0.01);
vec3 g2=get_color(texture,z2-ghost2.xy*0.01);
vec3 source = get_color(texture,z);
vec3 g1 = get_color(texture,z1-ghost1.xy*0.01);
vec3 g2 = get_color(texture,z2-ghost2.xy*0.01);

vec3 c=source+g1*ghost1.w+g2*ghost2.w; // mix
vec3 c = source+g1*ghost1.w+g2*ghost2.w; // mix

float v=aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0-mask);
vec3 ca1=get_color(texture,vec2(z.x-v,z.y));
vec3 ca2=get_color(texture,vec2(z.x+v,z.y));
c+=vec3(ca1.x,c.y,ca2.z); // chromatic aberration
float v = aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0-mask);
vec3 ca1 = get_color(texture,vec2(z.x-v,z.y));
vec3 ca2 = get_color(texture,vec2(z.x+v,z.y));
c += vec3(ca1.x,c.y,ca2.z); // chromatic aberration

c *= moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z))*sin(0.5+z.x*float(screen_size.x*moire_h.w)); // moire h
c *= moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z))*sin(0.5+z.y*float(screen_size.y*moire_v.w)); // moire v
c *= scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h
c *= scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v
c *= mix(1.0,mask,vignetting); // vignetting
c *= letterbox(z,corner.x+2.0,corner.y,corner.z); // corner
gl_FragColor = vec4(c,1.0);
}

c*=moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z))*sin(0.5+z.x*float(screen_size.x*moire_h.w)); // moire h
c*=moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z))*sin(0.5+z.y*float(screen_size.y*moire_v.w)); // moire v
c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h
c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v
c*=mix(1.0,mask,vignetting); // vignetting
c*=letterbox(z,corner.x+2.0,corner.y,corner.z); // corner
gl_FragColor=vec4(c,1.0);
}

+ 10
- 7
neercs/video/remanency.lolfx ファイルの表示

@@ -1,14 +1,14 @@
[vert.glsl]

#version 120

void main()
{
gl_Position=gl_Vertex;
gl_TexCoord[0]=gl_MultiTexCoord0;
}
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[frag.glsl]

#version 120

@@ -17,6 +17,7 @@ uniform sampler2D buffer;
uniform vec2 mix;

void main(void)
{
gl_FragColor=texture2D(source,gl_TexCoord[0].xy)*mix.x+texture2D(buffer,gl_TexCoord[0].xy)*mix.y;
}
{
gl_FragColor = texture2D(source,gl_TexCoord[0].xy)*mix.x+texture2D(buffer,gl_TexCoord[0].xy)*mix.y;
}


+ 7
- 4
neercs/video/simple.lolfx ファイルの表示

@@ -1,20 +1,21 @@
[vert.glsl]

#version 120

void main()
{
{
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
}

[frag.glsl]

#version 120

uniform sampler2D texture;

void main(void)
{
{
gl_FragColor = texture2D(texture, gl_TexCoord[0].xy);
}
}


+ 2
- 0
neercs/video/text.lolfx ファイルの表示

@@ -1,4 +1,4 @@
[vert.glsl]

#version 130

@@ -61,7 +61,7 @@ void main()
gl_Position = in_Transform * vec4(in_Position, 0.0, 1.0);
}

[frag.glsl]

#version 130



読み込み中…
キャンセル
保存