Changeset 1683


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

moved blur after glow, tweaked a lot of parameters

Location:
trunk/tools/neercs
Files:
4 edited

Legend:

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

    r1663 r1683  
    9292        float a = M_PI / 180 * i * 16 + m_time * 4;
    9393        float b = M_PI / 180 * i * 12;
    94         int x = w / 2  - 15 + h / 3 * lol::cos(a) + h / 4 * lol::sin(b);
    95         caca_put_str(m_caca, x, i, "LOL WUT! NEERCS SI TEH RULEZ!");
     94        int x = w / 2  - 14 + w / 4 * lol::cos(a) + w / 4 * lol::sin(b);
     95        caca_put_str(m_caca, x, i, "LOL WUT! NEERCS SI TEH RULEZ");
    9696    }
    9797
     
    131131    caca_set_color_argb(m_caca, hex_color(0.6f + 0.4f * lol::cos(m_time * 2), 0.2f, 0.2f), bg_color);
    132132    caca_put_str(m_caca, w - 12, h - 2, "CACA RULEZ");
     133
     134    caca_set_color_argb(m_caca, 0xdef, bg_color);
     135    caca_put_str(m_caca, 0, 0, "mdr@lol:~/ cd code/lolengine/");
     136    caca_put_str(m_caca, 0, 1, "mdr@lol:~/code/lolengine/ cd /var/log/");
     137    caca_put_str(m_caca, 0, 2, "mdr@lol:/var/log/");
    133138}
    134139
  • trunk/tools/neercs/video/glow.lolfx

    r1672 r1683  
    1515uniform sampler2D glow;
    1616uniform sampler2D source;
    17 uniform vec3 mix;
     17uniform vec2 mix;
    1818
    1919void main(void)
    2020        {
    21         gl_FragColor=smoothstep(mix.z,1.0,texture2D(source,gl_TexCoord[0].xy))*mix.x+texture2D(glow,gl_TexCoord[0].xy)*mix.y;
     21        gl_FragColor=texture2D(source,gl_TexCoord[0].xy)*mix.x+texture2D(glow,gl_TexCoord[0].xy)*mix.y;
    2222        }
  • trunk/tools/neercs/video/postfx.lolfx

    r1666 r1683  
    2020uniform vec3 retrace;
    2121uniform vec2 offset;
    22 uniform vec2 noise;
     22uniform float noise;
    2323uniform float aberration;
    2424uniform bool moire;
     
    8181        vec3 color=source+glass1*glass1*0.25+glass2*glass2*0.25;
    8282
     83        color=smoothstep(0.05,1.0,color);
    8384        color+=flash;                                                                                                   // flash
    8485        color+=ca;                                                                                                              // chromatic aberration
    8586        color-=retrace.x*mod(z.y*retrace.y+time*retrace.z,1.0);                 // retrace
    86         color-=(vec3(rnd.x,rnd.x,rnd.x)-vec3(rnd.y,rnd.y,rnd.y))*noise.y;// noise
     87        color-=(vec3(rnd.x-rnd.y))*noise;                                                               // noise
    8788        if(moire)
    8889                {
     
    103104                color*=(scanline_h.x+scanline_v.x)*0.5;
    104105                }
    105         color*=filter;                                                                                                  // hue
     106        color*=filter;                                                                                                  // filter
    106107        color*=mask;                                                                                                    // vignetting
    107108        color*=letterbox(z,-0.75,0.95);                                                                 // letnoiseterbox
  • 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.