Ignore:
Timestamp:
Jul 30, 2012, 2:11:32 AM (9 years ago)
Author:
rez
Message:

moved blur after glow, tweaked a lot of parameters

File:
1 edited

Legend:

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

    r1672 r1683  
    7373float fade_speed = 0.2f;   // speed
    7474/* sync variable */
    75 bool sync_flag = false;    // flag
     75bool sync_flag = false;    // flagsh
    7676float sync_angle = 0;      // angle
    7777float sync_value = 1.0f;   // value
     
    9595vec2 buffer(0.75f,0.25f);       // [new frame mix,old frame mix]
    9696vec2 remanency(0.25f,0.75f);    // remanency [source mix,buffer mix]
    97 vec2 blur(0.5f,1.0f);           // glow radius [normal,deform]
    98 vec3 glow_mix(1.0f,0.0f,0.025f);// glow mix [glow mix,source mix,source smoothstep]
    99 vec2 glow_large(4.0f,6.0f);     // large glow radius [normal,deform]
    100 vec2 glow_small(2.0f,4.0f);     // small glow radius [normal,deform]
     97vec2 blur(0.25f,0.5f);          // glow radius [normal,deform]
     98vec2 glow_mix(0.5f,0.5f);       // glow mix [glow mix,source mix]
     99vec2 glow_large(2.0f,2.0f);     // large glow radius [normal,deform]
     100vec2 glow_small(1.0f,1.0f);     // small glow radius [normal,deform]
    101101//vec3 radial(2.0f,0.8f,0);     // radial [mix,strength,color mode]
    102102//---------------------------------[IDEAS] http://www.youtube.com/watch?v=d1qEP2vMe-I
     
    105105vec3 postfx_retrace(0.025f,2.0f,4.0f);// retrace [color,length,speed]
    106106vec2 postfx_offset(3.0f,3.0f);  // random line [horizontal,vertical]
    107 vec2 postfx_noise(0,0.125f);    // noise [0=grey/1=color,mix]
     107float postfx_noise = 0.125f;    // noise
    108108float postfx_aberration = 3.0f; // chromatic aberration
    109109bool postfx_moire = true;       // moire
    110110vec4 postfx_moire_h(0.75f,-0.25f,1.0f,2.0f);
    111 vec4 postfx_moire_v(0.875f,-0.125f,0.5f,2.0f);
     111vec4 postfx_moire_v(0.75f,-0.25f,0.0f,1.0f);
    112112bool postfx_scanline = true;    // scanline
    113 vec4 postfx_scanline_h(0.75f,-0.5f,2.0f,0.0f);// vertical scanline [base,variable,repeat]
    114 vec4 postfx_scanline_v(1.0f,0.0f,0.0f,0.0f);  // horizontal scanline [base,variable,repeat]
     113vec4 postfx_scanline_h(0.75f,-0.25f,2.0f,0.0f);// vertical scanline [base,variable,repeat]
     114vec4 postfx_scanline_v(0.75f, 0.25f,0.0f,2.0f);// horizontal scanline [base,variable,repeat]
    115115
    116116Shader *shader_simple;
     
    120120ShaderUniform shader_simple_texture;
    121121ShaderUniform shader_blur_h_texture,
    122               shader_blur_h_radius;
    123 ShaderUniform shader_blur_v_texture,
     122              shader_blur_h_radius,
     123              shader_blur_v_texture,
    124124              shader_blur_v_radius;
    125125ShaderUniform shader_remanency_source,
     
    194194    fbo_front = new FrameBuffer(screen_size);
    195195    fbo_buffer = new FrameBuffer(screen_size);
    196     fbo_blur_h = new FrameBuffer(screen_size / 2);
    197     fbo_blur_v = new FrameBuffer(screen_size / 2);
     196    fbo_blur_h = new FrameBuffer(screen_size);
     197    fbo_blur_v = new FrameBuffer(screen_size);
    198198    fbo_ping = new FrameBuffer(screen_size);
    199199    fbo_pong = new FrameBuffer(screen_size);
     
    274274    m_shader(true),
    275275    m_shader_remanency(true),
     276    m_shader_glow(true),
    276277    m_shader_blur(true),
    277     m_shader_glow(true),
    278278    m_shader_fx(true),
    279279    m_shader_postfx(true),
     
    462462    }
    463463
     464    // shader glow
     465    if (m_shader_fx && m_shader_glow)
     466    {
     467        // shader blur horizontal
     468        fbo_blur_h->Bind();
     469        shader_blur_h->Bind();
     470        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_back->GetTexture(), 0);
     471        shader_blur_h->SetUniform(shader_blur_h_radius, glow_large / screen_size.x);
     472        fs_quad();
     473        shader_blur_h->Unbind();
     474        fbo_blur_h->Unbind();
     475        // shader blur vertical
     476        fbo_blur_v->Bind();
     477        shader_blur_v->Bind();
     478        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
     479        shader_blur_v->SetUniform(shader_blur_v_radius, glow_large / screen_size.y);
     480        fs_quad();
     481        shader_blur_v->Unbind();
     482        fbo_blur_v->Unbind();
     483        // shader blur horizontal
     484        fbo_blur_h->Bind();
     485        shader_blur_h->Bind();
     486        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_blur_v->GetTexture(), 0);
     487        shader_blur_h->SetUniform(shader_blur_h_radius, glow_small / screen_size.x);
     488        fs_quad();
     489        shader_blur_h->Unbind();
     490        fbo_blur_h->Unbind();
     491        // shader blur vertical
     492        fbo_blur_v->Bind();
     493        shader_blur_v->Bind();
     494        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
     495        shader_blur_v->SetUniform(shader_blur_v_radius, glow_small / screen_size.y);
     496        fs_quad();
     497        shader_blur_v->Unbind();
     498        fbo_blur_v->Unbind();
     499        // shader glow
     500        fbo_front->Bind();
     501        shader_glow->Bind();
     502        shader_glow->SetTexture(shader_glow_glow, fbo_blur_v->GetTexture(), 0);
     503        shader_glow->SetTexture(shader_glow_source, fbo_back->GetTexture(), 1);
     504        shader_glow->SetUniform(shader_glow_mix, glow_mix);
     505        fs_quad();
     506        shader_glow->Unbind();
     507        fbo_front->Unbind();
     508    }
     509    else
     510    {
     511        // shader simple
     512        fbo_front->Bind();
     513        draw_shader_simple(fbo_back, 0);
     514        fbo_front->Unbind();
     515    }
     516
    464517    if (m_shader_fx && m_shader_blur)
    465518    {
     
    467520        fbo_ping->Bind();
    468521        shader_blur_h->Bind();
    469         shader_blur_h->SetTexture(shader_blur_h_texture, fbo_back->GetTexture(), 0);
     522        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_front->GetTexture(), 0);
    470523        shader_blur_h->SetUniform(shader_blur_h_radius, blur / screen_size.x);
    471524        fs_quad();
     
    479532        fs_quad();
    480533        shader_blur_v->Unbind();
    481     }
    482     else
    483     {
    484         // shader simple
    485         fbo_front->Bind();
    486         draw_shader_simple(fbo_back, 0);
    487     }
    488     fbo_front->Unbind();
    489     // shader glow
    490     if (m_shader_fx && m_shader_glow)
    491     {
    492         // shader blur horizontal
    493         fbo_blur_h->Bind();
    494         shader_blur_h->Bind();
    495         shader_blur_h->SetTexture(shader_blur_h_texture, fbo_ping->GetTexture(), 0);
    496         shader_blur_h->SetUniform(shader_blur_h_radius, glow_large / screen_size.x);
    497         fs_quad();
    498         shader_blur_h->Unbind();
    499         fbo_blur_h->Unbind();
    500         // shader blur vertical
    501         fbo_blur_v->Bind();
    502         shader_blur_v->Bind();
    503         shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
    504         shader_blur_v->SetUniform(shader_blur_v_radius, glow_large / screen_size.y);
    505         fs_quad();
    506         shader_blur_v->Unbind();
    507         fbo_blur_v->Unbind();
    508         // shader blur horizontal
    509         fbo_blur_h->Bind();
    510         shader_blur_h->Bind();
    511         shader_blur_h->SetTexture(shader_blur_h_texture, fbo_blur_v->GetTexture(), 0);
    512         shader_blur_h->SetUniform(shader_blur_h_radius, glow_small / screen_size.x);
    513         fs_quad();
    514         shader_blur_h->Unbind();
    515         fbo_blur_h->Unbind();
    516         // shader blur vertical
    517         fbo_blur_v->Bind();
    518         shader_blur_v->Bind();
    519         shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
    520         shader_blur_v->SetUniform(shader_blur_v_radius, glow_small / screen_size.y);
    521         fs_quad();
    522         shader_blur_v->Unbind();
    523         fbo_blur_v->Unbind();
    524         // shader glow
    525         fbo_pong->Bind();
    526         shader_glow->Bind();
    527         shader_glow->SetTexture(shader_glow_glow, fbo_blur_v->GetTexture(), 0);
    528         shader_glow->SetTexture(shader_glow_source, fbo_front->GetTexture(), 1);
    529         shader_glow->SetUniform(shader_glow_mix, glow_mix);
    530         fs_quad();
    531         shader_glow->Unbind();
    532     }
    533     if (!m_shader_fx)
    534     {
    535         // shader simple
    536         fbo_pong->Bind();
    537         draw_shader_simple(fbo_front, 0);
    538     }
    539     fbo_pong->Unbind();
     534        fbo_front->Unbind();
     535    }
     536
    540537    if (m_shader_postfx)
    541538    {
    542539        // shader postfx
    543540        shader_postfx->Bind();
    544         shader_postfx->SetTexture(shader_postfx_texture, fbo_pong->GetTexture(), 0);
     541        shader_postfx->SetTexture(shader_postfx_texture, fbo_front->GetTexture(), 0);
    545542        shader_postfx->SetUniform(shader_postfx_screen_size, (vec2)screen_size);
    546543        shader_postfx->SetUniform(shader_postfx_time, fx_angle);
     
    565562    {
    566563        // shader simple
    567         draw_shader_simple(fbo_pong, 0);
     564        draw_shader_simple(fbo_front, 0);
    568565    }
    569566
Note: See TracChangeset for help on using the changeset viewer.