Bladeren bron

NEERCS: tweaked color filtering (still lame result)

master
rez Sam Hocevar <sam@hocevar.net> 12 jaren geleden
bovenliggende
commit
079dee1198
3 gewijzigde bestanden met toevoegingen van 40 en 39 verwijderingen
  1. +6
    -5
      neercs/video/color.lolfx
  2. +8
    -8
      neercs/video/postfx.lolfx
  3. +26
    -26
      neercs/video/render.cpp

+ 6
- 5
neercs/video/color.lolfx Bestand weergeven

@@ -15,7 +15,7 @@ void main()
uniform sampler2D texture;
uniform vec2 screen_size;
uniform vec3 filter;
uniform vec3 color;
uniform vec4 color;
uniform float flash;

void main(void)
@@ -24,10 +24,11 @@ void main(void)
vec3 c=texture2D(texture,p).xyz;

float a=(c.x+c.y+c.z)/3.0;
c=mix(c,vec3(a),color.z); // grayscale
c*=filter; // filter
c*=color.x; // brightness
c=0.5+(c-0.5)*color.y; // contrast
c=mix(c,vec3(a),color.w); // grayscale
c*=filter; // filter
c+=color.z; // level
c*=color.x; // brightness
c=0.5+(c-0.5)*color.y; // contrast
c+=flash; // flash

gl_FragColor=vec4(c,1.0);

+ 8
- 8
neercs/video/postfx.lolfx Bestand weergeven

@@ -58,18 +58,18 @@ void main(void)
vec3 g1=get_color(texture,z1-ghost1.xy);
vec3 g2=get_color(texture,z2-ghost2.xy);

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);
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*=(mask-vignetting); // vignetting
c*=letterbox(z,corner.x+2.0,corner.y,corner.z); // corner
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);
}

+ 26
- 26
neercs/video/render.cpp Bestand weergeven

@@ -89,24 +89,24 @@ float value, angle, radius, scale, speed;
/* shader variable */
vec2 buffer(0.7f,0.3f); // [new frame mix,old frame mix]
vec2 remanency(0.5f,0.5f); // remanency [source mix,buffer mix]
vec2 glow_mix(0.6f,0.4f); // glow mix [source mix,glow mix]
vec2 glow_large(2.0f,2.0f); // large glow radius [center,corner]
vec2 glow_small(1.0f,1.0f); // small glow radius [center,corner]
vec2 blur(0.5f,0.5f); // blur radius [center,corner]
vec2 glow_mix(0.5f,0.5f); // glow mix [source mix,glow mix]
vec2 glow_large(3.0f,0.0f); // large glow radius [center,corner]
vec2 glow_small(1.5f,0.0f); // small glow radius [center,corner]
vec2 blur(0.5f,0.0f); // blur radius [center,corner]
vec4 copper(0.125,0.125,32,64); // copper [base,variable,repeat x,repeat y]
vec3 color_filter(0.9f,0.9f,1.0f); // color filter [red,green,blue]
vec3 color_color(1.0f,1.0f,0.40f); // color modifier [brightness,contrast,grayscale]
vec4 color_color(1.25f,1.0f,0.0f,0.35f); // color modifier [brightness,contrast,level,grayscale]
vec2 noise_offset(2.0f,2.0f); // random line [horizontal,vertical]
float noise_noise = 0.25f; // noise
vec3 noise_retrace(1.0f,1.0f,0.5f); // retrace [strength,length,speed]
vec2 postfx_deform(0.7f,0.54f); // deformation [ratio,zoom]
float postfx_vignetting = -0.5f; // vignetting strength
float postfx_aberration = 3.0f; // chromatic aberration
float postfx_vignetting = 0.0f; // vignetting strength
float postfx_aberration = 4.0f; // chromatic aberration
vec4 postfx_ghost1(0.0f,0.0f,-2.0f,-0.15f); // ghost picture 1 [position x,position y,position z,strength]
vec4 postfx_ghost2(0.0f,0.0f,2.0f,0.15f); // ghost picture 2 [position x,position y,position z,strength]
vec4 postfx_moire_h(0.75f,-0.25f,0.0f,1.0f); // vertical moire [base,variable,repeat,shift]
vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f); // horizontal moire [base,variable,repeat,shift]
vec4 postfx_scanline_h(0.75f, 0.25f,0.0f,2.0f); // vertical scanline [base,variable,repeat,shift]
vec4 postfx_scanline_h(0.75f,0.0f,0.0f,0.0f); // vertical scanline [base,variable,repeat,shift]
vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f); // horizontal scanline [base,variable,repeat,shift]
vec3 postfx_corner(0.0f,0.75f,0.95f); // corner [width,radius,blur]
/* text variable */
@@ -184,9 +184,9 @@ char const *setup_text[] = {
"filter blue",
"brightness",
"contrast",
"level",
"grayscale",
"aberration",
"",
"noise",
"enable",
"offset h",
@@ -263,23 +263,23 @@ vec4 setup_var[]={ // setup variable [start,end,step,value]
vec4(0),
vec4(0),
vec4(0), /* screen */
vec4( 0, 1, 1, 1),
vec4( 0.0f, 1.0f, 0.05f, postfx_deform.x),
vec4( 0.5f, 0.7f, 0.01f, postfx_deform.y),
vec4( 0.0f, 4.0f, 0.10f, postfx_corner.x),
vec4( 0.0f, 1.0f, 0.05f, postfx_corner.y),
vec4( 0.0f, 1.0f, 0.05f, postfx_corner.z),
vec4(-1.0f, 1.0f, 0.10f, postfx_vignetting),
vec4(0, 1, 1, 1),
vec4(0.0f, 1.0f, 0.05f, postfx_deform.x),
vec4(0.5f, 0.7f, 0.01f, postfx_deform.y),
vec4(0.0f, 4.0f, 0.10f, postfx_corner.x),
vec4(0.0f, 1.0f, 0.05f, postfx_corner.y),
vec4(0.0f, 1.0f, 0.05f, postfx_corner.z),
vec4(0.0f, 1.0f, 0.10f, postfx_vignetting),
vec4(0),
vec4(0), /* color */
vec4(0.0f, 1.0f, 0.05f, color_filter.x),
vec4(0.0f, 1.0f, 0.05f, color_filter.y),
vec4(0.0f, 1.0f, 0.05f, color_filter.z),
vec4(0.0f, 2.0f, 0.05f, color_color.x),
vec4(0.0f, 2.0f, 0.05f, color_color.y),
vec4(0.0f, 1.0f, 0.05f, color_color.z),
vec4(0.0f, 8.0f, 0.50f, postfx_aberration),
vec4(0),
vec4( 0.0f, 1.0f, 0.05f, color_filter.x),
vec4( 0.0f, 1.0f, 0.05f, color_filter.y),
vec4( 0.0f, 1.0f, 0.05f, color_filter.z),
vec4( 0.0f, 2.0f, 0.05f, color_color.x),
vec4( 0.0f, 2.0f, 0.05f, color_color.y),
vec4(-1.0f, 1.0f, 0.05f, color_color.z),
vec4( 0.0f, 1.0f, 0.05f, color_color.w),
vec4( 0.0f, 8.0f, 0.50f, postfx_aberration),
vec4(0), /* noise */
vec4( 0, 1, 1, 1),
vec4(0.0f, 4.0f, 0.50f, noise_offset.x),
@@ -343,9 +343,9 @@ void Render::UpdateVar()
postfx_vignetting = setup_var[k].w; k++;
k += 2; /* color */
color_filter = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
color_color = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
color_color = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
postfx_aberration = setup_var[k].w; k++;
k += 2; /* noise */
k += 1; /* noise */
m_shader_noise = (setup_var[k].w == 1) ? true : false; k++;
noise_offset = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
noise_noise = setup_var[k].w; k++;


Laden…
Annuleren
Opslaan