Changeset 1928 for trunk/tools/neercs/video/postfx.lolfx
 Timestamp:
 Sep 20, 2012, 12:23:59 AM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/tools/neercs/video/postfx.lolfx
r1916 r1928 1  GLSL.Vert  1 [vert.glsl] 2 2 3 3 #version 120 4 4 5 5 void main() 6 7 gl_Position =gl_Vertex;8 gl_TexCoord[0] =gl_MultiTexCoord0;9 6 { 7 gl_Position = gl_Vertex; 8 gl_TexCoord[0] = gl_MultiTexCoord0; 9 } 10 10 11  GLSL.Frag  11 [frag.glsl] 12 12 13 13 #version 120 … … 30 30 31 31 vec2 screen(in vec2 p,in float radius) 32 33 float d =deform.x+sync*0.0625+beat*0.0375;32 { 33 float d = deform.x+sync*0.0625+beat*0.0375; 34 34 return p*(1.5(radius*cos(p.x*d)+radius*cos(p.y*d)))0.5; 35 35 } 36 36 37 37 vec3 get_color(in sampler2D tex,in vec2 p) 38 38 { 39 39 return texture2D(tex,clamp(p,1.0,0.0)).xyz; 40 40 } 41 41 42 42 float letterbox(in vec2 p,in float w,in float radius,in float smooth) 43 43 { 44 44 return 1.0smoothstep(smooth,1.0,length(max(abs(p*w+w/2.0)vec2(radius),0.0))+radius); 45 45 } 46 46 47 47 void main(void) 48 49 vec2 q =gl_FragCoord.xy/screen_size.xy;50 vec2 p =1.0+2.0*gl_FragCoord.xy/screen_size.xy;51 p.y +=0.025*sync;52 vec2 z =screen(p,deform.y);53 vec2 z1 =screen(p,deform.y+ghost1.z*0.01);54 vec2 z2 =screen(p,deform.y+ghost2.z*0.01);55 float mask =q.x*(6.0q.x*6.0)*q.y*(6.0q.y*6.0);48 { 49 vec2 q = gl_FragCoord.xy/screen_size.xy; 50 vec2 p = 1.0+2.0*gl_FragCoord.xy/screen_size.xy; 51 p.y += 0.025*sync; 52 vec2 z = screen(p,deform.y); 53 vec2 z1 = screen(p,deform.y+ghost1.z*0.01); 54 vec2 z2 = screen(p,deform.y+ghost2.z*0.01); 55 float mask = q.x*(6.0q.x*6.0)*q.y*(6.0q.y*6.0); 56 56 57 vec3 source =get_color(texture,z);58 vec3 g1 =get_color(texture,z1ghost1.xy*0.01);59 vec3 g2 =get_color(texture,z2ghost2.xy*0.01);57 vec3 source = get_color(texture,z); 58 vec3 g1 = get_color(texture,z1ghost1.xy*0.01); 59 vec3 g2 = get_color(texture,z2ghost2.xy*0.01); 60 60 61 vec3 c =source+g1*ghost1.w+g2*ghost2.w; // mix61 vec3 c = source+g1*ghost1.w+g2*ghost2.w; // mix 62 62 63 float v =aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0mask);64 vec3 ca1 =get_color(texture,vec2(z.xv,z.y));65 vec3 ca2 =get_color(texture,vec2(z.x+v,z.y));66 c +=vec3(ca1.x,c.y,ca2.z); // chromatic aberration63 float v = aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0mask); 64 vec3 ca1 = get_color(texture,vec2(z.xv,z.y)); 65 vec3 ca2 = get_color(texture,vec2(z.x+v,z.y)); 66 c += vec3(ca1.x,c.y,ca2.z); // chromatic aberration 67 67 68 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 69 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 70 c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h 71 c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v 72 c*=mix(1.0,mask,vignetting); // vignetting 73 c*=letterbox(z,corner.x+2.0,corner.y,corner.z); // corner 74 gl_FragColor=vec4(c,1.0); 75 } 68 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 69 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 70 c *= scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h 71 c *= scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v 72 c *= mix(1.0,mask,vignetting); // vignetting 73 c *= letterbox(z,corner.x+2.0,corner.y,corner.z); // corner 74 gl_FragColor = vec4(c,1.0); 75 } 76
Note: See TracChangeset
for help on using the changeset viewer.