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

fixed noise / added tons of control vars to postfx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.