Changeset 1663


Ignore:
Timestamp:
Jul 24, 2012, 2:53:40 AM (7 years ago)
Author:
rez
Message:

fixed noise / added tons of control vars to postfx

Location:
trunk/tools/neercs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/neercs.cpp

    r1661 r1663  
    117117    caca_put_str(m_caca, logo_x + 3, logo_y    ,"__  _________ ______ ______ ______ ______");
    118118    caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 + M_PI / 4 * 1), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 1)), bg_color);
    119     caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/  \\/  /  __  >  __  >  __  >  ___//  ___/");
     119    caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/  \\/  /  __  >  __  >  __  >  ___//  ___/ \x0a9");
    120120    caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 + M_PI / 4 * 2), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 2)), bg_color);
    121121    caca_put_str(m_caca, logo_x + 1, logo_y + 2, "/      /  ____/  ____/  __  <  <____\\___  \\");
  • trunk/tools/neercs/video/postfx.lolfx

    r1661 r1663  
    1616uniform vec2 screen_size;
    1717uniform float time;
    18 uniform float flash;
    1918uniform float noise;
     19uniform float noise_h;
     20uniform float noise_v;
    2021uniform float aberration;
    2122uniform float deform;
    2223uniform bool scanline;
     24uniform float scanline_h_base;
     25uniform float scanline_h_var;
     26uniform float scanline_h_repeat_x;
     27uniform float scanline_h_repeat_y;
     28uniform float scanline_v_base;
     29uniform float scanline_v_var;
     30uniform float scanline_v_repeat_x;
     31uniform float scanline_v_repeat_y;
     32uniform float flash;
    2333uniform float sync;
    2434
     
    5969        float rnd1=rand(vec2(p.x+time,p.y-time));
    6070        float rnd2=rand(vec2(p.x-time,p.y+time));
    61         float d1=rnd1*noise/float(screen_size.x);
    62         float d2=rnd2*noise/float(screen_size.y);
     71        float d1=(noise_h-noise_h*2.0*rnd1)/float(screen_size.x);
     72        float d2=(noise_v-noise_v*2.0*rnd1)/float(screen_size.y);
    6373
    6474        vec3 source;
     
    7484        vec3 noise;
    7585        noise.x=get_color(texture,vec2(z.x+d1-v,z.y+d2)).x;
    76         noise.y=get_color(texture,vec2(z.x+d1  ,z.y-d2)).y;
    77         noise.z=get_color(texture,vec2(z.x+d1+v,z.y-d2)).z;
     86        noise.y=get_color(texture,vec2(z.x+d1  ,z.y+d2)).y;
     87        noise.z=get_color(texture,vec2(z.x+d1+v,z.y+d2)).z;
    7888
    7989        vec3 color=source+glass1*glass1*0.25+glass2*glass2*0.25+(scanline?noise:source);
     
    8393                {
    8494                color-=0.0125*mod(z.y*4.0+time*0.25,1.0);                                       // electron beam
    85                 color-=(vec3(rnd1,rnd1,rnd1)-vec3(rnd2,rnd2,rnd2))*0.1;         // noise
    86                 color*=0.75+0.25*cos(z.x*float(screen_size.x*2))*sin(0.5+z.y*float(screen_size.y));     // scanline w
    87                 color*=0.75+0.50*sin(z.y*float(screen_size.y*2));                       // scanline h
     95                color-=(vec3(rnd1,rnd1,rnd1)-vec3(rnd2,rnd2,rnd2))*noise;       // noise
     96                color*=scanline_h_base+scanline_h_var*cos(z.x*float(screen_size.x*scanline_h_repeat_x))*sin(z.y*float(screen_size.y*scanline_h_repeat_y));      // scanline w
     97                color*=scanline_v_base+scanline_v_var*sin(z.y*float(screen_size.x*scanline_v_repeat_x))*cos(z.y*float(screen_size.y*scanline_v_repeat_y));      // scanline h
    8898                }
    8999        else
     
    91101                color*=0.675;
    92102                }
    93         color=vec3(color.x*0.875,color.y*1.0,color.z*0.75);
     103        color=vec3(color.x*0.875,color.y*1.0,color.z*0.75);                             // hue
    94104        color*=mask;                                                                                                    // vignetting
    95105        color*=letterbox(z,-0.75,0.95);                                                                 // letterbox
  • trunk/tools/neercs/video/render.cpp

    r1661 r1663  
    8585ivec2 border;              // border width
    8686/* text variable */
    87 ivec2 ratio_2d(2,3);       // 2d ratio
     87ivec2 ratio_2d(1,4);       // 2d ratio
    8888ivec2 map_size(256,256);   // texture map size
    8989ivec2 font_size(8,8);      // font size
     
    9393float value, angle, radius, scale, speed;
    9494/* shader variable */
    95 int glow_fbo_size = 2;        // glow fbo size
    96 float glow_smoothstep = 0.0f; // glow smoothstep value (try 0.025f)
    97 float glow_mix_ratio1 = 0.5f; // glow mixing ratio
    98 float glow_mix_ratio2 = 0.5f; // source mixing ratio
    99 float radial_value1 = 2.0f;
    100 float radial_value2 = 0.8f;
    101 float radial_color = 0;       // color
    102 float postfx_deform = 0.625f; // deformation ratio
    103 float postfx_noise = 4.0f;    // noise
     95float remanency_source_mix = 0.25f;
     96float remanency_buffer_mix = 0.75f;
     97float remanency_new_frame_mix = 0.75f;
     98float remanency_old_frame_mix = 0.25f;
     99float blur_radius = 0.25f;      // glow radius
     100float blur_radius_deform = 0.625f;// glow radius deform
     101int glow_fbo_size = 2;          // glow fbo size
     102float glow_smoothstep = 0.0f;   // glow smoothstep value (try 0.025f)
     103float glow_mix_ratio1 = 0.375f; // glow mixing ratio
     104float glow_mix_ratio2 = 0.625f; // source mixing ratio
     105float glow_radius1 = 2.0f;      // large glow radius
     106float glow_radius2 = 1.0f;      // small glow radius
     107float glow_radius_deform1 = 3.0f;// large glow radius deform
     108float glow_radius_deform2 = 1.5f;// small glow radius deform
     109float postfx_deform = 0.625f;   // deformation ratio
     110float postfx_noise = 0.125f;    // global noise
     111float postfx_noise_h = 3.0f;    // horizontal noise
     112float postfx_noise_v = 3.0f;    // vertical noise
    104113float postfx_aberration = 3.0f; // chromatic aberration
    105 bool postfx_scanline = true;  // scanline
     114bool postfx_scanline = true;    // scanline
     115float postfx_scanline_h_base = 0.75f;
     116float postfx_scanline_h_var = 0.25f;
     117float postfx_scanline_h_repeat_x = 1.0f;
     118float postfx_scanline_h_repeat_y = 1.0f;
     119float postfx_scanline_v_base = 0.75f;
     120float postfx_scanline_v_var = 0.5f;
     121float postfx_scanline_v_repeat_x = 0.0f;
     122float postfx_scanline_v_repeat_y = 1.0f;
     123//float radial_value1 = 2.0f;
     124//float radial_value2 = 0.8f;
     125//float radial_color = 0;
    106126
    107127Shader *shader_simple;
     
    143163              shader_postfx_deform,
    144164              shader_postfx_noise,
     165              shader_postfx_noise_h,
     166              shader_postfx_noise_v,
    145167              shader_postfx_aberration,
    146168              shader_postfx_scanline,
     169              shader_postfx_scanline_h_base,
     170              shader_postfx_scanline_h_var,
     171              shader_postfx_scanline_h_repeat_x,
     172              shader_postfx_scanline_h_repeat_y,
     173              shader_postfx_scanline_v_base,
     174              shader_postfx_scanline_v_var,
     175              shader_postfx_scanline_v_repeat_x,
     176              shader_postfx_scanline_v_repeat_y,
    147177              shader_postfx_flash,
    148178              shader_postfx_sync;
     
    240270    shader_postfx_deform = shader_postfx->GetUniformLocation("deform");
    241271    shader_postfx_noise = shader_postfx->GetUniformLocation("noise");
     272    shader_postfx_noise_h = shader_postfx->GetUniformLocation("noise_h");
     273    shader_postfx_noise_v = shader_postfx->GetUniformLocation("noise_v");
    242274    shader_postfx_aberration = shader_postfx->GetUniformLocation("aberration");
    243275    shader_postfx_scanline = shader_postfx->GetUniformLocation("scanline");
     276    shader_postfx_scanline_h_base = shader_postfx->GetUniformLocation("scanline_h_base");
     277    shader_postfx_scanline_h_var = shader_postfx->GetUniformLocation("scanline_h_var");
     278    shader_postfx_scanline_h_repeat_x = shader_postfx->GetUniformLocation("scanline_h_repeat_x");
     279    shader_postfx_scanline_h_repeat_y = shader_postfx->GetUniformLocation("scanline_h_repeat_y");
     280    shader_postfx_scanline_v_base = shader_postfx->GetUniformLocation("scanline_v_base");
     281    shader_postfx_scanline_v_var = shader_postfx->GetUniformLocation("scanline_v_var");
     282    shader_postfx_scanline_v_repeat_x = shader_postfx->GetUniformLocation("scanline_v_repeat_x");
     283    shader_postfx_scanline_v_repeat_y = shader_postfx->GetUniformLocation("scanline_v_repeat_y");
    244284    shader_postfx_flash = shader_postfx->GetUniformLocation("flash");
    245285    shader_postfx_sync = shader_postfx->GetUniformLocation("sync");
     
    438478        shader_remanency->SetUniform(shader_remanency_screen_size, vec2(1.0f));
    439479        shader_remanency->SetUniform(shader_remanency_screen_color, screen_color);
    440         shader_remanency->SetUniform(shader_remanency_value1, 0.25f);
    441         shader_remanency->SetUniform(shader_remanency_value2, 0.75f);
     480        shader_remanency->SetUniform(shader_remanency_value1, remanency_source_mix);
     481        shader_remanency->SetUniform(shader_remanency_value2, remanency_buffer_mix);
    442482        fs_quad();
    443483        shader_remanency->Unbind();
     
    454494        shader_remanency->SetUniform(shader_remanency_screen_size, vec2(1.0f));
    455495        shader_remanency->SetUniform(shader_remanency_screen_color, screen_color);
    456         shader_remanency->SetUniform(shader_remanency_value1, 0.75f);
    457         shader_remanency->SetUniform(shader_remanency_value2, 0.25f);
     496        shader_remanency->SetUniform(shader_remanency_value1, remanency_new_frame_mix);
     497        shader_remanency->SetUniform(shader_remanency_value2, remanency_old_frame_mix);
    458498        fs_quad();
    459499        shader_remanency->Unbind();
     
    472512        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_back->GetTexture(), 0);
    473513        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f));
    474         shader_blur_h->SetUniform(shader_blur_h_blur, 0.25f / screen_size.x);
    475         shader_blur_h->SetUniform(shader_blur_h_deform, 0.375f / screen_size.x);
     514        shader_blur_h->SetUniform(shader_blur_h_blur, blur_radius / screen_size.x);
     515        shader_blur_h->SetUniform(shader_blur_h_deform, blur_radius_deform / screen_size.x);
    476516        fs_quad();
    477517        shader_blur_h->Unbind();
     
    482522        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_ping->GetTexture(), 0);
    483523        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f));
    484         shader_blur_v->SetUniform(shader_blur_v_blur, 0.25f / screen_size.y);
    485         shader_blur_v->SetUniform(shader_blur_v_deform, 0.375f / screen_size.y);
     524        shader_blur_v->SetUniform(shader_blur_v_blur, blur_radius / screen_size.y);
     525        shader_blur_v->SetUniform(shader_blur_v_deform, blur_radius_deform / screen_size.y);
    486526        fs_quad();
    487527        shader_blur_v->Unbind();
     
    502542        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_ping->GetTexture(), 0);
    503543        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f / glow_fbo_size));
    504         shader_blur_h->SetUniform(shader_blur_h_blur, 2.5f / screen_size.x);
    505         shader_blur_h->SetUniform(shader_blur_h_deform, 0.5f / screen_size.x);
     544        shader_blur_h->SetUniform(shader_blur_h_blur, glow_radius1 / screen_size.x);
     545        shader_blur_h->SetUniform(shader_blur_h_deform, glow_radius_deform1 / screen_size.x);
    506546        fs_quad();
    507547        shader_blur_h->Unbind();
     
    512552        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
    513553        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f / glow_fbo_size));
    514         shader_blur_v->SetUniform(shader_blur_v_blur, 2.5f / screen_size.y);
    515         shader_blur_v->SetUniform(shader_blur_v_deform, 0.5f / screen_size.y);
     554        shader_blur_v->SetUniform(shader_blur_v_blur, glow_radius1 / screen_size.y);
     555        shader_blur_v->SetUniform(shader_blur_v_deform, glow_radius_deform1 / screen_size.y);
    516556        fs_quad();
    517557        shader_blur_v->Unbind();
     
    522562        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_blur_v->GetTexture(), 0);
    523563        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f / glow_fbo_size));
    524         shader_blur_h->SetUniform(shader_blur_h_blur, 1.0f / screen_size.x);
    525         shader_blur_h->SetUniform(shader_blur_h_deform, 0.5f / screen_size.x);
     564        shader_blur_h->SetUniform(shader_blur_h_blur, glow_radius2 / screen_size.x);
     565        shader_blur_h->SetUniform(shader_blur_h_deform, glow_radius_deform2 / screen_size.x);
    526566        fs_quad();
    527567        shader_blur_h->Unbind();
     
    532572        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
    533573        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f / glow_fbo_size));
    534         shader_blur_v->SetUniform(shader_blur_v_blur, 1.0f / screen_size.y);
    535         shader_blur_h->SetUniform(shader_blur_v_deform, 0.5f / screen_size.y);
     574        shader_blur_v->SetUniform(shader_blur_v_blur, glow_radius2 / screen_size.y);
     575        shader_blur_h->SetUniform(shader_blur_v_deform, glow_radius_deform2 / screen_size.y);
    536576        fs_quad();
    537577        shader_blur_v->Unbind();
     
    566606        shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
    567607        shader_postfx->SetUniform(shader_postfx_noise, postfx_noise);
     608        shader_postfx->SetUniform(shader_postfx_noise_h, postfx_noise_h);
     609        shader_postfx->SetUniform(shader_postfx_noise_v, postfx_noise_v);
    568610        shader_postfx->SetUniform(shader_postfx_aberration, postfx_aberration);
    569611        shader_postfx->SetUniform(shader_postfx_scanline, postfx_scanline);
     612        shader_postfx->SetUniform(shader_postfx_scanline_h_base, postfx_scanline_h_base);
     613        shader_postfx->SetUniform(shader_postfx_scanline_h_var, postfx_scanline_h_var);
     614        shader_postfx->SetUniform(shader_postfx_scanline_h_repeat_x, postfx_scanline_h_repeat_x);
     615        shader_postfx->SetUniform(shader_postfx_scanline_h_repeat_y, postfx_scanline_h_repeat_y);
     616        shader_postfx->SetUniform(shader_postfx_scanline_v_base, postfx_scanline_v_base);
     617        shader_postfx->SetUniform(shader_postfx_scanline_v_var, postfx_scanline_v_var);
     618        shader_postfx->SetUniform(shader_postfx_scanline_v_repeat_x, postfx_scanline_v_repeat_x);
     619        shader_postfx->SetUniform(shader_postfx_scanline_v_repeat_y, postfx_scanline_v_repeat_y);
    570620        shader_postfx->SetUniform(shader_postfx_flash, flash_value);
    571621        shader_postfx->SetUniform(shader_postfx_sync, (float)fabs(beat_value*cosf((main_angle-beat_angle)*8.0f)));
Note: See TracChangeset for help on using the changeset viewer.