Changeset 747


Ignore:
Timestamp:
Mar 28, 2011, 1:31:34 AM (10 years ago)
Author:
sam
Message:

video: play with random dithering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/video.cpp

    r745 r747  
    8787#if 0
    8888    "    float mul = 2.0;\n"
     89#if 0
    8990    "    vec2 d1 = mod(vec2(gl_FragCoord), vec2(2.0, 2.0));\n"
    9091    "    float t1 = mod(3.0 * d1.x + 2.0 * d1.y, 4.0);\n"
     
    9596    "    float dy3 = mod(floor(gl_FragCoord.y * 0.25), 2.0);\n"
    9697    "    float t3 = mod(3.0 * dx3 + 2.0 * dy3, 4.0);\n"
    97     "    float t = (1.0 + 16.0 * t1 + 4.0 * t2 + t3) / 65.0;\n"
     98    "    float t1 = (1.0 + 16.0 * t1 + 4.0 * t2 + t3) / 65.0;\n"
     99    "    float t2 = t1;
     100    "    float t3 = t1;
     101#else
     102    "    float rand = sin(gl_FragCoord.x * 1.23456) * 123.456\n"
     103    "               + cos(gl_FragCoord.y * 2.34567) * 789.012;\n"
     104    "    float t1 = mod(sin(rand) * 17.13043, 1.0);\n"
     105    "    float t2 = mod(sin(rand) * 27.13043, 1.0);\n"
     106    "    float t3 = mod(sin(rand) * 37.13043, 1.0);\n"
     107#endif
    98108    "    float fracx = fract(col.x * mul);\n"
    99109    "    float fracy = fract(col.y * mul);\n"
    100110    "    float fracz = fract(col.z * mul);\n"
    101     "    fracx = fracx > t ? 1.0 : 0.0;\n"
    102     "    fracy = fracy > t ? 1.0 : 0.0;\n"
    103     "    fracz = fracz > t ? 1.0 : 0.0;\n"
     111    "    fracx = fracx > t1 ? 1.0 : 0.0;\n"
     112    "    fracy = fracy > t2 ? 1.0 : 0.0;\n"
     113    "    fracz = fracz > t3 ? 1.0 : 0.0;\n"
    104114    "    col.x = (floor(col.x * mul) + fracx) / mul;\n"
    105115    "    col.y = (floor(col.y * mul) + fracy) / mul;\n"
Note: See TracChangeset for help on using the changeset viewer.