1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

AsuMagic Shaders Pack.

Discussion in 'Modding [KAG Classic]' started by Asu, Jul 15, 2012.

  1. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    I'm modding shaders.

    Shader Pack :
    *** UPDATE : BLOOM 2.0; COLOR CORRECTION; GAMMA; GLARE, HDR!!! ***

    [​IMG]
    Just open : Base\Scripts\hq2x.frag , Ctrl - A and suppr.
    After copy that :

    #version 120
    /////////////////////////////////////////////////////
    // AsuMagic Shaders. //
    // Thanks to : //
    // Chocapic ( My brother ) //
    // Sonic Ether's ( I used a lot of his shaders ;p ) //
    /////////////////////////////////////////////////////
    // ! \\ Glare is an very Beta shader! Weird effect actually! And HDR too!
    // ! \\ Border_Blur doesn't work now!
    // ! \\ Toon_Effect doesn't work now!
    // ! \\ Less_Color is buggy!
    // ! \\ * : Don't add the prefix : // for turn off on Color_Boost, Bright / Darkmult, and HQ2X Filter!
    // MODIFIABLE SECTION //
    // Color, light //
    //#define EDGES_BLUR // It's used for blur the edges of screen.
    //#define PIXEL_EDGES // Or how to crash the game *_*
    #define COLOR_BOOST 0.15 // Boosting intensity *
    #define BRIGHTMULT 1.0025 // 1.0 = default brightness. Higher values mean brighter. 0 would be black. *
    #define DARKMULT 0.12 // 0.0 = normal image. Higher values will darken dark colors. *
    #define CROSSPROCESS // Cross Processing Shader.
    //#define GLARE // If you use it, turn off the Bloom shader! And weird effect
    #define GLARE_AMOUNT 0.25 // The glare amount.
    #define GLARE_RANGE 3.0 // Set the Glare Range.
    #define GLARE_r 2.5 // Red channel
    #define GLARE_g 2.5 // Green channel
    #define GLARE_b 3.25 // Blue channel
    //#define HDR // Warning : HDR is using a LOT OF RESOURCES!
    #define HDR_RANGE 1.0 // Hdr Range / LessCol Range
    #define BLOOM 0.12 // If you use it, turn off the Glare shader!
    #define BLOOM_DIST 0.0017 // Bloom distance / Bloom range if you prefer!
    //#define HIGHDESATURATE // High Desaturate.
    #define GAMMA 0.5 // Set the gamma.
    //#define POSTERIZATION // Strnage effect ( Less colors. ) BROKEN

    // Smooth Edges Shader (HQ2X). * //
    const float mx = 0.1; // Start Smoothing Weight
    const float k = -0.2; // Weight decrease 1.0
    const float max_w = 0.25; // Max filter weigth
    const float min_w =-0.25; // Min filter weigth
    const float lum_add = 75; // Effects smoothing

    // DON'T MODIFY AFTER ! //
    uniform sampler2D baseMap;
    uniform float gamma; // 0.6
    uniform float numColors; // 8.0
    uniform float vx_offset;
    uniform float pixel_w; // 15.0
    uniform float pixel_h; // 10.0
    float realcolor(vec2 coord) {
    return ((texture2D(baseMap, coord).r + texture2D(baseMap, coord).g + texture2D(baseMap, coord).b)/3.0);
    }
    void main()
    {
    vec2 texcoord = vec2(gl_TexCoord[0]);
    vec4 color = vec4(texture2D(baseMap, texcoord).rgba);
    #ifdef POSTERIZATION
    vec3 c = texture2D(baseMap, gl_TexCoord[0].xy).rgb;
    c = pow(c, vec3(gamma, gamma, gamma));
    c = c * numColors;
    c = floor(c);
    c = c / numColors;
    c = pow(c, vec3(1.0/gamma));
    #endif
    #ifdef BLOOM
    vec4 sum = vec4(0);
    int j;
    int i;
    for( i= -4 ;i < 4; i++)
    {for (j = -3; j < 3; j++){sum += texture2D(baseMap, texcoord + vec2(j, i)*BLOOM_DIST) * BLOOM;}}
    if (color.r < 0.3){color = sum*sum*0.03 + color;}
    else {if (color.r < 0.5){color = sum*sum*0.02 + color;}
    else {color = sum*sum*0.03 + color;}}
    #endif
    #ifdef GLARE
    color = color * 0.8;
    float radius = 0.002*GLARE_RANGE;
    float radiusv = 0.002;
    float bloomintensity = 0.1*GLARE_AMOUNT;
    vec4 clr = vec4(0.0);
    clr += texture2D(baseMap, texcoord.st);
    clr += texture2D(baseMap, texcoord.st + (vec2(10.0,0.0))*radius)*10.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(9.0,0.0))*radius)*11.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(8.0,0.0))*radius)*12.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(7.0,0.0))*radius)*13.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(6.0,0.0))*radius)*14.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(5.0,0.0))*radius)*15.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(4.0,0.0))*radius)*16.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(3.0,0.0))*radius)*17.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(2.0,0.0))*radius)*18.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(1.0,0.0))*radius)*19.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,0.0))*radius)*20.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-1.0,0.0))*radius)*19.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-2.0,0.0))*radius)*18.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-3.0,0.0))*radius)*17.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-4.0,0.0))*radius)*16.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-5.0,0.0))*radius)*15.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-6.0,0.0))*radius)*14.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-7.0,0.0))*radius)*13.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-8.0,0.0))*radius)*12.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-9.0,0.0))*radius)*11.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(-10.0,0.0))*radius)*10.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,10.0))*radius)*10.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,9.0))*radius)*11.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,8.0))*radius)*12.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,7.0))*radius)*13.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,6.0))*radius)*14.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,5.0))*radius)*15.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,4.0))*radius)*16.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,3.0))*radius)*17.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,2.0))*radius)*18.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,1.0))*radius)*19.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-10.0))*radius)*10.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-9.0))*radius)*11.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-8.0))*radius)*12.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-7.0))*radius)*13.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-6.0))*radius)*14.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-5.0))*radius)*15.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-4.0))*radius)*16.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-3.0))*radius)*17.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-2.0))*radius)*18.0;
    clr += texture2D(baseMap, texcoord.st + (vec2(0.0,-1.0))*radius)*19.0;
    clr = (clr/20.0)/5.0;
    clr.r = pow(clr.r, 1.2)*1.6 - (clr.g + clr.b)*0.6;
    clr.g = pow(clr.g, 1.2)*1.6 - (clr.r + clr.b)*0.6;
    clr.b = pow(clr.b, 1.2)*1.9 - (clr.r + clr.g)*0.9;
    clr = clamp((clr), 0.0, 1.0);
    color.r = color.r + (clr.r*GLARE_r)*bloomintensity;
    color.g = color.g + (clr.g*GLARE_g)*bloomintensity;
    color.b = color.b + (clr.b*GLARE_b)*bloomintensity;
    color = max(color, 0.0);

    #endif
    #ifdef CROSSPROCESS
    color = color * (BRIGHTMULT + 0.0) + 0.03;
    color = color+0.029;
    float dbr = -color.r + 1.4;
    float dbg = -color.g + 1.4;
    float dbb = -color.b + 1.4;
    float pr = mix(dbr, 0.65, 0.5);
    float pg = mix(dbg, 0.65, 0.5);
    float pb = mix(dbb, 0.65, 0.5);
    color.r = pow((color.r * 0.95 - 0.002), pr);
    color.g = pow((color.g * 0.95 - 0.002), pg);
    color.b = pow((color.b * 0.99 + 0.000), pb);

    #endif
    color = color * BRIGHTMULT;
    color = color*(1.0 + DARKMULT) - DARKMULT;
    color.a = 1.0;
    color.r = (color.r)*(COLOR_BOOST + 1.0) + (color.g + color.b)*(-COLOR_BOOST);
    color.g = (color.g)*(COLOR_BOOST + 1.0) + (color.r + color.b)*(-COLOR_BOOST);
    color.b = (color.b)*(COLOR_BOOST + 1.0) + (color.r + color.g)*(-COLOR_BOOST);
    #ifdef HDR
    float avgclr = realcolor(vec2(0.5, 0.5));
    avgclr += realcolor(vec2(0.01, 0.01));
    avgclr += realcolor(vec2(0.01, -0.01));
    avgclr += realcolor(vec2(-0.01, 0.01));
    avgclr += realcolor(vec2(-0.01, -0.01));
    avgclr += realcolor(vec2(0.02, 0.02));
    avgclr += realcolor(vec2(0.02, -0.02));
    avgclr += realcolor(vec2(-0.02, 0.02));
    avgclr += realcolor(vec2(-0.02, -0.02));
    avgclr += realcolor(vec2(0.03, 0.03));
    avgclr += realcolor(vec2(0.03, -0.03));
    avgclr += realcolor(vec2(-0.03, 0.03));
    avgclr += realcolor(vec2(-0.03, -0.03));
    avgclr += realcolor(vec2(0.04, 0.04));
    avgclr += realcolor(vec2(0.04, -0.04));
    avgclr += realcolor(vec2(-0.04, 0.04));
    avgclr += realcolor(vec2(-0.04, -0.04));
    avgclr += realcolor(vec2(0.05, 0.05));
    avgclr += realcolor(vec2(0.05, -0.05));
    avgclr += realcolor(vec2(-0.05, 0.05));
    avgclr += realcolor(vec2(-0.05, -0.05));
    avgclr += realcolor(vec2(0.06, 0.06));
    avgclr += realcolor(vec2(0.06, -0.06));
    avgclr += realcolor(vec2(-0.06, 0.06));
    avgclr += realcolor(vec2(-0.06, -0.06));
    avgclr += realcolor(vec2(0.07, 0.07));
    avgclr += realcolor(vec2(0.07, -0.07));
    avgclr += realcolor(vec2(-0.07, 0.07));
    avgclr += realcolor(vec2(-0.07, -0.07));
    avgclr += realcolor(vec2(0.08, 0.08));
    avgclr += realcolor(vec2(0.08, -0.08));
    avgclr += realcolor(vec2(-0.08, 0.08));
    avgclr += realcolor(vec2(-0.08, -0.08));
    avgclr += realcolor(vec2(0.09, 0.09));
    avgclr += realcolor(vec2(0.09, -0.09));
    avgclr += realcolor(vec2(-0.09, 0.09));
    avgclr += realcolor(vec2(-0.09, -0.09));
    avgclr += realcolor(vec2(0.10, 0.10));
    avgclr += realcolor(vec2(0.10, -0.10));
    avgclr += realcolor(vec2(-0.10, 0.10));
    avgclr += realcolor(vec2(-0.10, -0.10));
    avgclr += realcolor(vec2(0.11, 0.11));
    avgclr += realcolor(vec2(0.11, -0.11));
    avgclr += realcolor(vec2(-0.11, 0.11));
    avgclr += realcolor(vec2(-0.11, -0.11));
    avgclr += realcolor(vec2(0.12, 0.12));
    avgclr += realcolor(vec2(0.12, -0.12));
    avgclr += realcolor(vec2(-0.12, 0.12));
    avgclr += realcolor(vec2(-0.12, -0.12));
    avgclr += realcolor(vec2(0.13, 0.13));
    avgclr += realcolor(vec2(0.13, -0.13));
    avgclr += realcolor(vec2(-0.13, 0.13));
    avgclr += realcolor(vec2(-0.13, -0.13));
    avgclr += realcolor(vec2(0.14, 0.14));
    avgclr += realcolor(vec2(0.14, -0.14));
    avgclr += realcolor(vec2(-0.14, 0.14));
    avgclr += realcolor(vec2(-0.14, -0.14));
    avgclr += realcolor(vec2(0.15, 0.15));
    avgclr += realcolor(vec2(0.15, -0.15));
    avgclr += realcolor(vec2(-0.15, 0.15));
    avgclr += realcolor(vec2(-0.15, -0.15));
    avgclr += realcolor(vec2(0.16, 0.16));
    avgclr += realcolor(vec2(0.16, -0.16));
    avgclr += realcolor(vec2(-0.16, 0.16));
    avgclr += realcolor(vec2(-0.16, -0.16));
    avgclr += realcolor(vec2(0.17, 0.17));
    avgclr += realcolor(vec2(0.17, -0.17));
    avgclr += realcolor(vec2(-0.17, 0.17));
    avgclr += realcolor(vec2(-0.17, -0.17));
    avgclr += realcolor(vec2(0.18, 0.18));
    avgclr += realcolor(vec2(0.18, -0.18));
    avgclr += realcolor(vec2(-0.18, 0.18));
    avgclr += realcolor(vec2(-0.18, -0.18));
    avgclr += realcolor(vec2(0.19, 0.19));
    avgclr += realcolor(vec2(0.19, -0.19));
    avgclr += realcolor(vec2(-0.19, 0.19));
    avgclr += realcolor(vec2(-0.19, -0.19));
    avgclr += realcolor(vec2(0.20, 0.20));
    avgclr += realcolor(vec2(0.20, -0.20));
    avgclr += realcolor(vec2(-0.20, 0.20));
    avgclr += realcolor(vec2(-0.20, -0.20));
    avgclr += realcolor(vec2(0.21, 0.21));
    avgclr += realcolor(vec2(0.21, -0.21));
    avgclr += realcolor(vec2(-0.21, 0.21));
    avgclr += realcolor(vec2(-0.21, -0.21));
    avgclr += realcolor(vec2(0.22, 0.22));
    avgclr += realcolor(vec2(0.22, -0.22));
    avgclr += realcolor(vec2(-0.22, 0.22));
    avgclr += realcolor(vec2(-0.22, -0.22));
    avgclr += realcolor(vec2(0.23, 0.23));
    avgclr += realcolor(vec2(0.23, -0.23));
    avgclr += realcolor(vec2(-0.23, 0.23));
    avgclr += realcolor(vec2(-0.23, -0.23));
    avgclr += realcolor(vec2(0.24, 0.24));
    avgclr += realcolor(vec2(0.24, -0.24));
    avgclr += realcolor(vec2(-0.24, 0.24));
    avgclr += realcolor(vec2(-0.24, -0.24));
    avgclr += realcolor(vec2(0.25, 0.25));
    avgclr += realcolor(vec2(0.25, -0.25));
    avgclr += realcolor(vec2(-0.25, 0.25));
    avgclr += realcolor(vec2(-0.25, -0.25));
    avgclr += realcolor(vec2(0.26, 0.26));
    avgclr += realcolor(vec2(0.26, -0.26));
    avgclr += realcolor(vec2(-0.26, 0.26));
    avgclr += realcolor(vec2(-0.26, -0.26));
    avgclr += realcolor(vec2(0.27, 0.27));
    avgclr += realcolor(vec2(0.27, -0.27));
    avgclr += realcolor(vec2(-0.27, 0.27));
    avgclr += realcolor(vec2(-0.27, -0.27));
    avgclr += realcolor(vec2(0.28, 0.28));
    avgclr += realcolor(vec2(0.28, -0.28));
    avgclr += realcolor(vec2(-0.28, 0.28));
    avgclr += realcolor(vec2(-0.28, -0.28));
    avgclr += realcolor(vec2(0.29, 0.29));
    avgclr += realcolor(vec2(0.29, -0.29));
    avgclr += realcolor(vec2(-0.29, 0.29));
    avgclr += realcolor(vec2(-0.29, -0.29));
    avgclr += realcolor(vec2(0.40, 0.40));
    avgclr += realcolor(vec2(0.40, -0.40));
    avgclr += realcolor(vec2(-0.40, 0.40));
    avgclr += realcolor(vec2(-0.40, -0.40));
    avgclr += realcolor(vec2(0.31, 0.31));
    avgclr += realcolor(vec2(0.31, -0.31));
    avgclr += realcolor(vec2(-0.31, 0.31));
    avgclr += realcolor(vec2(-0.31, -0.31));
    avgclr += realcolor(vec2(0.32, 0.32));
    avgclr += realcolor(vec2(0.32, -0.32));
    avgclr += realcolor(vec2(-0.32, 0.32));
    avgclr += realcolor(vec2(-0.32, -0.32));
    avgclr += realcolor(vec2(0.33, 0.33));
    avgclr += realcolor(vec2(0.33, -0.33));
    avgclr += realcolor(vec2(-0.33, 0.33));
    avgclr += realcolor(vec2(-0.33, -0.33));
    avgclr += realcolor(vec2(0.34, 0.34));
    avgclr += realcolor(vec2(0.34, -0.34));
    avgclr += realcolor(vec2(-0.34, 0.34));
    avgclr += realcolor(vec2(-0.34, -0.34));
    avgclr += realcolor(vec2(0.35, 0.35));
    avgclr += realcolor(vec2(0.35, -0.35));
    avgclr += realcolor(vec2(-0.35, 0.35));
    avgclr += realcolor(vec2(-0.35, -0.35));
    avgclr += realcolor(vec2(0.36, 0.36));
    avgclr += realcolor(vec2(0.36, -0.36));
    avgclr += realcolor(vec2(-0.36, 0.36));
    avgclr += realcolor(vec2(-0.36, -0.36));
    avgclr += realcolor(vec2(0.37, 0.37));
    avgclr += realcolor(vec2(0.37, -0.37));
    avgclr += realcolor(vec2(-0.37, 0.37));
    avgclr += realcolor(vec2(-0.37, -0.37));
    avgclr += realcolor(vec2(0.38, 0.38));
    avgclr += realcolor(vec2(0.38, -0.38));
    avgclr += realcolor(vec2(-0.38, 0.38));
    avgclr += realcolor(vec2(-0.38, -0.38));
    avgclr += realcolor(vec2(0.39, 0.39));
    avgclr += realcolor(vec2(0.39, -0.39));
    avgclr += realcolor(vec2(-0.39, 0.39));
    avgclr += realcolor(vec2(-0.39, -0.39));
    avgclr += realcolor(vec2(0.40, 0.40));
    avgclr += realcolor(vec2(0.40, -0.40));
    avgclr += realcolor(vec2(-0.40, 0.40));
    avgclr += realcolor(vec2(-0.40, -0.40));
    avgclr += realcolor(vec2(0.41, 0.41));
    avgclr += realcolor(vec2(0.41, -0.41));
    avgclr += realcolor(vec2(-0.41, 0.41));
    avgclr += realcolor(vec2(-0.41, -0.41));
    avgclr += realcolor(vec2(0.42, 0.42));
    avgclr += realcolor(vec2(0.42, -0.42));
    avgclr += realcolor(vec2(-0.42, 0.42));
    avgclr += realcolor(vec2(-0.42, -0.42));
    avgclr += realcolor(vec2(0.43, 0.43));
    avgclr += realcolor(vec2(0.43, -0.43));
    avgclr += realcolor(vec2(-0.43, 0.43));
    avgclr += realcolor(vec2(-0.43, -0.43));
    avgclr += realcolor(vec2(0.44, 0.44));
    avgclr += realcolor(vec2(0.44, -0.44));
    avgclr += realcolor(vec2(-0.44, 0.44));
    avgclr += realcolor(vec2(-0.44, -0.44));
    avgclr += realcolor(vec2(0.45, 0.45));
    avgclr += realcolor(vec2(0.45, -0.45));
    avgclr += realcolor(vec2(-0.45, 0.45));
    avgclr += realcolor(vec2(-0.45, -0.45));
    avgclr += realcolor(vec2(0.46, 0.46));
    avgclr += realcolor(vec2(0.46, -0.46));
    avgclr += realcolor(vec2(-0.46, 0.46));
    avgclr += realcolor(vec2(-0.46, -0.46));
    avgclr += realcolor(vec2(0.47, 0.47));
    avgclr += realcolor(vec2(0.47, -0.47));
    avgclr += realcolor(vec2(-0.47, 0.47));
    avgclr += realcolor(vec2(-0.47, -0.47));
    avgclr += realcolor(vec2(0.48, 0.48));
    avgclr += realcolor(vec2(0.48, -0.48));
    avgclr += realcolor(vec2(-0.48, 0.48));
    avgclr += realcolor(vec2(-0.48, -0.48));
    avgclr += realcolor(vec2(0.49, 0.49));
    avgclr += realcolor(vec2(0.49, -0.49));
    avgclr += realcolor(vec2(-0.49, 0.49));
    avgclr += realcolor(vec2(-0.49, -0.49));
    avgclr = 1/(clamp(avgclr/200.0, 0.0, 1.0)+0.5)*HDR_RANGE - HDR_RANGE;
    color.r = color.r + color.r*((avgclr)) + (0.01*avgclr);
    color.g = color.g + color.g*((avgclr)) + (0.01*avgclr);
    color.b = color.b + color.b*((avgclr)) + (0.01*avgclr);
    #endif;
    #ifdef HIGHDESATURATE
    float rgb = max(color.r, max(color.g, color.b))/2 + min(color.r, min(color.g, color.b))/2;
    float bw = pow(rgb, 0.7);
    float rgbr = mix(rgb, color.r, 0.7);
    float rgbg = mix(rgb, color.g, 0.7);
    float rgbb = mix(rgb, color.b, 0.7);
    float mixfactorr = max(0.0, (rgbr*2 - 1));
    float mixfactorg = max(0.0, (rgbg*2 - 1));
    float mixfactorb = max(0.0, (rgbb*2 - 1));
    float mixr = mix(color.r, bw, mixfactorr);
    float mixg = mix(color.g, bw, mixfactorg);
    float mixb = mix(color.b, bw, mixfactorb);
    color.r = clamp((mix(mixr, color.r, 0.0)), 0.0, 1.0);
    color.g = clamp((mix(mixg, color.g, 0.0)), 0.0, 1.0);
    color.b = clamp((mix(mixb, color.b, 0.0)), 0.0, 1.0);
    color.b = color.b*0.8 + ((color.r + color.g)/2.0)*0.2;
    color = max(((color*1.10) - 0.06), 0.0);
    color.r = pow(color.r, GAMMA);
    color.g = pow(color.g, GAMMA);
    color.b = pow(color.b, GAMMA);
    color = color*(1.0 + DARKMULT) - DARKMULT;

    #endif
    vec3 c00 = texture2D(baseMap, gl_TexCoord[1].xy).xyz;
    vec3 c10 = texture2D(baseMap, gl_TexCoord[1].zw).xyz;
    vec3 c20 = texture2D(baseMap, gl_TexCoord[2].xy).xyz;
    vec3 c01 = texture2D(baseMap, gl_TexCoord[4].zw).xyz;
    vec3 c11 = texture2D(baseMap, gl_TexCoord[0].xy).xyz;
    vec3 c21 = texture2D(baseMap, gl_TexCoord[2].zw).xyz;
    vec3 c02 = texture2D(baseMap, gl_TexCoord[4].xy).xyz;
    vec3 c12 = texture2D(baseMap, gl_TexCoord[3].zw).xyz;
    vec3 c22 = texture2D(baseMap, gl_TexCoord[3].xy).xyz;
    vec3 dt = vec3(1.0, 1.0, 1.0);
    float md1 = dot(abs(c00 - c22), dt);
    float md2 = dot(abs(c02 - c20), dt);
    float w1 = dot(abs(c22 - c11), dt) * md2;
    float w2 = dot(abs(c02 - c11), dt) * md1;
    float w3 = dot(abs(c00 - c11), dt) * md2;
    float w4 = dot(abs(c20 - c11), dt) * md1;
    float t1 = w1 + w3;
    float t2 = w2 + w4;
    float ww = max(t1, t2) + 0.0001;
    c11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);
    float lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);
    float lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);
    w1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);
    w2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);
    w3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);
    w4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);
    #ifdef PIXEL_EDGES
    vec2 uv = gl_TexCoord[0].xy;

    vec3 tc = vec3(1.0, 0.0, 0.0);
    float dx = pixel_w;
    float dy = pixel_h;
    vec2 coord = vec2(dx*floor(dx),
    dy*floor(dy));
    tc = texture2D(baseMap, coord).rgb;
    gl_FragColor = vec4(tc, 1.0);
    #endif
    color.rgb += w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11;
    gl_FragColor += color; // Drawing the result to the screen.
    #ifdef POSTERIZATION
    gl_FragColor += vec4(c,1.0);
    #endif
    }

    You can modify certain light, if you prefer big bloom effect, or little!

    Less performances :(

    Tested on : Nvidia 240 Mobile Edition ( Nv240M Cuda )
     
    hans_02, Naliz, pokefrag and 6 others like this.
  2. Can you upload your .frag file so I can just replace it and/or screenshots would be nice :]
     
    Asu likes this.
  3. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Yeah, wait ;)
    * Uploading ... *
    I have bad internet connection, sorry if i'm slow :/
    Done!
     
    jerloch likes this.
  4. Villekille707

    Villekille707 Shipwright

    Messages:
    49
    Nice bloom effect, Me gusta. :D
     
    Asu likes this.
  5. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Thanks to my brother, he helped me to use 2 shaders in one code ;)

    I'm adding : Motion Blur & Smooth shader!!!
     
    FlamingDragon96 likes this.
  6. FlamingDragon96

    FlamingDragon96 Shark Slayer

    Messages:
    407
    It doesn't seem to be working for me, any chance you could actually upload the file itself already coded? You said you uploaded it but I don't see it anywhere.
     
    Asu likes this.
  7. ImAwesome

    ImAwesome Haxor

    Messages:
    496
    Yeah,just make a folder,compress it with an archiving program (7-zip,WinRar,WinZip etc.),then put your h2qx.frag file into the zip,and then upload the zip to the forums (upload a file button).
     
    Asu likes this.
  8. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Yes i know, but i'm waiting to make the final shader for zip it ;)

    Other messages about my shader?

    -> Flaming dragon : Have you ATI card? Do you set ON the smooth shader in ( Echap -> Settings -> Video )?
     
  9. FlamingDragon96

    FlamingDragon96 Shark Slayer

    Messages:
    407
    It's probably since I was trying it out on my old computer. I'll try it on the better one and see if it works! :B)::thumbs_up:
    </br>--- merged: Jul 18, 2012 7:54 AM ---</br>
    Is it possible to be able to mod in v-sync? It would make this shader look much better.
     
    Asu likes this.
  10. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Kag2d is limited to 30 fps...
    V-sync = limit to 60 = useless.
     
  11. TheCrusader

    TheCrusader Shopkeep Stealer

    Messages:
    156
    Woah! I can see why this would look good with my compilation mod/texture pack!
    You gonna upload the link?
     
    Asu likes this.
  12. FlamingDragon96

    FlamingDragon96 Shark Slayer

    Messages:
    407
    I don't think he'll upload a download since he posted the code on how to do it, but I can upload it! :B)::thumbs_up: (i'll take it down if you want AsuMagic)

    Like I always do... EXTREMELY EASY INSTALLATION! AWWW YEAH! (note: you need graphics card)
     

    Attached Files:

    Asu likes this.
  13. TheCrusader

    TheCrusader Shopkeep Stealer

    Messages:
    156
    Downloaded it quickly in case he did take it down :D
    EDIT: Unfortunately my computer is very slow so I had too bump it down to 0.05 and its still laggy :(
     
    Asu likes this.
  14. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Your graphic card need :

    - GLSL v240
    - DirectX 9.0 -> 11.1 <== Edit : EPIC FAIL! That OpenGL 2.0 and above XD

    Hmm, the shader doesn't work on certain graphic cards :

    - Intel
    - ATI

    This shader is working without problems with :

    - Nvidia



    Future of the shader pack :
    Dynamic shadows, in a long while..
    An best sky for a best bloom.
     
  15. Lieber

    Lieber Is Probing Uranus Global Moderator Forum Moderator Donator Tester

    Messages:
    787
    So I'm guessing this is PC only? Won't work on Macs?
     
  16. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    I forgot the Mac problem. Mac has got a strange compilation system for shaders..

    I can't resolve it, i don't have mac. And i don't know how to fix it.
     
  17. Lieber

    Lieber Is Probing Uranus Global Moderator Forum Moderator Donator Tester

    Messages:
    787
    I'll try and see if I can figure it out but I doubt it x)
     
    Asu likes this.
  18. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Update! HDR, Better Bloom, Color correction added!!!

    Pretty cool effect!

    /!\ The screen shot is not up to date!
     
    FlamingDragon96 likes this.
  19. It's doesn't works for me! :/
     
  20. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Please update the graphics card driver, and turn on the smooth shader.
    Do you see an compilation error in the console?