Changeset 1661 for trunk/tools


Ignore:
Timestamp:
Jul 22, 2012, 3:16:07 AM (11 years ago)
Author:
rez
Message:

new font / blur+chromatic aberration boosted on screen corners / various optimization in postfx

Location:
trunk/tools/neercs
Files:
1 added
7 edited

Legend:

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

    r1660 r1661  
    7979    m_time += seconds;
    8080
    81     /* draw something */
     81    /* draw something awesome */
    8282    int bg_color = 0x222;
    8383    int w = caca_get_canvas_width(m_caca);
     
    8787    caca_clear_canvas(m_caca);
    8888
    89     caca_set_color_argb(m_caca, 0xa46, bg_color);
     89    caca_set_color_argb(m_caca, 0x545, bg_color);
    9090    for(int i = 0; i < h; i++)
    9191    {
     
    106106    }
    107107
    108 /*
    109    __  _________ ______ ______ ______ ______
    110   /  \/  /  __  Y  __  Y  __  Y  ___//  ___/
     108/* __  _________ ______ ______ ______ ______
     109  /  \/  /  __  >  __  >  __  >  ___//  ___/ \x0a9
    111110 /      /  ____/  ____/  __  <  <____\___  \
    112 /__/\__/\_______________/  \________________\
    113 */
     111/__/\__/\_______________/  \________________\ */
    114112
    115113    int logo_x = (w - 46) / 2;
    116     int logo_y = h / 2 - 2;
     114    int logo_y = h / 2 - 2;// + h / 4 * lol::cos(m_time * 2);
    117115
    118116    caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3               ), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3               )), bg_color);
    119117    caca_put_str(m_caca, logo_x + 3, logo_y    ,"__  _________ ______ ______ ______ ______");
    120118    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);
    121     caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/  \\/  /  __  Y  __  Y  __  Y  ___//  ___/");
     119    caca_put_str(m_caca, logo_x + 2, logo_y + 1, "/  \\/  /  __  >  __  >  __  >  ___//  ___/");
    122120    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);
    123121    caca_put_str(m_caca, logo_x + 1, logo_y + 2, "/      /  ____/  ____/  __  <  <____\\___  \\");
  • trunk/tools/neercs/video/blurh.lolfx

    r1459 r1661  
    1515uniform sampler2D texture;
    1616uniform vec2 screen_size;
    17 uniform float time;
    18 uniform float value;
     17uniform float blur;
     18uniform float deform;
    1919
    20 float blur=value;
     20const float PI=3.14159265358979323846;
    2121
    2222void main(void)
     
    2424        vec4 total=vec4(0.0);
    2525        vec2 p=gl_TexCoord[0].xy/screen_size;
    26         total+=texture2D(texture,vec2(p.x-blur*4.0,p.y))*0.04;
    27         total+=texture2D(texture,vec2(p.x-blur*3.0,p.y))*0.08;
    28         total+=texture2D(texture,vec2(p.x-blur*2.0,p.y))*0.12;
    29         total+=texture2D(texture,vec2(p.x-blur    ,p.y))*0.16;
    30         total+=texture2D(texture,vec2(p.x         ,p.y))*0.20;
    31         total+=texture2D(texture,vec2(p.x+blur    ,p.y))*0.16;
    32         total+=texture2D(texture,vec2(p.x+blur*2.0,p.y))*0.12;
    33         total+=texture2D(texture,vec2(p.x+blur*3.0,p.y))*0.08;
    34         total+=texture2D(texture,vec2(p.x+blur*4.0,p.y))*0.04;
     26        float mask=2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
     27        float b=blur+deform*mask;
     28        total+=texture2D(texture,vec2(p.x-b*4.0,p.y))*0.04;
     29        total+=texture2D(texture,vec2(p.x-b*3.0,p.y))*0.08;
     30        total+=texture2D(texture,vec2(p.x-b*2.0,p.y))*0.12;
     31        total+=texture2D(texture,vec2(p.x-b    ,p.y))*0.16;
     32        total+=texture2D(texture,vec2(p.x      ,p.y))*0.20;
     33        total+=texture2D(texture,vec2(p.x+b    ,p.y))*0.16;
     34        total+=texture2D(texture,vec2(p.x+b*2.0,p.y))*0.12;
     35        total+=texture2D(texture,vec2(p.x+b*3.0,p.y))*0.08;
     36        total+=texture2D(texture,vec2(p.x+b*4.0,p.y))*0.04;
    3537        gl_FragColor=total;
    3638        }
  • trunk/tools/neercs/video/blurv.lolfx

    r1459 r1661  
    1515uniform sampler2D texture;
    1616uniform vec2 screen_size;
    17 uniform float time;
    18 uniform float value;
     17uniform float blur;
     18uniform float deform;
    1919
    20 float blur=value;
     20const float PI=3.14159265358979323846;
    2121
    2222void main(void)
     
    2424        vec4 total=vec4(0.0);
    2525        vec2 p=gl_TexCoord[0].xy/screen_size;
    26         total+=texture2D(texture,vec2(p.x,p.y-blur*4.0))*0.04;
    27         total+=texture2D(texture,vec2(p.x,p.y-blur*3.0))*0.08;
    28         total+=texture2D(texture,vec2(p.x,p.y-blur*2.0))*0.12;
    29         total+=texture2D(texture,vec2(p.x,p.y-blur    ))*0.16;
    30         total+=texture2D(texture,vec2(p.x,p.y         ))*0.20;
    31         total+=texture2D(texture,vec2(p.x,p.y+blur    ))*0.16;
    32         total+=texture2D(texture,vec2(p.x,p.y+blur*2.0))*0.12;
    33         total+=texture2D(texture,vec2(p.x,p.y+blur*3.0))*0.08;
    34         total+=texture2D(texture,vec2(p.x,p.y+blur*4.0))*0.04;
     26        float mask=2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
     27        float b=blur+deform*mask;
     28        total+=texture2D(texture,vec2(p.x,p.y-b*4.0))*0.04;
     29        total+=texture2D(texture,vec2(p.x,p.y-b*3.0))*0.08;
     30        total+=texture2D(texture,vec2(p.x,p.y-b*2.0))*0.12;
     31        total+=texture2D(texture,vec2(p.x,p.y-b    ))*0.16;
     32        total+=texture2D(texture,vec2(p.x,p.y      ))*0.20;
     33        total+=texture2D(texture,vec2(p.x,p.y+b    ))*0.16;
     34        total+=texture2D(texture,vec2(p.x,p.y+b*2.0))*0.12;
     35        total+=texture2D(texture,vec2(p.x,p.y+b*3.0))*0.08;
     36        total+=texture2D(texture,vec2(p.x,p.y+b*4.0))*0.04;
    3537        gl_FragColor=total;
    3638        }
  • trunk/tools/neercs/video/postfx.lolfx

    r1644 r1661  
    1717uniform float time;
    1818uniform float flash;
    19 uniform float value;
     19uniform float noise;
     20uniform float aberration;
    2021uniform float deform;
    2122uniform bool scanline;
     
    2324
    2425const float PI=3.14159265358979323846;
    25 float lens=deform+sync*0.0625;
    2626
    2727vec2 zoom(in vec2 p,in float radius)
    2828        {
    29         float zoom=1.5-(radius*cos(p.x*lens)+radius*cos(p.y*lens));
     29        float d=deform+sync*0.0625;
     30        float zoom=1.5-(radius*cos(p.x*d)+radius*cos(p.y*d));
    3031        return p*zoom-0.5;
    3132        }
     
    5455        vec2 z1=zoom(p,0.5225);
    5556        vec2 z2=zoom(p,0.5275);
    56         float g=(2.0-cos(lens*0.5+z.x*lens)-cos(lens*0.5+z.y*lens))*32.0;
     57        float mask=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);
    5758
    5859        float rnd1=rand(vec2(p.x+time,p.y-time));
    5960        float rnd2=rand(vec2(p.x-time,p.y+time));
    60         float d1=rnd1*value/float(screen_size.x);
    61         float d2=rnd2*value/float(screen_size.y);
     61        float d1=rnd1*noise/float(screen_size.x);
     62        float d2=rnd2*noise/float(screen_size.y);
    6263
    63         vec3 source;//=get_color(texture,z);
     64        vec3 source;
    6465        source.x=get_color(texture,vec2(z.x+d1,z.y)).x;
    6566        source.y=get_color(texture,vec2(z.x+d1,z.y)).y;
     
    6970        vec3 glass2=get_color(texture,z2);
    7071
    71         float v=value/float(screen_size.x)*g;
     72        float v=aberration/float(screen_size.x)+aberration/float(screen_size.x)*(2.0-mask);
    7273
    7374        vec3 noise;
     
    9192                }
    9293        color=vec3(color.x*0.875,color.y*1.0,color.z*0.75);
    93         color*=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);                                             // vignetting
    94         //color*=2.0*letterbox(z,-0.75,0.125)*2.0;                                              // vignetting
     94        color*=mask;                                                                                                    // vignetting
    9595        color*=letterbox(z,-0.75,0.95);                                                                 // letterbox
    9696        gl_FragColor=vec4(color,1.0);
  • trunk/tools/neercs/video/remanency.lolfx

    r1655 r1661  
    1616uniform sampler2D texture_buffer;
    1717uniform vec2 screen_size;
    18 uniform float time;
     18uniform float screen_color;
    1919uniform float value1;
    2020uniform float value2;
  • trunk/tools/neercs/video/render.cpp

    r1655 r1661  
    8585ivec2 border;              // border width
    8686/* text variable */
    87 ivec2 ratio_2d(2,4);       // 2d ratio
     87ivec2 ratio_2d(2,3);       // 2d ratio
    8888ivec2 map_size(256,256);   // texture map size
    8989ivec2 font_size(8,8);      // font size
     
    100100float radial_value2 = 0.8f;
    101101float radial_color = 0;       // color
    102 bool postfx_scanline = true;
    103102float postfx_deform = 0.625f; // deformation ratio
     103float postfx_noise = 4.0f;    // noise
     104float postfx_aberration = 3.0f; // chromatic aberration
     105bool postfx_scanline = true;  // scanline
    104106
    105107Shader *shader_simple;
     
    110112ShaderUniform shader_blur_h_texture,
    111113              shader_blur_h_screen_size,
    112               shader_blur_h_time,
    113               shader_blur_h_value;
     114              shader_blur_h_blur,
     115              shader_blur_h_deform;
    114116ShaderUniform shader_blur_v_texture,
    115117              shader_blur_v_screen_size,
    116               shader_blur_v_time,
    117               shader_blur_v_value;
     118              shader_blur_v_blur,
     119              shader_blur_v_deform;
    118120ShaderUniform shader_remanency_texture,
    119121              shader_remanency_texture_buffer,
    120122              shader_remanency_screen_size,
    121               shader_remanency_time,
     123              shader_remanency_screen_color,
    122124              shader_remanency_value1,
    123125              shader_remanency_value2;
     
    139141              shader_postfx_screen_size,
    140142              shader_postfx_time,
     143              shader_postfx_deform,
     144              shader_postfx_noise,
     145              shader_postfx_aberration,
     146              shader_postfx_scanline,
    141147              shader_postfx_flash,
    142               shader_postfx_value,
    143               shader_postfx_deform,
    144               shader_postfx_scanline,
    145148              shader_postfx_sync;
    146149
     
    196199    shader_blur_h_texture = shader_blur_h->GetUniformLocation("texture");
    197200    shader_blur_h_screen_size = shader_blur_h->GetUniformLocation("screen_size");
    198     shader_blur_h_time = shader_blur_h->GetUniformLocation("time");
    199     shader_blur_h_value = shader_blur_h->GetUniformLocation("value");
     201    shader_blur_h_blur = shader_blur_h->GetUniformLocation("blur");
     202    shader_blur_h_deform = shader_blur_h->GetUniformLocation("deform");
    200203    // shader blur vertical
    201204    shader_blur_v = Shader::Create(lolfx_blurv);
    202205    shader_blur_v_texture = shader_blur_v->GetUniformLocation("texture");
    203206    shader_blur_v_screen_size = shader_blur_v->GetUniformLocation("screen_size");
    204     shader_blur_v_time = shader_blur_v->GetUniformLocation("time");
    205     shader_blur_v_value = shader_blur_v->GetUniformLocation("value");
     207    shader_blur_v_blur = shader_blur_v->GetUniformLocation("blur");
     208    shader_blur_v_deform = shader_blur_v->GetUniformLocation("deform");
    206209    // shader remanency
    207210    shader_remanency = Shader::Create(lolfx_remanency);
     
    209212    shader_remanency_texture_buffer = shader_remanency->GetUniformLocation("texture_buffer");
    210213    shader_remanency_screen_size = shader_remanency->GetUniformLocation("screen_size");
    211     shader_remanency_time = shader_remanency->GetUniformLocation("time");
     214    shader_remanency_screen_color = shader_remanency->GetUniformLocation("screen_color");
    212215    shader_remanency_value1 = shader_remanency->GetUniformLocation("value1");
    213216    shader_remanency_value2 = shader_remanency->GetUniformLocation("value2");
     
    235238    shader_postfx_screen_size = shader_postfx->GetUniformLocation("screen_size");
    236239    shader_postfx_time = shader_postfx->GetUniformLocation("time");
     240    shader_postfx_deform = shader_postfx->GetUniformLocation("deform");
     241    shader_postfx_noise = shader_postfx->GetUniformLocation("noise");
     242    shader_postfx_aberration = shader_postfx->GetUniformLocation("aberration");
     243    shader_postfx_scanline = shader_postfx->GetUniformLocation("scanline");
    237244    shader_postfx_flash = shader_postfx->GetUniformLocation("flash");
    238     shader_postfx_value = shader_postfx->GetUniformLocation("value");
    239     shader_postfx_deform = shader_postfx->GetUniformLocation("deform");
    240     shader_postfx_scanline = shader_postfx->GetUniformLocation("scanline");
    241245    shader_postfx_sync = shader_postfx->GetUniformLocation("sync");
    242246
     
    266270    m_polygon(true),
    267271    m_shader(true),
     272    m_shader_remanency(true),
    268273    m_shader_blur(true),
    269     m_shader_remanency(true),
    270274    m_shader_glow(true),
    271275    m_shader_fx(true),
     
    433437        shader_remanency->SetTexture(shader_remanency_texture_buffer, fbo_buffer->GetTexture(), 1);
    434438        shader_remanency->SetUniform(shader_remanency_screen_size, vec2(1.0f));
    435         shader_remanency->SetUniform(shader_remanency_time, fx_angle);
     439        shader_remanency->SetUniform(shader_remanency_screen_color, screen_color);
    436440        shader_remanency->SetUniform(shader_remanency_value1, 0.25f);
    437441        shader_remanency->SetUniform(shader_remanency_value2, 0.75f);
     
    449453        shader_remanency->SetTexture(shader_remanency_texture_buffer, fbo_buffer->GetTexture(), 1);
    450454        shader_remanency->SetUniform(shader_remanency_screen_size, vec2(1.0f));
    451         shader_remanency->SetUniform(shader_remanency_time, fx_angle);
    452         shader_remanency->SetUniform(shader_remanency_value1, 0.25f);
    453         shader_remanency->SetUniform(shader_remanency_value2, 0.75f);
     455        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);
    454458        fs_quad();
    455459        shader_remanency->Unbind();
     
    468472        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_back->GetTexture(), 0);
    469473        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f));
    470         shader_blur_h->SetUniform(shader_blur_h_time, fx_angle);
    471         shader_blur_h->SetUniform(shader_blur_h_value, 0.375f/screen_size.x);
     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);
    472476        fs_quad();
    473477        shader_blur_h->Unbind();
     
    478482        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_ping->GetTexture(), 0);
    479483        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f));
    480         shader_blur_v->SetUniform(shader_blur_v_time, fx_angle);
    481         shader_blur_v->SetUniform(shader_blur_v_value, 0.375f/screen_size.y);
     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);
    482486        fs_quad();
    483487        shader_blur_v->Unbind();
     
    498502        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_ping->GetTexture(), 0);
    499503        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f / glow_fbo_size));
    500         shader_blur_h->SetUniform(shader_blur_h_time, fx_angle);
    501         shader_blur_h->SetUniform(shader_blur_h_value, 2.5f / screen_size.x);
     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);
    502506        fs_quad();
    503507        shader_blur_h->Unbind();
     
    508512        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
    509513        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f / glow_fbo_size));
    510         shader_blur_v->SetUniform(shader_blur_v_time, fx_angle);
    511         shader_blur_v->SetUniform(shader_blur_h_value, 2.5f / screen_size.y);
     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);
    512516        fs_quad();
    513517        shader_blur_v->Unbind();
     
    518522        shader_blur_h->SetTexture(shader_blur_h_texture, fbo_blur_v->GetTexture(), 0);
    519523        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f / glow_fbo_size));
    520         shader_blur_h->SetUniform(shader_blur_h_time, fx_angle);
    521         shader_blur_h->SetUniform(shader_blur_h_value, 1.0f / screen_size.x);
     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);
    522526        fs_quad();
    523527        shader_blur_h->Unbind();
     
    528532        shader_blur_v->SetTexture(shader_blur_v_texture, fbo_blur_h->GetTexture(), 0);
    529533        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f / glow_fbo_size));
    530         shader_blur_v->SetUniform(shader_blur_v_time, fx_angle);
    531         shader_blur_v->SetUniform(shader_blur_h_value, 1.0f / screen_size.y);
     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);
    532536        fs_quad();
    533537        shader_blur_v->Unbind();
     
    560564        shader_postfx->SetUniform(shader_postfx_screen_size, (vec2)screen_size);
    561565        shader_postfx->SetUniform(shader_postfx_time, fx_angle);
     566        shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
     567        shader_postfx->SetUniform(shader_postfx_noise, postfx_noise);
     568        shader_postfx->SetUniform(shader_postfx_aberration, postfx_aberration);
     569        shader_postfx->SetUniform(shader_postfx_scanline, postfx_scanline);
    562570        shader_postfx->SetUniform(shader_postfx_flash, flash_value);
    563         shader_postfx->SetUniform(shader_postfx_value, 4.0f);
    564         shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
    565         shader_postfx->SetUniform(shader_postfx_scanline, postfx_scanline);
    566571        shader_postfx->SetUniform(shader_postfx_sync, (float)fabs(beat_value*cosf((main_angle-beat_angle)*8.0f)));
    567572        fs_quad();
  • trunk/tools/neercs/video/text-render.cpp

    r1655 r1661  
    4141void TextRender::Init()
    4242{
    43     m_font = new TileSet("tools/neercs/video/resource/charset_amiga.png",
     43    m_font = new TileSet("tools/neercs/video/resource/charset_p0t-noodle.png",
    4444                         ivec2(256, 256), ivec2(1));
    4545
     
    170170    glEnd();
    171171}
    172 
Note: See TracChangeset for help on using the changeset viewer.