Pete´s Messageboard... No ISO/BIOS requests!

Homepage Members Register Login Search Old board


Neuer Thread ...


AuthorTopics » Book an abo for this threadClose Thread Move Thread Fix the thread Print view Delete this thread

MegaManJuno 
Strong supporter
......

...

Status:Offline
Date registered: 28.02.2006
Post:34
Send Message
...   Created on 21.10.2006 - 08:42Jump to top Quote this post Report this post Edit Delete


I'm releasing the newest version of my 4-in-1 shader as version 1.10.

This version does away with the RGB to HSL conversions, and instead of relying on the texel's actual luminance value, it instead is based on an algorithm for a perceived brightness of the color. I did this initally as a test to see what difference it would make, and I think it comes across better on games with more textures than the older versions.

Also, I've changed the outline drawing a bit, as it seemed the dot() function was a major point of slowness in the old ones. Outlines may be a little less noticeable or a little more "messy" in some places as a result, but the speed increase I think is worth it.

Some new screen shots have been posted over on my PutFile page.

As always, constructive feedback and comments are welcome. Also, if you have any screen shots that you would like to share of this shader in action, feel free to post them or links to them here... I'm always interested in seeing how it looks in other games I may not have tried out or may not own.

SLV (gpuPeteOGL2.slv)

Code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
 

// MMJ's 4-in-1 Shader - v1.10
//
// Shader Level settings will change the "mode" used
//
// 1 - Pencil mode
// 2 - Chalk & Charcoal mode
// 3 - 1/2 Strength Normal mode
// 4 - Full Strength Normal mode
//
// -----------
// MegaManJuno

uniform vec4 OGL2InvSize;

void main() {
    vec4 offset;

    float x = OGL2InvSize.x * 1.5;
    float y = OGL2InvSize.y * 1.5;

    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

    gl_TexCoord[0] = gl_MultiTexCoord0.xyxy;

    offset.xy = -(offset.zw = vec2(x, 0.0));
    gl_TexCoord[1] = gl_TexCoord[0] + offset;

    offset.xy = -(offset.zw = vec2(0.0, y));
    gl_TexCoord[2] = gl_TexCoord[0] + offset;
    gl_TexCoord[3] = gl_TexCoord[1] + offset;
}



SLF (gpuPeteOGL2.slf)
Code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
 

// MMJ's 4-in-1 Shader - v1.10
//
// Shader Level settings will change the "mode" used
//
// 1 - Pencil Mode
// 2 - Chalk & Charcoal mode
// 3 - 1/2 Strength Normal mode
// 4 - Full Strength Normal mode
//
// -----------
// MegaManJuno

uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;

vec3 colorAdjust(in vec3 cRGB, in float L) {
    // absolute white level cutoff
    float aw = 0.97; // default: 0.97

    // absolute black level cutoff
    float ab = 0.03; // default: 0.03

    // number of shading levels (not counting absolute white and black levels)
    float sl = 7.0; // default: 7.0

    // color range per shading level
    float cr = 1.0 / sl; // default: 1.0 / sl

    // brightness modifier
    float ml = mod(L, cr); // default: mod(L, cr)

    float L2 = 0.0;

    float cs = float(int(L / cr)); float cn = cs * cr; float cx = cn + cr;

    // normal modes
    if(OGL2Param.z > 1.0) {
        if     (L > aw) { L2 = 1.0; }
        else if(L > ab) { L2 = clamp(L + (((L / cx) * cr) - ml), cn, cx); }
        else            { L2 = 0.0; }
        cRGB += vec3(L2 - L);

    } else {
        // Pencil mode
        if(OGL2Param.z == 0.0) {
            if     (L > aw) { L2 = 1.0; }
            else if(L > ab) { L2 = clamp(L + ((((L / cx) * cr) - ml)), cn, cx) + 0.1; }
            else            { L2 = 0.1; }

        // Chalk & Charcoal mode
        } else {
            if     (L > aw) { L2 = 0.9; }
            else if(L > ab) { L2 = clamp(L + ((((L / cx) * cr) - ml)), cn, cx); }
            else            { L2 = 0.0; }
        }
        cRGB = vec3(L2);
    }
    return cRGB;
}

void main(void) {
    vec3 c0 = texture2D(OGL2Texture, gl_TexCoord[3].xy).rgb;
    vec3 c1 = texture2D(OGL2Texture, gl_TexCoord[2].xy).rgb;
    vec3 c2 = texture2D(OGL2Texture, gl_TexCoord[3].zy).rgb;
    vec3 c3 = texture2D(OGL2Texture, gl_TexCoord[1].xy).rgb;
    vec3 c4 = texture2D(OGL2Texture, gl_TexCoord[0].xy).rgb;
    vec3 c5 = texture2D(OGL2Texture, gl_TexCoord[1].zw).rgb;
    vec3 c6 = texture2D(OGL2Texture, gl_TexCoord[3].xw).rgb;
    vec3 c7 = texture2D(OGL2Texture, gl_TexCoord[2].zw).rgb;
    vec3 c8 = texture2D(OGL2Texture, gl_TexCoord[3].zw).rgb;
    vec3 c9 = ((c0 + c2 + c6 + c8) * 0.5 + (c1 + c3 + c5 + c7) * 0.75 + c4) / 6.0;

    float L0 = sqrt(0.241 * pow(c0.r, 2.0) + 0.691 * pow(c0.g, 2.0) + 0.068 * pow(c0.b, 2.0));
    float L1 = sqrt(0.241 * pow(c1.r, 2.0) + 0.691 * pow(c1.g, 2.0) + 0.068 * pow(c1.b, 2.0));
    float L2 = sqrt(0.241 * pow(c2.r, 2.0) + 0.691 * pow(c2.g, 2.0) + 0.068 * pow(c2.b, 2.0));
    float L3 = sqrt(0.241 * pow(c3.r, 2.0) + 0.691 * pow(c3.g, 2.0) + 0.068 * pow(c3.b, 2.0));
    float L5 = sqrt(0.241 * pow(c5.r, 2.0) + 0.691 * pow(c5.g, 2.0) + 0.068 * pow(c5.b, 2.0));
    float L6 = sqrt(0.241 * pow(c6.r, 2.0) + 0.691 * pow(c6.g, 2.0) + 0.068 * pow(c6.b, 2.0));
    float L7 = sqrt(0.241 * pow(c7.r, 2.0) + 0.691 * pow(c7.g, 2.0) + 0.068 * pow(c7.b, 2.0));
    float L8 = sqrt(0.241 * pow(c8.r, 2.0) + 0.691 * pow(c8.g, 2.0) + 0.068 * pow(c8.b, 2.0));
    float L9 = sqrt(0.241 * pow(c9.r, 2.0) + 0.691 * pow(c9.g, 2.0) + 0.068 * pow(c9.b, 2.0));

    float LV = 0.0;

    float d1 = abs(L0 - L8); float d2 = abs(L1 - L7);
    float d3 = abs(L2 - L6); float d4 = abs(L3 - L5);

    float d = (d1 + d2 + d3 + d4) * 0.25;

    if(OGL2Param.z == 1.0) { LV = clamp(L9 + d, 0.0, 1.0); }
    else                   { LV = clamp(L9 - d, 0.0, 1.0); }

    c9 = colorAdjust(c9, L9) + vec3(LV - L9);

    if(OGL2Param.z > 1.0) {
        // 1/2 Normal mode
        if(OGL2Param.z == 2.0) { gl_FragColor.rgb = mix(c4, c9, 0.5); }

        // Full Normal mode
        else { gl_FragColor.rgb = c9; }

    } else {
        // Pencil Mode
        if(OGL2Param.z == 0.0) { if(c9.g < 0.1) { c9.rgb = vec3(0.1); } gl_FragColor.rgb = c9; }

        // Chalk & Charcoal mode
        else { if(c9.g > 0.9) { c9.rgb = vec3(0.9); } gl_FragColor.rgb = c9; }
    }
}





Signature

Iron 



...

Status:Offline
Date registered: 28.03.2007
Post:2
Send Message
...   Created on 28.03.2007 - 13:36Jump to top Quote this post Report this post Edit Delete


I really would like to try this shader, sadly it crashes my ati Radeon 9600 everytime even with different emulators. I tried your other version as well but no luck yet. Nonetheless great work (from what I saw on the screenshots).




MegaManJuno 
Strong supporter
......

...

Status:Offline
Date registered: 28.02.2006
Post:34
Send Message
...   Created on 28.03.2007 - 17:43Jump to top Quote this post Report this post Edit Delete


Iron schrieb

    I really would like to try this shader, sadly it crashes my ati Radeon 9600 everytime even with different emulators. I tried your other version as well but no luck yet. Nonetheless great work (from what I saw on the screenshots).


By chance, are you running this on Linux? If so, I've seen similar reports in the past on other shaders too. I believe the fix may have been to add line breaks in order to have the curly-braces ({ and }) on thier own respective lines.

...Something to do with a difference in how the Linux version of the plugin parses the file vs. the Windows version or something like that, I think.





Signature

Iron 



...

Status:Offline
Date registered: 28.03.2007
Post:2
Send Message
...   Created on 28.03.2007 - 17:53Jump to top Quote this post Report this post Edit Delete


No, windows XP sp2 with Catalyst drivers here. Ah well thanks for the reply tho and keep it up.





Similarly threads:
Topics Created by Replies Boardname
Natural Vision Shader + AA Shader v2.o = Best Shader for 2d !! zaykho 16 pete_bernert
another CRT-TV shader aliaspider -1 pete_bernert
PSX shader guest 8 pete_bernert
Shader Aquamarin 0 schaddi
What's a Shader Near 1 pete_bernert
Neuer Thread ...





Masthead

This forum is a free service of razyboard.com
Do you want a free forum in less than two minutes? Then click here!



Verwandte Suchbegriffe:
0.068 0.691 rgb | hsl color shader | arb shader pow | pencil arb shader
blank