Changeset 1736


Ignore:
Timestamp:
Aug 14, 2012, 2:43:49 AM (7 years ago)
Author:
rez
Message:

added TONS of new parameters into the setup menu

Location:
trunk/tools/neercs/video
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/video/postfx.lolfx

    r1694 r1736  
    1616uniform vec2 screen_size;
    1717uniform float time;
    18 uniform float deform;
     18uniform vec2 deform;
     19uniform vec4 ghost;
    1920uniform vec3 filter;
    2021uniform vec3 color;
     
    2324uniform float noise;
    2425uniform float aberration;
    25 uniform bool moire;
    2626uniform vec4 moire_h;
    2727uniform vec4 moire_v;
    28 uniform bool scanline;
    2928uniform vec4 scanline_h;
    3029uniform vec4 scanline_v;
     30uniform vec2 corner;
    3131uniform float flash;
    3232uniform float sync;
     
    3434const float PI=3.14159265358979323846;
    3535
    36 vec2 zoom(in vec2 p,in float radius)
     36vec2 screen(in vec2 p,in float radius)
    3737        {
    38         float d=deform+sync*0.0625;
    39         float zoom=1.5-(radius*cos(p.x*d)+radius*cos(p.y*d));
    40         return p*zoom-0.5;
     38        float d=deform.x+sync*0.0625;
     39        return p*(1.5-(radius*cos(p.x*d)+radius*cos(p.y*d)))-0.5;
    4140        }
    4241
     
    5352float letterbox(in vec2 p,in float radius,in float smooth)
    5453        {
    55         return 1.0-smoothstep(smooth,1.0,length(max(abs(p*2.0+1.0)+vec2(radius),0.0))-radius);
     54        return 1.0-smoothstep(smooth,1.0,length(max(abs(p*2.0+1.0)-vec2(radius),0.0))+radius);
    5655        }
    5756
     
    6160        vec2 p=-1.0+2.0*gl_FragCoord.xy/screen_size.xy;
    6261        p.y+=0.025*sync;
    63         vec2 z =zoom(p,0.5250);
    64         vec2 z1=zoom(p,0.5225);
    65         vec2 z2=zoom(p,0.5275);
     62        vec2 z =screen(p,deform.y);
     63        vec2 z1=screen(p,deform.y-ghost.x*0.1);
     64        vec2 z2=screen(p,deform.y+ghost.z*0.1);
    6665        float mask=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);
    6766
     
    8079        ca.z=get_color(texture,vec2(z.x+o.x+v,z.y+o.y)).z;
    8180
    82         vec3 c=source+glass1*glass1*0.25+glass2*glass2*0.25;
     81        vec3 c=source-glass1*glass1*ghost.y+glass2*glass2*ghost.w;
    8382
    8483        float a=(c.x+c.y+c.z)/3.0;
     
    9392        c-=retrace.x*mod(z.y*retrace.y+time*retrace.z,1.0);             // retrace
    9493        c-=(vec3(rnd.x-rnd.y))*noise;                                                   // noise
    95         if(moire)
    96                 {
    97                 c*=moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z))*sin(0.5+z.x*float(screen_size.x*moire_h.w));     // moire h
    98                 c*=moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z))*sin(0.5+z.y*float(screen_size.y*moire_v.w));     // moire v
    99                 }
    100         else
    101                 {
    102                 c*=(moire_h.x+moire_v.x)*0.5;
    103                 }
    104         if(scanline)
    105                 {
    106                 c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w));   // scanline h
    107                 c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w));   // scanline v
    108                 }
    109         else
    110                 {
    111                 c*=(scanline_h.x+scanline_v.x)*0.5;
    112                 }
     94        c*=moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z))*sin(0.5+z.x*float(screen_size.x*moire_h.w));     // moire h
     95        c*=moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z))*sin(0.5+z.y*float(screen_size.y*moire_v.w));     // moire v
     96        c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w));   // scanline h
     97        c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w));   // scanline v
    11398        c*=mask;                                                                                                // vignetting
    114         c*=letterbox(z,-0.75,0.95);                                                             // letnoiseterbox
     99        c*=letterbox(z,corner.x,corner.y);                                              // letterbox
    115100        gl_FragColor=vec4(c,1.0);
    116101        }
  • trunk/tools/neercs/video/render.cpp

    r1711 r1736  
    9696bool setup_switch=false;        // switch [option/item]
    9797int setup_option=0;             // selected option
    98 int setup_option_n=7;           // option number
     98int setup_option_n=9;           // option number
    9999int setup_item=0;               // selected item
    100100int setup_item_n=8;             // item number
     
    131131        "",
    132132        "",
     133    "screen",
     134        "enable",
     135        "deform ratio",
     136        "zoom base",
     137        "zoom variable",
     138        "corner radius",
     139        "corner blur",
     140        "",
     141        "",
    133142    "color",
    134         "postfx enable",
    135143        "filter red",
    136144        "filter green",
     
    140148        "grayscale",
    141149        "",
    142     "modifier",
    143         "deform ratio",
    144         "retrace strength",
    145         "retrace length",
    146         "retrace speed",
    147         "",
    148         "",
    149         "",
    150150        "",
    151151    "noise",
     
    154154        "noise",
    155155        "aberration",
     156        "retrace strength",
     157        "retrace length",
     158        "retrace speed",
     159        "",
     160    "ghost",
     161        "back distance",
     162        "back strength",
     163        "front distance",
     164        "front strength",
    156165        "",
    157166        "",
     
    182191vec2 buffer(0.7f,0.3f);         // [new frame mix,old frame mix]
    183192vec2 remanency(0.3f,0.7f);      // remanency [source mix,buffer mix]
    184 vec2 glow_mix(0.5f,0.5f);       // glow mix [source mix,glow mix]
     193vec2 glow_mix(0.6f,0.4f);       // glow mix [source mix,glow mix]
    185194vec2 glow_large(2.0f,2.0f);     // large glow radius [center,corner]
    186195vec2 glow_small(1.0f,1.0f);     // small glow radius [center,corner]
     
    188197//vec3 radial(2.0f,0.8f,0);     // radial [mix,strength,color mode]
    189198//------------------------------// [IDEAS] http://www.youtube.com/watch?v=d1qEP2vMe-I
    190 float postfx_deform = 0.7f;     // deformation ratio
    191 vec3 postfx_filter(0.8f,0.9f,0.4f);// color filter [red,green,blue]
    192 vec3 postfx_color(1.8f,1.8f,0.5f);    // color modifier [brightness,contrast,grayscale]
     199vec2 postfx_deform(0.7f,0.54f); // deformation [ratio,zoom]
     200vec3 postfx_filter(0.8f,0.9f,0.4f);   // color filter [red,green,blue]
     201vec3 postfx_color(1.8f,1.5f,0.5f);    // color modifier [brightness,contrast,grayscale]
     202vec2 postfx_corner(0.75f,0.95f);      // corner [radius,blur]
    193203vec3 postfx_retrace(0.05f,2.0f,4.0f); // retrace [strength,length,speed]
    194204vec2 postfx_offset(3.0f,3.0f);  // random line [horizontal,vertical]
    195205float postfx_noise = 0.15f;     // noise
    196206float postfx_aberration = 3.0f; // chromatic aberration
    197 bool postfx_moire = true;       // moire
    198 vec4 postfx_moire_h(0.75f,-0.25f,0.0f,1.0f);
    199 vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f);
    200 bool postfx_scanline = true;    // scanline
    201 vec4 postfx_scanline_h(0.75f, 0.25f,0.0f,2.0f);// vertical scanline [base,variable,repeat x,repeat y]
    202 vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f);// horizontal scanline [base,variable,repeat x,repeat y]
     207vec4 postfx_ghost(0.1f,0.25f,0.1f,0.5f);        // ghost picture [distance,strength,distance,strength]
     208vec4 postfx_moire_h(0.75f,-0.25f,0.0f,1.0f);    // vertical moire [base,variable,repeat x,repeat y]
     209vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f);    // horizontal moire [base,variable,repeat x,repeat y]
     210vec4 postfx_scanline_h(0.75f, 0.25f,0.0f,2.0f); // vertical scanline [base,variable,repeat x,repeat y]
     211vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f); // horizontal scanline [base,variable,repeat x,repeat y]
    203212//------------------------------//
    204213vec4 setup_var[]={
     
    213222        vec4(0),
    214223    vec4(0), /* glow */
    215         vec4(0, 1, 1, 0),
     224        vec4(0, 1, 1, 1),
    216225        vec4(0.0f, 1.0f, 0.1f, glow_mix.x),
    217226        vec4(0.0f, 1.0f, 0.1f, glow_mix.y),
     
    222231        vec4(0),
    223232    vec4(0), /* blur */
    224         vec4(0, 1, 1, 0),
     233        vec4(0, 1, 1, 1),
    225234        vec4(0.0f, 2.0f, 0.1f, blur.x),
    226235        vec4(0.0f, 2.0f, 0.1f, blur.y),
     
    230239        vec4(0),
    231240        vec4(0),
     241    vec4(0), /* screen */
     242        vec4(0, 1, 1, 1),
     243        vec4(0.0f, 1.0f, 0.05f, postfx_deform.x),
     244        vec4(0.5f, 0.7f, 0.01f, postfx_deform.y),
     245        vec4(0.0f, 1.0f, 0.05f, postfx_corner.x),
     246        vec4(0.0f, 1.0f, 0.05f, postfx_corner.y),
     247        vec4(0),
     248        vec4(0),
     249        vec4(0),
    232250    vec4(0), /* color */
    233         vec4(0, 1, 1, 0),
    234251        vec4(0.0f, 1.0f, 0.1f, postfx_filter.x),
    235252        vec4(0.0f, 1.0f, 0.1f, postfx_filter.y),
     
    239256        vec4(0.0f, 1.5f, 0.1f, postfx_color.z),
    240257        vec4(0),
    241     vec4(0), /* modifier */
    242         vec4(0.0f, 1.0f, 0.05f, postfx_deform),
    243         vec4(0.0f, 1.0f, 0.05f, postfx_retrace.x),
    244         vec4(0.0f, 8.0f, 1.0f, postfx_retrace.y),
    245         vec4(0.0f, 8.0f, 1.0f, postfx_retrace.z),
    246         vec4(0),
    247         vec4(0),
    248         vec4(0),
    249258        vec4(0),
    250259    vec4(0), /* noise */
     
    253262        vec4(0.0f, 1.0f, 0.05f, postfx_noise),
    254263        vec4(0.0f, 5.0f, 0.5f, postfx_aberration),
    255         vec4(0),
    256         vec4(0),
    257         vec4(0),
    258         vec4(0),
     264        vec4(0.0f, 0.2f, 0.01f, postfx_retrace.x),
     265        vec4(0.0f, 8.0f, 0.5f, postfx_retrace.y),
     266        vec4(0.0f, 4.0f, 0.25f, postfx_retrace.z),
     267        vec4(0),
     268    vec4(0), /* ghost */
     269        vec4(0.0f, 0.2f, 0.01f, postfx_ghost.x),
     270        vec4(0.0f, 1.0f, 0.05f, postfx_ghost.y),
     271        vec4(0.0f, 0.2f, 0.01f, postfx_ghost.z),
     272        vec4(0.0f, 1.0f, 0.05f, postfx_ghost.w),
     273        vec4(0),
     274        vec4(0),
     275        vec4(0),
     276        vec4(0),
     277    vec4(0), /* moire */
     278        vec4(0.5f, 1.0f, 0.05f, postfx_moire_h.x),
     279        vec4(-0.5f, 0.5f, 0.05f, postfx_moire_h.y),
     280        vec4(0.0f, 4.0f, 0.5f, postfx_moire_h.z),
     281        vec4(0.0f, 4.0f, 0.5f, postfx_moire_h.w),
     282        vec4(0.5f, 1.0f, 0.1f, postfx_moire_v.x),
     283        vec4(-0.5f, 0.5f, 0.1f, postfx_moire_v.y),
     284        vec4(0.0f, 4.0f, 0.5f, postfx_moire_v.z),
     285        vec4(0.0f, 4.0f, 0.5f, postfx_moire_v.w),
     286    vec4(0), /* scanline */
     287        vec4(0.5f, 1.0f, 0.05f, postfx_scanline_h.x),
     288        vec4(-0.5f, 0.5f, 0.05f, postfx_scanline_h.y),
     289        vec4(0.0f, 4.0f, 0.5f, postfx_scanline_h.z),
     290        vec4(0.0f, 4.0f, 0.5f, postfx_scanline_h.w),
     291        vec4(0.5f, 1.0f, 0.1f, postfx_scanline_v.x),
     292        vec4(-0.5f, 0.5f, 0.1f, postfx_scanline_v.y),
     293        vec4(0.0f, 4.0f, 0.5f, postfx_scanline_v.z),
     294        vec4(0.0f, 4.0f, 0.5f, postfx_scanline_v.w),
    259295    vec4(0)
    260296    };
     
    276312    k += 6;
    277313    m_shader_postfx = (setup_var[k].w == 1) ? true : false; k++;
     314    postfx_deform = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
     315    postfx_corner = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
     316    k += 4;
    278317    postfx_filter = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    279318    postfx_color = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    280     k += 2;
    281     postfx_deform = setup_var[k].w; k++;
    282     postfx_retrace = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    283     k += 5;
     319    k += 3;
    284320    postfx_offset = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    285321    postfx_noise = setup_var[k].w; k++;
    286322    postfx_aberration = setup_var[k].w; k++;
     323    postfx_retrace = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
     324    k += 2;
     325    postfx_ghost = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    287326    k += 5;
     327    postfx_moire_h = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
     328    postfx_moire_v = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
     329    k++;
     330    postfx_scanline_h = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
     331    postfx_scanline_v = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    288332}
    289333
     
    314358              shader_postfx_time,
    315359              shader_postfx_deform,
     360              shader_postfx_ghost,
    316361              shader_postfx_filter,
    317362              shader_postfx_color,
     363              shader_postfx_corner,
    318364              shader_postfx_retrace,
    319365              shader_postfx_offset,
    320366              shader_postfx_noise,
    321367              shader_postfx_aberration,
    322               shader_postfx_moire,
    323368              shader_postfx_moire_h,
    324369              shader_postfx_moire_v,
    325               shader_postfx_scanline,
    326370              shader_postfx_scanline_h,
    327371              shader_postfx_scanline_v,
     
    409453    shader_postfx_time = shader_postfx->GetUniformLocation("time");
    410454    shader_postfx_deform = shader_postfx->GetUniformLocation("deform");
     455    shader_postfx_ghost = shader_postfx->GetUniformLocation("ghost");
    411456    shader_postfx_filter = shader_postfx->GetUniformLocation("filter");
    412457    shader_postfx_color = shader_postfx->GetUniformLocation("color");
     458    shader_postfx_corner = shader_postfx->GetUniformLocation("corner");
    413459    shader_postfx_retrace = shader_postfx->GetUniformLocation("retrace");
    414460    shader_postfx_offset = shader_postfx->GetUniformLocation("offset");
    415461    shader_postfx_noise = shader_postfx->GetUniformLocation("noise");
    416462    shader_postfx_aberration = shader_postfx->GetUniformLocation("aberration");
    417     shader_postfx_moire = shader_postfx->GetUniformLocation("moire");
    418463    shader_postfx_moire_h = shader_postfx->GetUniformLocation("moire_h");
    419464    shader_postfx_moire_v = shader_postfx->GetUniformLocation("moire_v");
    420     shader_postfx_scanline = shader_postfx->GetUniformLocation("scanline");
    421465    shader_postfx_scanline_h = shader_postfx->GetUniformLocation("scanline_h");
    422466    shader_postfx_scanline_v = shader_postfx->GetUniformLocation("scanline_v");
     
    454498    m_shader(true),
    455499    m_shader_remanency(true),
    456     m_shader_glow(false),
    457     m_shader_blur(false),
    458     m_shader_postfx(false),
    459     m_border(false)
     500    m_shader_glow(true),
     501    m_shader_blur(true),
     502    m_shader_postfx(true)
    460503{
    461504    text_render = new TextRender(m_caca, font_size);
     
    675718        /* display variable */
    676719        int y = setup_p.y + setup_size.y;
     720        setup_item_key = setup_option * (setup_item_n + 1) + 1 + setup_item;
    677721        caca_set_color_argb(m_caca, setup_color.y, setup_color.x);
    678722        caca_draw_line(m_caca, setup_p.x, y, setup_p.x + setup_size.x, y,' ');
    679         if (setup_switch)
    680         {
    681             setup_item_key = setup_option * (setup_item_n + 1) + 1 + setup_item;
     723        if (setup_switch && setup_text[setup_item_key] != "")
     724        {
    682725            int w = setup_size.x - 3 - 4;
    683             caca_printf(m_caca, setup_p.x + setup_size.x - 4, y, "%4.2f", setup_var[setup_item_key].w);
    684             caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + w, y,'.');
    685             if(setup_var[setup_item_key].w > setup_var[setup_item_key].x) caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + int(w / (setup_var[setup_item_key].y - setup_var[setup_item_key].x) * setup_var[setup_item_key].w), y,'x');
     726            int bar_w = (w / (setup_var[setup_item_key].y - setup_var[setup_item_key].x) * setup_var[setup_item_key].w);
     727            if ((setup_var[setup_item_key].y - setup_var[setup_item_key].x) / setup_var[setup_item_key].z > 2)
     728            {
     729                caca_printf(m_caca, setup_p.x + setup_size.x - 4, y, "%4.2f", setup_var[setup_item_key].w);
     730                caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + w, y,'.');
     731                if(setup_var[setup_item_key].w > setup_var[setup_item_key].x) caca_draw_line(m_caca, setup_p.x + 1, y, setup_p.x + 1 + bar_w, y,'x');
     732            }
     733            else
     734            {
     735                caca_put_str(m_caca, setup_p.x + setup_size.x - 3, y, (setup_var[setup_item_key].w == setup_var[setup_item_key].y)?"YES":" NO");
     736            }
    686737        }
    687738    }
     
    698749
    699750    if (m_shader)
    700     {
    701751        fbo_back->Bind();
    702     }
    703752
    704753    glViewport(0, 0, screen_size.x, screen_size.y);
     
    723772    glLoadMatrixf(&m[0][0]);
    724773    glMatrixMode(GL_MODELVIEW);
    725     // draw border
    726     if (m_border)
    727     {
    728         glDisable(GL_TEXTURE_2D);
    729         glDisable(GL_BLEND);
    730         glColor3f(1.0f, 1.0f, 1.0f);
    731         rectangle(border.x - ratio_2d.x, border.y - ratio_2d.y, canvas_size.x + ratio_2d.x * 2, ratio_2d.y);
    732         rectangle(border.x - ratio_2d.x, border.y, ratio_2d.x, canvas_size.y);
    733         rectangle(border.x + canvas_size.x, border.y, ratio_2d.x, canvas_size.y);
    734         rectangle(border.x - ratio_2d.x, border.y + canvas_size.y, canvas_size.x + ratio_2d.x * 2, ratio_2d.y);
    735         glEnable(GL_BLEND);
    736     }
    737774}
    738775
     
    862899        shader_postfx->SetUniform(shader_postfx_time, fx_angle);
    863900        shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
     901        shader_postfx->SetUniform(shader_postfx_ghost, postfx_ghost);
    864902        shader_postfx->SetUniform(shader_postfx_filter, postfx_filter);
    865903        shader_postfx->SetUniform(shader_postfx_color, postfx_color);
     904        shader_postfx->SetUniform(shader_postfx_corner, postfx_corner);
    866905        shader_postfx->SetUniform(shader_postfx_retrace, postfx_retrace);
    867906        shader_postfx->SetUniform(shader_postfx_offset, postfx_offset);
    868907        shader_postfx->SetUniform(shader_postfx_noise, postfx_noise);
    869908        shader_postfx->SetUniform(shader_postfx_aberration, postfx_aberration);
    870         shader_postfx->SetUniform(shader_postfx_moire, postfx_moire);
    871909        shader_postfx->SetUniform(shader_postfx_moire_h, postfx_moire_h);
    872910        shader_postfx->SetUniform(shader_postfx_moire_v, postfx_moire_v);
    873         shader_postfx->SetUniform(shader_postfx_scanline, postfx_scanline);
    874911        shader_postfx->SetUniform(shader_postfx_scanline_h, postfx_scanline_h);
    875912        shader_postfx->SetUniform(shader_postfx_scanline_v, postfx_scanline_v);
  • trunk/tools/neercs/video/render.h

    r1707 r1736  
    3838    bool m_shader_glow;
    3939    bool m_shader_postfx;
    40     bool m_border;
    4140};
    4241
Note: See TracChangeset for help on using the changeset viewer.