Changeset 1786


Ignore:
Timestamp:
Aug 22, 2012, 2:03:39 AM (8 years ago)
Author:
rez
Message:

enhanced double ghost picture + add vignetting control in setup

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

Legend:

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

    r1783 r1786  
    1717uniform float time;
    1818uniform vec2 deform;
    19 uniform vec4 ghost;
     19uniform vec4 ghost1;
     20uniform vec4 ghost2;
    2021uniform vec3 filter;
    2122uniform vec3 color;
     
    2930uniform vec4 scanline_v;
    3031uniform vec2 corner;
     32uniform float vignetting;
    3133uniform float flash;
    3234uniform float sync;
     
    6163        p.y+=0.025*sync;
    6264        vec2 z =screen(p,deform.y);
    63         vec2 z1=screen(p,deform.y+ghost.x*0.01);
    64         vec2 z2=screen(p,deform.y+ghost.z*0.01);
     65        vec2 z1=screen(p,deform.y+ghost1.z*0.01);
     66        vec2 z2=screen(p,deform.y+ghost2.z*0.01);
    6567        float mask=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);
    6668
     
    6971        vec2 o=(offset-offset*2.0*rnd.x)/screen_size;                   // offset
    7072        vec3 source=get_color(texture,z+o);                                             // offset added to source
    71         vec3 glass1=get_color(texture,z1-vec2(0.25,0.0));
    72         vec3 glass2=get_color(texture,z2-vec2(0.25,0.0));
     73        vec3 g1=get_color(texture,z1-ghost1.xy);
     74        vec3 g2=get_color(texture,z2-ghost2.xy);
    7375
    7476        float v=aberration/float(screen_size.x)+aberration/float(screen_size.x)*(2.0-mask);
     
    7981        ca.z=get_color(texture,vec2(z.x+o.x+v,z.y+o.y)).z;
    8082
    81         vec3 c=source-glass1*glass1*ghost.y+glass2*glass2*ghost.w;
     83        vec3 c=source+g1*g1*ghost1.w+g2*g2*ghost2.w;                    // mix
    8284
    8385        float a=(c.x+c.y+c.z)/3.0;
     
    9698        c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w));   // scanline h
    9799        c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w));   // scanline v
    98         c*=mask;                                                                                                // vignetting
     100        c*=(mask-vignetting);                                                                   // vignetting
    99101        c*=letterbox(z,corner.x,corner.y);                                              // letterbox
    100102        gl_FragColor=vec4(c,1.0);
  • trunk/tools/neercs/video/render.cpp

    r1783 r1786  
    7878bool sync_flag = false;    // flagsh
    7979float sync_angle = 0;      // angle
    80 float sync_value = 1.0f;   // value
     80float sync_value = 0;      // value
    8181float sync_speed = 1.0f;   // speed
    8282/* beat variable */
     
    9898vec3 postfx_color(1.8f,1.5f,0.5f);    // color modifier [brightness,contrast,grayscale]
    9999vec2 postfx_corner(0.75f,0.95f);      // corner [radius,blur]
     100float postfx_vignetting = -0.5f;      // vignetting strength
    100101vec3 postfx_retrace(0.05f,2.0f,4.0f); // retrace [strength,length,speed]
    101102vec2 postfx_offset(3.0f,3.0f);  // random line [horizontal,vertical]
    102103float postfx_noise = 0.15f;     // noise
    103 float postfx_aberration = 3.0f; // chromatic aberration
    104 vec4 postfx_ghost(0.1f,-0.25f,0.1f,0.5f);        // ghost picture [distance,strength,distance,strength]
     104float postfx_aberration = 4.0f; // chromatic aberration
     105vec4 postfx_ghost1(0.01f,0.0f,0.1f,-0.4f);      // ghost picture 1 [position x,position y,position z,strength]
     106vec4 postfx_ghost2(0.02f,0.0f,0.1f,0.4f);       // ghost picture 2 [position x,position y,position z,strength]
    105107vec4 postfx_moire_h(0.75f,-0.25f,0.0f,1.0f);    // vertical moire [base,variable,repeat x,repeat y]
    106108vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f);    // horizontal moire [base,variable,repeat x,repeat y]
     
    170172        "corner radius",
    171173        "corner blur",
    172         "",
     174        "vignetting",
    173175        "",
    174176        "",
     
    192194        "",
    193195    "ghost",
    194         "back distance",
     196        "back x",
     197        "back y",
     198        "back z",
    195199        "back strength",
    196         "front distance",
     200        "front x",
     201        "front y",
     202        "front z",
    197203        "front strength",
    198         "",
    199         "",
    200         "",
    201         "",
    202204    "moire",
    203205        "h base",
     
    257259        vec4(0),
    258260    vec4(0), /* screen */
    259         vec4(0, 1, 1, 1),
    260         vec4(0.0f, 1.0f, 0.05f, postfx_deform.x),
    261         vec4(0.5f, 0.7f, 0.01f, postfx_deform.y),
    262         vec4(0.0f, 1.0f, 0.05f, postfx_corner.x),
    263         vec4(0.0f, 1.0f, 0.05f, postfx_corner.y),
    264         vec4(0),
     261        vec4( 0, 1, 1, 1),
     262        vec4( 0.0f, 1.0f, 0.05f, postfx_deform.x),
     263        vec4( 0.5f, 0.7f, 0.01f, postfx_deform.y),
     264        vec4( 0.0f, 1.0f, 0.05f, postfx_corner.x),
     265        vec4( 0.0f, 1.0f, 0.05f, postfx_corner.y),
     266        vec4(-1.0f, 1.0f, 0.10f, postfx_vignetting),
    265267        vec4(0),
    266268        vec4(0),
     
    275277        vec4(0),
    276278    vec4(0), /* noise */
    277         vec4(0.0f, 4.0f, 0.5f, postfx_offset.x),
    278         vec4(0.0f, 4.0f, 0.5f, postfx_offset.y),
     279        vec4(0.0f, 4.0f, 0.50f, postfx_offset.x),
     280        vec4(0.0f, 4.0f, 0.50f, postfx_offset.y),
    279281        vec4(0.0f, 1.0f, 0.05f, postfx_noise),
    280         vec4(0.0f, 5.0f, 0.5f, postfx_aberration),
     282        vec4(0.0f, 8.0f, 0.50f, postfx_aberration),
    281283        vec4(0.0f, 0.2f, 0.01f, postfx_retrace.x),
    282         vec4(0.0f, 8.0f, 0.5f, postfx_retrace.y),
     284        vec4(0.0f, 8.0f, 0.50f, postfx_retrace.y),
    283285        vec4(0.0f, 4.0f, 0.25f, postfx_retrace.z),
    284286        vec4(0),
    285287    vec4(0), /* ghost */
    286         vec4(0.0f, 2.0f, 0.1f, postfx_ghost.x),
    287         vec4(-1.0f, 1.0f, 0.1f, postfx_ghost.y),
    288         vec4(0.0f, 2.0f, 0.1f, postfx_ghost.z),
    289         vec4(-1.0f, 1.0f, 0.1f, postfx_ghost.w),
    290         vec4(0),
    291         vec4(0),
    292         vec4(0),
    293         vec4(0),
     288        vec4(-0.5f, 0.5f, 0.01f, postfx_ghost1.x),
     289        vec4(-0.5f, 0.5f, 0.01f, postfx_ghost1.y),
     290        vec4(-2.0f, 2.0f, 0.10f, postfx_ghost1.z),
     291        vec4(-1.0f, 1.0f, 0.05f, postfx_ghost1.w),
     292        vec4(-0.5f, 0.5f, 0.01f, postfx_ghost2.x),
     293        vec4(-0.5f, 0.5f, 0.01f, postfx_ghost2.y),
     294        vec4(-2.0f, 2.0f, 0.10f, postfx_ghost2.z),
     295        vec4(-1.0f, 1.0f, 0.05f, postfx_ghost2.w),
    294296    vec4(0), /* moire */
    295         vec4(0.5f, 1.0f, 0.05f, postfx_moire_h.x),
     297        vec4( 0.5f, 1.0f, 0.05f, postfx_moire_h.x),
    296298        vec4(-0.5f, 0.5f, 0.05f, postfx_moire_h.y),
    297         vec4(0.0f, 4.0f, 0.5f, postfx_moire_h.z),
    298         vec4(0.0f, 4.0f, 0.5f, postfx_moire_h.w),
    299         vec4(0.5f, 1.0f, 0.05f, postfx_moire_v.x),
     299        vec4( 0.0f, 4.0f, 0.50f, postfx_moire_h.z),
     300        vec4( 0.0f, 4.0f, 0.50f, postfx_moire_h.w),
     301        vec4( 0.5f, 1.0f, 0.05f, postfx_moire_v.x),
    300302        vec4(-0.5f, 0.5f, 0.05f, postfx_moire_v.y),
    301         vec4(0.0f, 4.0f, 0.5f, postfx_moire_v.z),
    302         vec4(0.0f, 4.0f, 0.5f, postfx_moire_v.w),
     303        vec4( 0.0f, 4.0f, 0.50f, postfx_moire_v.z),
     304        vec4( 0.0f, 4.0f, 0.50f, postfx_moire_v.w),
    303305    vec4(0), /* scanline */
    304         vec4(0.5f, 1.0f, 0.05f, postfx_scanline_h.x),
     306        vec4( 0.5f, 1.0f, 0.05f, postfx_scanline_h.x),
    305307        vec4(-0.5f, 0.5f, 0.05f, postfx_scanline_h.y),
    306         vec4(0.0f, 4.0f, 0.5f, postfx_scanline_h.z),
    307         vec4(0.0f, 4.0f, 0.5f, postfx_scanline_h.w),
    308         vec4(0.5f, 1.0f, 0.05f, postfx_scanline_v.x),
     308        vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_h.z),
     309        vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_h.w),
     310        vec4( 0.5f, 1.0f, 0.05f, postfx_scanline_v.x),
    309311        vec4(-0.5f, 0.5f, 0.05f, postfx_scanline_v.y),
    310         vec4(0.0f, 4.0f, 0.5f, postfx_scanline_v.z),
    311         vec4(0.0f, 4.0f, 0.5f, postfx_scanline_v.w),
     312        vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_v.z),
     313        vec4( 0.0f, 4.0f, 0.50f, postfx_scanline_v.w),
    312314    vec4(0)
    313315    };
     
    332334    postfx_deform = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    333335    postfx_corner = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
    334     k += 4; /* color */
     336    postfx_vignetting = setup_var[k].w; k++;
     337    k += 3; /* color */
    335338    postfx_filter = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    336339    postfx_color = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
     
    341344    postfx_retrace = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
    342345    k += 2; /* ghost */
    343     postfx_ghost = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
    344     k += 5; /* moire */
     346    postfx_ghost1 = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
     347    postfx_ghost2 = vec4(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w, setup_var[k + 3].w); k += 4;
     348    k += 1; /* moire */
    345349    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;
    346350    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;
     
    388392              shader_postfx_time,
    389393              shader_postfx_deform,
    390               shader_postfx_ghost,
     394              shader_postfx_ghost1,
     395              shader_postfx_ghost2,
    391396              shader_postfx_filter,
    392397              shader_postfx_color,
    393398              shader_postfx_corner,
     399              shader_postfx_vignetting,
    394400              shader_postfx_retrace,
    395401              shader_postfx_offset,
     
    483489    shader_postfx_time = shader_postfx->GetUniformLocation("time");
    484490    shader_postfx_deform = shader_postfx->GetUniformLocation("deform");
    485     shader_postfx_ghost = shader_postfx->GetUniformLocation("ghost");
     491    shader_postfx_ghost1 = shader_postfx->GetUniformLocation("ghost1");
     492    shader_postfx_ghost2 = shader_postfx->GetUniformLocation("ghost2");
    486493    shader_postfx_filter = shader_postfx->GetUniformLocation("filter");
    487494    shader_postfx_color = shader_postfx->GetUniformLocation("color");
    488495    shader_postfx_corner = shader_postfx->GetUniformLocation("corner");
     496    shader_postfx_vignetting = shader_postfx->GetUniformLocation("vignetting");
    489497    shader_postfx_retrace = shader_postfx->GetUniformLocation("retrace");
    490498    shader_postfx_offset = shader_postfx->GetUniformLocation("offset");
     
    555563    {
    556564        m_setup = !m_setup;
     565        sync_flag = true;
     566        sync_angle = main_angle;
    557567        timer_key = timer;
    558568    }
     
    677687    if (Input::GetButtonState(13/*SDLK_RETURN*/)&&(timer-timer_key>timer_key_repeat))
    678688    {
     689        sync_flag = true;
     690        sync_angle = main_angle;
    679691        timer_key = timer;
    680692    }
     
    966978        shader_postfx->SetUniform(shader_postfx_time, fx_angle);
    967979        shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
    968         shader_postfx->SetUniform(shader_postfx_ghost, postfx_ghost);
     980        shader_postfx->SetUniform(shader_postfx_ghost1, postfx_ghost1);
     981        shader_postfx->SetUniform(shader_postfx_ghost2, postfx_ghost2);
    969982        shader_postfx->SetUniform(shader_postfx_filter, postfx_filter);
    970983        shader_postfx->SetUniform(shader_postfx_color, postfx_color);
    971984        shader_postfx->SetUniform(shader_postfx_corner, postfx_corner);
     985        shader_postfx->SetUniform(shader_postfx_vignetting, postfx_vignetting);
    972986        shader_postfx->SetUniform(shader_postfx_retrace, postfx_retrace);
    973987        shader_postfx->SetUniform(shader_postfx_offset, postfx_offset);
     
    979993        shader_postfx->SetUniform(shader_postfx_scanline_v, postfx_scanline_v);
    980994        shader_postfx->SetUniform(shader_postfx_flash, flash_value);
    981         shader_postfx->SetUniform(shader_postfx_sync, (float)fabs(beat_value*cosf((main_angle-beat_angle)*8.0f)));
     995        shader_postfx->SetUniform(shader_postfx_sync, (float)fabs(sync_value*cosf((main_angle-sync_angle)*6.0f)));
    982996        fs_quad();
    983997        shader_postfx->Unbind();
Note: See TracChangeset for help on using the changeset viewer.