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

Homepage Members Register Login Search Old board


Neuer Thread ...
More : [1] [2]


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

zoldrag 



...

Status:Offline
Date registered: 30.11.2011
Post:4
Send Message
...   Created on 30.11.2011 - 13:32Jump to top Quote this post Report this post Edit Delete


Hello, I think combining Natural Vision Shader Shader v2.o + AA + Bump mapping ca could give a good result for example in Final Fantasy 7 Finally, if possible

sorry for my bad English




guest ...
Real addict
.........

...

Status:Offline
Date registered: 30.07.2004
Post:854
Send Message
...   Created on 07.12.2011 - 16:29Jump to top Quote this post Report this post Edit Delete


I think i can do something to help.

Preferred settings:
- high x and y internal resolution (try low (0) with 2D games)
- fullscreen filtering ON
- shader level 1-4 (mild or strong emboss)
- window/render frame size up to 1024x768


vertex file:

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:
 

uniform vec4 OGL2Param;
uniform vec4 OGL2Size;

void main()

{
float x = 2.0/2048.0;
float y = 2.0/1024.0;
vec2 dg1 = vec2( x,y);
vec2 dg2 = vec2(-x,y);
vec2 dx  = vec2(x,0.0);
vec2 dy  = vec2(0.0,y);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1].xy = gl_TexCoord[0].xy - dy;
gl_TexCoord[2].xy = gl_TexCoord[0].xy + dy;
gl_TexCoord[3].xy = gl_TexCoord[0].xy - dx;
gl_TexCoord[4].xy = gl_TexCoord[0].xy + dx;
gl_TexCoord[5].xy = gl_TexCoord[0].xy - dg1;
gl_TexCoord[6].xy = gl_TexCoord[0].xy + dg1;
gl_TexCoord[1].zw = gl_TexCoord[0].xy - dg2;
gl_TexCoord[2].zw = gl_TexCoord[0].xy + dg2;
}






AA+Bump+NV:

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:
 
/*
   AA + BumpMapping + NV shader
   
   by guest(r) - guest.r@gmail.com
*/


const vec3 dt = vec3(1.0,1.0,1.0);

const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212, 
                           0.587,-0.275,-0.523, 
                           0.114,-0.321, 0.311);

const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
                           0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
                           0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);

const vec3 val00 = vec3( 1.2, 1.2, 1.2);

vec3 SoftAA (vec3 c00,vec3 c10,vec3 c20,vec3 c01,vec3 c11,vec3 c21,vec3 c02,vec3 c12,vec3 c22)
{
    float d1=dot(abs(c00-c22),dt)+0.001;
    float d2=dot(abs(c20-c02),dt)+0.001;
    float hl=dot(abs(c01-c21),dt)+0.001;
    float vl=dot(abs(c10-c12),dt)+0.001;

    vec3 t1=(hl*(c10+c12)+vl*(c01+c21)+(hl+vl)*c11)/(6.0*(hl+vl));
    vec3 t2=(d1*(c20+c02)+d2*(c00+c22)+(d1+d2)*c11)/(6.0*(d1+d2));

    return t1+t2;
}



uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;

void main()
{
        
    vec2 dx = vec2(2.0/4096.0,0.0);
    vec2 dy = vec2(0.0,2.0/2048.0);
    
    vec3 c00=texture2D(OGL2Texture, gl_TexCoord[5].xy      ).xyz; 
    vec3 ca0=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx   ).xyz; 
    vec3 c10=texture2D(OGL2Texture, gl_TexCoord[1].xy      ).xyz; 
    vec3 cb0=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx   ).xyz; 
    vec3 c20=texture2D(OGL2Texture, gl_TexCoord[2].zw      ).xyz; 

    vec3 c0a=texture2D(OGL2Texture, gl_TexCoord[5].xy   +dy).xyz; 
    vec3 caa=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx+dy).xyz; 
    vec3 c1a=texture2D(OGL2Texture, gl_TexCoord[1].xy   +dy).xyz; 
    vec3 cba=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx+dy).xyz; 
    vec3 c2a=texture2D(OGL2Texture, gl_TexCoord[2].zw   +dy).xyz; 

    vec3 c01=texture2D(OGL2Texture, gl_TexCoord[3].xy      ).xyz; 
    vec3 ca1=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx   ).xyz; 
    vec3 c11=texture2D(OGL2Texture, gl_TexCoord[0].xy      ).xyz; 
    vec3 cb1=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx   ).xyz; 
    vec3 c21=texture2D(OGL2Texture, gl_TexCoord[4].xy      ).xyz; 

    vec3 c0b=texture2D(OGL2Texture, gl_TexCoord[3].xy   +dy).xyz; 
    vec3 cab=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx+dy).xyz; 
    vec3 c1b=texture2D(OGL2Texture, gl_TexCoord[0].xy   +dy).xyz; 
    vec3 cbb=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx+dy).xyz; 
    vec3 c2b=texture2D(OGL2Texture, gl_TexCoord[4].xy   +dy).xyz; 

    vec3 c02=texture2D(OGL2Texture, gl_TexCoord[1].zw      ).xyz; 
    vec3 ca2=texture2D(OGL2Texture, gl_TexCoord[1].zw+dx   ).xyz; 
    vec3 c12=texture2D(OGL2Texture, gl_TexCoord[2].xy      ).xyz; 
    vec3 cb2=texture2D(OGL2Texture, gl_TexCoord[2].xy+dx   ).xyz; 
    vec3 c22=texture2D(OGL2Texture, gl_TexCoord[6].xy      ).xyz; 


    vec3 d00 = SoftAA(c00, ca0, c10, c0a, caa, c1a, c01, ca1, c11);
    vec3 d10 = SoftAA(ca0, c10, cb0, caa, c1a, cba, ca1, c11, cb1);
    vec3 d20 = SoftAA(c10, cb0, c20, c1a, cba, c2a, c11, cb1, c21);

    vec3 d01 = SoftAA(c0a, caa, c1a, c01, ca1, c11, c0b, cab, c1b);
    vec3 d11 = SoftAA(caa, c1a, cba, ca1, c11, cb1, cab, c1b, cbb);
    vec3 d21 = SoftAA(c1a, cba, c2a, c11, cb1, c21, c1b, cbb, c2b);

    vec3 d02 = SoftAA(c01, ca1, c11, c0b, cab, c1b, c02, ca2, c12);
    vec3 d12 = SoftAA(ca1, c11, cb1, cab, c1b, cbb, ca2, c12, cb2);
    vec3 d22 = SoftAA(c11, cb1, c21, c1b, cbb, c2b, c12, cb2, c22);

    float d1=dot(abs(d00-d22),dt)+0.001;
    float d2=dot(abs(d20-d02),dt)+0.001;
    float hl=dot(abs(d01-d21),dt)+0.001;
    float vl=dot(abs(d10-d12),dt)+0.001;

    vec3 t1=(hl*(d10+d12)+vl*(d01+d21)+(hl+vl)*d11)/(3.0*(hl+vl));
    vec3 t2=(d1*(d20+d02)+d2*(d00+d22)+(d1+d2)*d11)/(3.0*(d1+d2));
    
    c11 =.5*(t1+t2);
    
    float bump_param = 3.33-0.66*OGL2Param.z;
    c11 = (-d00+d22-d01+d21-d10+d12+bump_param*c11)/bump_param;
    
    c11=RGBtoYIQ*c11;

    c11=vec3(pow(c11.x,val00.x),c11.yz*val00.yz);

    gl_FragColor.xyz=YIQtoRGB*c11;
}


[Dieser Beitrag wurde am 10.04.2012 - 20:18 von guest aktualisiert]




guest ...
Real addict
.........

...

Status:Offline
Date registered: 30.07.2004
Post:854
Send Message
...   Created on 07.12.2011 - 21:55Jump to top Quote this post Report this post Edit Delete


BumpMapping effect improoved.

fragment file:

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:
 
/*
   AA + BumpMapping + NV shader
   
   by guest(r) - guest.r@gmail.com
*/

const float glow = 1.25;
const float shde = 0.75;

const vec3 dt = vec3(1.0,1.0,1.0);

const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212, 
                           0.587,-0.275,-0.523, 
                           0.114,-0.321, 0.311);

const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
                           0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
                           0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);

const vec3 val00 = vec3( 1.2, 1.2, 1.2);

vec3 SoftAA (vec3 c00,vec3 c10,vec3 c20,vec3 c01,vec3 c11,vec3 c21,vec3 c02,vec3 c12,vec3 c22)
{
    float d1=dot(abs(c00-c22),dt)+0.001;
    float d2=dot(abs(c20-c02),dt)+0.001;
    float hl=dot(abs(c01-c21),dt)+0.001;
    float vl=dot(abs(c10-c12),dt)+0.001;

    vec3 t1=(hl*(c10+c12)+vl*(c01+c21)+(hl+vl)*c11)/(6.0*(hl+vl));
    vec3 t2=(d1*(c20+c02)+d2*(c00+c22)+(d1+d2)*c11)/(6.0*(d1+d2));

    return t1+t2;
}

uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;

void main()
{
        
    vec2 dx = vec2(2.0/4096.0,0.0);
    vec2 dy = vec2(0.0,2.0/2048.0);
    
    vec3 c00=texture2D(OGL2Texture, gl_TexCoord[5].xy      ).xyz; 
    vec3 ca0=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx   ).xyz; 
    vec3 c10=texture2D(OGL2Texture, gl_TexCoord[1].xy      ).xyz; 
    vec3 cb0=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx   ).xyz; 
    vec3 c20=texture2D(OGL2Texture, gl_TexCoord[2].zw      ).xyz; 

    vec3 c0a=texture2D(OGL2Texture, gl_TexCoord[5].xy   +dy).xyz; 
    vec3 caa=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx+dy).xyz; 
    vec3 c1a=texture2D(OGL2Texture, gl_TexCoord[1].xy   +dy).xyz; 
    vec3 cba=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx+dy).xyz; 
    vec3 c2a=texture2D(OGL2Texture, gl_TexCoord[2].zw   +dy).xyz; 

    vec3 c01=texture2D(OGL2Texture, gl_TexCoord[3].xy      ).xyz; 
    vec3 ca1=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx   ).xyz; 
    vec3 c11=texture2D(OGL2Texture, gl_TexCoord[0].xy      ).xyz; 
    vec3 cb1=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx   ).xyz; 
    vec3 c21=texture2D(OGL2Texture, gl_TexCoord[4].xy      ).xyz; 

    vec3 c0b=texture2D(OGL2Texture, gl_TexCoord[3].xy   +dy).xyz; 
    vec3 cab=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx+dy).xyz; 
    vec3 c1b=texture2D(OGL2Texture, gl_TexCoord[0].xy   +dy).xyz; 
    vec3 cbb=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx+dy).xyz; 
    vec3 c2b=texture2D(OGL2Texture, gl_TexCoord[4].xy   +dy).xyz; 

    vec3 c02=texture2D(OGL2Texture, gl_TexCoord[1].zw      ).xyz; 
    vec3 ca2=texture2D(OGL2Texture, gl_TexCoord[1].zw+dx   ).xyz; 
    vec3 c12=texture2D(OGL2Texture, gl_TexCoord[2].xy      ).xyz; 
    vec3 cb2=texture2D(OGL2Texture, gl_TexCoord[2].xy+dx   ).xyz; 
    vec3 c22=texture2D(OGL2Texture, gl_TexCoord[6].xy      ).xyz; 

    
    vec3 d00 = SoftAA(c00, ca0, c10, c0a, caa, c1a, c01, ca1, c11);
    vec3 d10 = SoftAA(ca0, c10, cb0, caa, c1a, cba, ca1, c11, cb1);
    vec3 d20 = SoftAA(c10, cb0, c20, c1a, cba, c2a, c11, cb1, c21);

    vec3 d01 = SoftAA(c0a, caa, c1a, c01, ca1, c11, c0b, cab, c1b);
    vec3 d11 = SoftAA(caa, c1a, cba, ca1, c11, cb1, cab, c1b, cbb);
    vec3 d21 = SoftAA(c1a, cba, c2a, c11, cb1, c21, c1b, cbb, c2b);

    vec3 d02 = SoftAA(c01, ca1, c11, c0b, cab, c1b, c02, ca2, c12);
    vec3 d12 = SoftAA(ca1, c11, cb1, cab, c1b, cbb, ca2, c12, cb2);
    vec3 d22 = SoftAA(c11, cb1, c21, c1b, cbb, c2b, c12, cb2, c22);

    float d1=dot(abs(d00-d22),dt)+0.001;
    float d2=dot(abs(d20-d02),dt)+0.001;
    float hl=dot(abs(d01-d21),dt)+0.001;
    float vl=dot(abs(d10-d12),dt)+0.001;

    vec3 t1=(hl*(d10+d12)+vl*(d01+d21)+(hl+vl)*d11)/(3.0*(hl+vl));
    vec3 t2=(d1*(d20+d02)+d2*(d00+d22)+(d1+d2)*d11)/(3.0*(d1+d2));
    
    d11 =.5*(t1+t2);
    
    float bump_param = 3.33-0.66*OGL2Param.z;
    c11 = (-d00+d22-d01+d21-d10+d12+bump_param*d11)/bump_param;
    c11 = min(c11,glow*d11);
    c11 = max(c11,shde*d11);
    c11=RGBtoYIQ*c11;

    c11=vec3(pow(c11.x,val00.x),c11.yz*val00.yz);

    gl_FragColor.xyz=YIQtoRGB*c11;
}


Vertex file same as above.

[Dieser Beitrag wurde am 10.04.2012 - 20:33 von guest aktualisiert]




zoldrag 



...

Status:Offline
Date registered: 30.11.2011
Post:4
Send Message
...   Created on 08.12.2011 - 17:29Jump to top Quote this post Report this post Edit Delete


thank you very much for your help




guest ...
Real addict
.........

...

Status:Offline
Date registered: 30.07.2004
Post:854
Send Message
...   Created on 10.12.2011 - 21:32Jump to top Quote this post Report this post Edit Delete


NP.

I'm posting three more versions, first is great on 2nd pass smoothing, 2nd is for slower adapters. Third is with crude bump maps. Well, see it for yourselves.

1. different smoothing

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:
 
/*
   AA+BumpMapping+NV shader
   
   by guest(r) - guest.r@gmail.com
*/


const float glow = 1.25;
const float shde = 0.75;

const vec3 dt = vec3(1.0,1.0,1.0);

const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212, 
                           0.587,-0.275,-0.523, 
                           0.114,-0.321, 0.311);

const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
                           0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
                           0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);

const vec3 val00 = vec3( 1.2, 1.2, 1.2);

vec3 SoftAA (vec3 c00,vec3 c10,vec3 c20,vec3 c01,vec3 c11,vec3 c21,vec3 c02,vec3 c12,vec3 c22)
{
    float d1=dot(abs(c00-c22),dt)+0.001;
    float d2=dot(abs(c20-c02),dt)+0.001;
    float hl=dot(abs(c01-c21),dt)+0.001;
    float vl=dot(abs(c10-c12),dt)+0.001;

    vec3 t1=(hl*(c10+c12)+vl*(c01+c21)+(hl+vl)*c11)/(6.0*(hl+vl));
    vec3 t2=(d1*(c20+c02)+d2*(c00+c22)+(d1+d2)*c11)/(6.0*(d1+d2));

    return t1+t2;
}



uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;

void main()
{
        
    vec2 dx = vec2(2.0/4096.0,0.0);
    vec2 dy = vec2(0.0,2.0/2048.0);
    
    vec3 c00=texture2D(OGL2Texture, gl_TexCoord[5].xy      ).xyz; 
    vec3 ca0=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx   ).xyz; 
    vec3 c10=texture2D(OGL2Texture, gl_TexCoord[1].xy      ).xyz; 
    vec3 cb0=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx   ).xyz; 
    vec3 c20=texture2D(OGL2Texture, gl_TexCoord[2].zw      ).xyz; 

    vec3 c0a=texture2D(OGL2Texture, gl_TexCoord[5].xy   +dy).xyz; 
    vec3 caa=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx+dy).xyz; 
    vec3 c1a=texture2D(OGL2Texture, gl_TexCoord[1].xy   +dy).xyz; 
    vec3 cba=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx+dy).xyz; 
    vec3 c2a=texture2D(OGL2Texture, gl_TexCoord[2].zw   +dy).xyz; 

    vec3 c01=texture2D(OGL2Texture, gl_TexCoord[3].xy      ).xyz; 
    vec3 ca1=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx   ).xyz; 
    vec3 c11=texture2D(OGL2Texture, gl_TexCoord[0].xy      ).xyz; 
    vec3 cb1=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx   ).xyz; 
    vec3 c21=texture2D(OGL2Texture, gl_TexCoord[4].xy      ).xyz; 

    vec3 c0b=texture2D(OGL2Texture, gl_TexCoord[3].xy   +dy).xyz; 
    vec3 cab=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx+dy).xyz; 
    vec3 c1b=texture2D(OGL2Texture, gl_TexCoord[0].xy   +dy).xyz; 
    vec3 cbb=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx+dy).xyz; 
    vec3 c2b=texture2D(OGL2Texture, gl_TexCoord[4].xy   +dy).xyz; 

    vec3 c02=texture2D(OGL2Texture, gl_TexCoord[1].zw      ).xyz; 
    vec3 ca2=texture2D(OGL2Texture, gl_TexCoord[1].zw+dx   ).xyz; 
    vec3 c12=texture2D(OGL2Texture, gl_TexCoord[2].xy      ).xyz; 
    vec3 cb2=texture2D(OGL2Texture, gl_TexCoord[2].xy+dx   ).xyz; 
    vec3 c22=texture2D(OGL2Texture, gl_TexCoord[6].xy      ).xyz; 


    vec3 d00 = SoftAA(c00, ca0, c10, c0a, caa, c1a, c01, ca1, c11);
    vec3 d10 = SoftAA(ca0, c10, cb0, caa, c1a, cba, ca1, c11, cb1);
    vec3 d20 = SoftAA(c10, cb0, c20, c1a, cba, c2a, c11, cb1, c21);

    vec3 d01 = SoftAA(c0a, caa, c1a, c01, ca1, c11, c0b, cab, c1b);
    vec3 d11 = SoftAA(caa, c1a, cba, ca1, c11, cb1, cab, c1b, cbb);
    vec3 d21 = SoftAA(c1a, cba, c2a, c11, cb1, c21, c1b, cbb, c2b);

    vec3 d02 = SoftAA(c01, ca1, c11, c0b, cab, c1b, c02, ca2, c12);
    vec3 d12 = SoftAA(ca1, c11, cb1, cab, c1b, cbb, ca2, c12, cb2);
    vec3 d22 = SoftAA(c11, cb1, c21, c1b, cbb, c2b, c12, cb2, c22);

    float d1=1.0/(dot(abs(d00-d22),dt)+0.00001);
    float d2=1.0/(dot(abs(d20-d02),dt)+0.00001);
    float hl=1.0/(dot(abs(d01-d21),dt)+0.00001);
    float vl=1.0/(dot(abs(d10-d12),dt)+0.00001);

    d11 = ((vl*(d10+d12)+hl*(d01+d21)+d2*(d20+d02)+d1*(d00+d22))/(hl+vl+d1+d2)+d11)/3.0;
    
    float bump_param = 3.33-0.66*OGL2Param.z;
    c11 = (-d00+d22-d01+d21-d10+d12+bump_param*d11)/bump_param;
    c11 = min(c11,glow*d11);
    c11 = max(c11,shde*d11);
    c11=RGBtoYIQ*c11;

    c11=vec3(pow(c11.x,val00.x),c11.yz*val00.yz);

    gl_FragColor.xyz=YIQtoRGB*c11;
    
    
}


2. Small speedup
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:
 
/*
   AA+BumpMapping shader
   
   by guest(r) - guest.r@gmail.com
*/


const float glow = 1.15;
const float shde = 0.85;

const vec3 dt = vec3(1.0,1.0,1.0);

vec3 SoftAA (vec3 c00,vec3 c10,vec3 c20,vec3 c01,vec3 c11,vec3 c21,vec3 c02,vec3 c12,vec3 c22)
{
    float d1=dot(abs(c00-c22),dt)+0.001;
    float d2=dot(abs(c20-c02),dt)+0.001;
    float hl=dot(abs(c01-c21),dt)+0.001;
    float vl=dot(abs(c10-c12),dt)+0.001;

    vec3 t1=(hl*(c10+c12)+vl*(c01+c21)+(hl+vl)*c11)/(6.0*(hl+vl));
    vec3 t2=(d1*(c20+c02)+d2*(c00+c22)+(d1+d2)*c11)/(6.0*(d1+d2));

    return t1+t2;
}



uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;

void main()
{
        
    vec2 dx = vec2(0.00048828125,0.0);
    vec2 dy = vec2(0.0,0.00097656250);
    
    vec3 c00=texture2D(OGL2Texture, gl_TexCoord[5].xy      ).xyz; 
    vec3 ca0=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx   ).xyz; 
    vec3 c10=texture2D(OGL2Texture, gl_TexCoord[1].xy      ).xyz; 
    vec3 cb0=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx   ).xyz; 
    vec3 c20=texture2D(OGL2Texture, gl_TexCoord[2].zw      ).xyz; 

    vec3 c0a=texture2D(OGL2Texture, gl_TexCoord[5].xy   +dy).xyz; 
    vec3 caa=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx+dy).xyz; 
    vec3 c1a=texture2D(OGL2Texture, gl_TexCoord[1].xy   +dy).xyz; 
    vec3 cba=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx+dy).xyz; 
    vec3 c2a=texture2D(OGL2Texture, gl_TexCoord[2].zw   +dy).xyz; 

    vec3 c01=texture2D(OGL2Texture, gl_TexCoord[3].xy      ).xyz; 
    vec3 ca1=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx   ).xyz; 
    vec3 c11=texture2D(OGL2Texture, gl_TexCoord[0].xy      ).xyz; 
    vec3 cb1=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx   ).xyz; 
    vec3 c21=texture2D(OGL2Texture, gl_TexCoord[4].xy      ).xyz; 

    vec3 c0b=texture2D(OGL2Texture, gl_TexCoord[3].xy   +dy).xyz; 
    vec3 cab=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx+dy).xyz; 
    vec3 c1b=texture2D(OGL2Texture, gl_TexCoord[0].xy   +dy).xyz; 
    vec3 cbb=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx+dy).xyz; 
    vec3 c2b=texture2D(OGL2Texture, gl_TexCoord[4].xy   +dy).xyz; 

    vec3 c02=texture2D(OGL2Texture, gl_TexCoord[1].zw      ).xyz; 
    vec3 ca2=texture2D(OGL2Texture, gl_TexCoord[1].zw+dx   ).xyz; 
    vec3 c12=texture2D(OGL2Texture, gl_TexCoord[2].xy      ).xyz; 
    vec3 cb2=texture2D(OGL2Texture, gl_TexCoord[2].xy+dx   ).xyz; 
    vec3 c22=texture2D(OGL2Texture, gl_TexCoord[6].xy      ).xyz; 

    vec3 d00 = SoftAA(c00, ca0, c10, c0a, caa, c1a, c01, ca1, c11);
    vec3 d10 = SoftAA(ca0, c10, cb0, caa, c1a, cba, ca1, c11, cb1);
    vec3 d01 = SoftAA(c0a, caa, c1a, c01, ca1, c11, c0b, cab, c1b);
    vec3 d11 = SoftAA(caa, c1a, cba, ca1, c11, cb1, cab, c1b, cbb);
    vec3 d21 = SoftAA(c1a, cba, c2a, c11, cb1, c21, c1b, cbb, c2b);
    vec3 d12 = SoftAA(ca1, c11, cb1, cab, c1b, cbb, ca2, c12, cb2);
    vec3 d22 = SoftAA(c11, cb1, c21, c1b, cbb, c2b, c12, cb2, c22);

    float bump_param = 3.33-0.66*OGL2Param.z;
    c11 = (-d00+d22-d01+d21-d10+d12+bump_param*d11)/bump_param;

    c11 = min(c11,glow*d11);
    gl_FragColor.xyz = max(c11,shde*d11);
    
}


3. Plain edition (crude emboss)
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:
 
/*
   AA + BumpMapping + NV shader
   
   by 2011 guest(r) - guest.r@gmail.com
*/

const float glow = 1.25;
const float shde = 0.75;

const vec3 dt = vec3(1.0,1.0,1.0);

const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212, 
                           0.587,-0.275,-0.523, 
                           0.114,-0.321, 0.311);

const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
                           0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
                           0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);

const vec3 val00 = vec3( 1.2, 1.2, 1.2);

uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;

void main()
{
    vec3 c00 = texture2D(OGL2Texture, gl_TexCoord[5].xy).xyz; 
    vec3 c10 = texture2D(OGL2Texture, gl_TexCoord[1].xy).xyz; 
    vec3 c20 = texture2D(OGL2Texture, gl_TexCoord[2].zw).xyz; 
    vec3 c01 = texture2D(OGL2Texture, gl_TexCoord[3].xy).xyz; 
    vec3 c11 = texture2D(OGL2Texture, gl_TexCoord[0].xy).xyz; 
    vec3 c21 = texture2D(OGL2Texture, gl_TexCoord[4].xy).xyz; 
    vec3 c02 = texture2D(OGL2Texture, gl_TexCoord[1].zw).xyz; 
    vec3 c12 = texture2D(OGL2Texture, gl_TexCoord[2].xy).xyz; 
    vec3 c22 = texture2D(OGL2Texture, gl_TexCoord[6].xy).xyz; 
    vec3 dt = vec3(1.0,1.0,1.0); 

    float d1=dot(abs(c00-c22),dt)+0.0001;
    float d2=dot(abs(c20-c02),dt)+0.0001;
    float hl=dot(abs(c01-c21),dt)+0.0001;
    float vl=dot(abs(c10-c12),dt)+0.0001;

    float md = d1+d2;   float mc = hl+vl;
    hl*=  md;vl*= md;   d1*=  mc;d2*= mc;
    
    float ww = d1+d2+hl+vl;
        
    vec3 d11= (hl*(c10+c12)+vl*(c01+c21)+d1*(c20+c02)+d2*(c00+c22)+ww*c11)/(3.0*ww);
    
    float bump_param = 1.33;
    c11 = (-c00+c22-c01+c21-c10+c12+bump_param*d11)/bump_param;
    c11 = min(c11,glow*d11);
    c11 = max(c11,shde*d11);
    c11=RGBtoYIQ*c11;

    c11=vec3(pow(c11.x,val00.x),c11.yz*val00.yz);

    gl_FragColor.xyz=YIQtoRGB*c11;

}


Vertex file for first two is posted above, use AA 2.o vertex file for the last shader.

[Dieser Beitrag wurde am 10.04.2012 - 20:16 von guest aktualisiert]




zoldrag 



...

Status:Offline
Date registered: 30.11.2011
Post:4
Send Message
...   Created on 10.12.2011 - 22:46Jump to top Quote this post Report this post Edit Delete


well thank you once again, it's a great job.
is much more beautiful thanks to you




guest ...
Real addict
.........

...

Status:Offline
Date registered: 30.07.2004
Post:854
Send Message
...   Created on 13.12.2011 - 16:02Jump to top Quote this post Report this post Edit Delete


Another friendly looking variation.

It's a customisable version which fits some emulated (imagined) lighting condition in an appropriate manner.

Please use the vertex file from my first post.

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:
 
/*
   AA+BumpMapping shader
   
   by guest(r) - guest.r@gmail.com
*/

const float embs = 1.33;
const float glow = 1.25;
const float koef = 0.75;

const vec3 dt = vec3(1.0,1.0,1.0);


vec3 SoftAA (vec3 c00,vec3 c10,vec3 c20,vec3 c01,vec3 c11,vec3 c21,vec3 c02,vec3 c12,vec3 c22)
{
    float d1=dot(abs(c00-c22),dt)+0.001;
    float d2=dot(abs(c20-c02),dt)+0.001;
    float hl=dot(abs(c01-c21),dt)+0.001;
    float vl=dot(abs(c10-c12),dt)+0.001;

    vec3 t1=(hl*(c10+c12)+vl*(c01+c21)+(hl+vl)*c11)/(6.0*(hl+vl));
    vec3 t2=(d1*(c20+c02)+d2*(c00+c22)+(d1+d2)*c11)/(6.0*(d1+d2));

    return t1+t2;
}

uniform sampler2D OGL2Texture;
uniform vec4 OGL2Param;

void main()
{
        
    vec2 dx = vec2(2.0/4096.0,0.0);
    vec2 dy = vec2(0.0,2.0/2048.0);
    
    vec3 c00=texture2D(OGL2Texture, gl_TexCoord[5].xy      ).xyz; 
    vec3 ca0=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx   ).xyz; 
    vec3 c10=texture2D(OGL2Texture, gl_TexCoord[1].xy      ).xyz; 
    vec3 cb0=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx   ).xyz; 
    vec3 c20=texture2D(OGL2Texture, gl_TexCoord[2].zw      ).xyz; 

    vec3 c0a=texture2D(OGL2Texture, gl_TexCoord[5].xy   +dy).xyz; 
    vec3 caa=texture2D(OGL2Texture, gl_TexCoord[5].xy+dx+dy).xyz; 
    vec3 c1a=texture2D(OGL2Texture, gl_TexCoord[1].xy   +dy).xyz; 
    vec3 cba=texture2D(OGL2Texture, gl_TexCoord[1].xy+dx+dy).xyz; 
    vec3 c2a=texture2D(OGL2Texture, gl_TexCoord[2].zw   +dy).xyz; 

    vec3 c01=texture2D(OGL2Texture, gl_TexCoord[3].xy      ).xyz; 
    vec3 ca1=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx   ).xyz; 
    vec3 c11=texture2D(OGL2Texture, gl_TexCoord[0].xy      ).xyz; 
    vec3 cb1=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx   ).xyz; 
    vec3 c21=texture2D(OGL2Texture, gl_TexCoord[4].xy      ).xyz; 

    vec3 c0b=texture2D(OGL2Texture, gl_TexCoord[3].xy   +dy).xyz; 
    vec3 cab=texture2D(OGL2Texture, gl_TexCoord[3].xy+dx+dy).xyz; 
    vec3 c1b=texture2D(OGL2Texture, gl_TexCoord[0].xy   +dy).xyz; 
    vec3 cbb=texture2D(OGL2Texture, gl_TexCoord[0].xy+dx+dy).xyz; 
    vec3 c2b=texture2D(OGL2Texture, gl_TexCoord[4].xy   +dy).xyz; 

    vec3 c02=texture2D(OGL2Texture, gl_TexCoord[1].zw      ).xyz; 
    vec3 ca2=texture2D(OGL2Texture, gl_TexCoord[1].zw+dx   ).xyz; 
    vec3 c12=texture2D(OGL2Texture, gl_TexCoord[2].xy      ).xyz; 
    vec3 cb2=texture2D(OGL2Texture, gl_TexCoord[2].xy+dx   ).xyz; 
    vec3 c22=texture2D(OGL2Texture, gl_TexCoord[6].xy      ).xyz; 

    
    vec3 d00 = SoftAA(c00, ca0, c10, c0a, caa, c1a, c01, ca1, c11);
    vec3 d10 = SoftAA(ca0, c10, cb0, caa, c1a, cba, ca1, c11, cb1);
    vec3 d20 = SoftAA(c10, cb0, c20, c1a, cba, c2a, c11, cb1, c21);

    vec3 d01 = SoftAA(c0a, caa, c1a, c01, ca1, c11, c0b, cab, c1b);
    vec3 d11 = SoftAA(caa, c1a, cba, ca1, c11, cb1, cab, c1b, cbb);
    vec3 d21 = SoftAA(c1a, cba, c2a, c11, cb1, c21, c1b, cbb, c2b);

    vec3 d02 = SoftAA(c01, ca1, c11, c0b, cab, c1b, c02, ca2, c12);
    vec3 d12 = SoftAA(ca1, c11, cb1, cab, c1b, cbb, ca2, c12, cb2);
    vec3 d22 = SoftAA(c11, cb1, c21, c1b, cbb, c2b, c12, cb2, c22);

    float d1=dot(abs(d00-d22),dt)+0.001;
    float d2=dot(abs(d20-d02),dt)+0.001;
    float hl=dot(abs(d01-d21),dt)+0.001;
    float vl=dot(abs(d10-d12),dt)+0.001;

    vec3 t1=(hl*(d10+d12)+vl*(d01+d21)+(hl+vl)*d11)/(3.0*(hl+vl));
    vec3 t2=(d1*(d20+d02)+d2*(d00+d22)+(d1+d2)*d11)/(3.0*(d1+d2));
    
    d11 =.5*(t1+t2);
    
    float bump_param = 3.33-0.66*OGL2Param.z;
    c11 = (-d00+d22-d01+d21-d10+d12+bump_param*d11)/bump_param;

    float dif1 = length(c11)-length(d11);
    float dif2 = length(d11) + dif1*embs;
             
    gl_FragColor.xyz=clamp(normalize(c11)*dif2,d11*koef,d11*glow);
}


[Dieser Beitrag wurde am 16.01.2012 - 19:32 von guest aktualisiert]




zoldrag 



...

Status:Offline
Date registered: 30.11.2011
Post:4
Send Message
...   Created on 13.12.2011 - 17:14Jump to top Quote this post Report this post Edit Delete


good job, it's really nice, thank you




Z 
Real addict
.........

...

Status:Offline
Date registered: 03.08.2005
Post:103
Send Message
...   Created on 15.12.2011 - 05:32Jump to top Quote this post Report this post Edit Delete


Could anyone post some comparision screenshots with and without these shaders?

Unfortunately, I'm unable to do that right now...


Great to see some life in this board.




Gankfest 



...

Status:Offline
Date registered: 21.07.2013
Post:1
Send Message
...   Created on 21.07.2013 - 03:30Jump to top Quote this post Report this post Edit Delete


How can I copy the source code and make it into an slv/slf file?




More : [1] [2]

Similarly threads:
Topics Created by Replies Boardname
Natural Vision Shader + AA Shader v2.o = Best Shader for 2d !! zaykho 16 pete_bernert
Combine shaders ? Parrappa 1 pete_bernert
Psx Texture types ProtoKO 0 pete_bernert
Combine Tournament 2010 Fiend 7 bloodysystem
xbr shader pmc2 26 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!



blank