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

VerGreeneyes 
Strong supporter
......

...

Status:Offline
Date registered: 26.04.2007
Post:89
Send Message
...   Created on 11.05.2007 - 20:19Jump to top Quote this post Report this post Edit Delete


Weighed Average filter v3:
I've completely rewritten and optimised this filter, so that it's now 'done'. I'm not sure if it looks as good as the first version, but that had a mistake in it that somehow gave good results (but made it impossible to optimise). Enjoy!

Vertex file:

Code:
1:
2:
3:
4:
 
void main(){
    gl_Position = ftransform();
    gl_TexCoord[0] = gl_MultiTexCoord0;
}
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:
 
const float pi = 1.570796326794896619231321691640;
const vec2 pC4 = gl_TexCoord[0].xy;
uniform vec4 OGL2Size,OGL2InvSize;
uniform sampler2D OGL2Texture;

vec4 wAverage();

void main(){
    gl_FragColor = wAverage();
}

vec4 wAverage(){
    vec2 fp = fract(pC4*OGL2Size.xy),
         dx = vec2(OGL2InvSize.x,0.),
         dy = vec2(0.,OGL2InvSize.y);
    if(fp.x >= .5){dx = -dx; fp.x = 1. - fp.x;}
    if(fp.y >= .5){dy = -dy; fp.y = 1. - fp.y;}
    mat2 gp = mat2((fp+.5)*(fp+.5),(fp-.5)*(fp-.5));
    vec4 c = vec4(gp[0][0]+gp[0][1],gp[0][0]+gp[1][1],
                  gp[1][0]+gp[0][1],gp[1][0]+gp[1][1];
    mat4 C = mat4(texture2D(OGL2Texture,pC4-dx-dy),
                  texture2D(OGL2Texture,pC4-dx   ),
                  texture2D(OGL2Texture,pC4-dy   ),
                  texture2D(OGL2Texture,pC4      ));
    c = -sqrt(c);
    if(c.x < -1.)c.x=-1.;if(c.y < -1.)c.y=-1.;if(c.z < -1.)c.z=-1.;
    c = cos(pi*c);
    return (C[0]*c.x+C[1]*c.y+C[2]*c.z+C[3]*c.w)/(c.x+c.y+c.z+c.w);
}


Update: it's smaller and faster; inspired by my work on combining it with the 2xSaI filter.

[Dieser Beitrag wurde am 21.09.2007 - 23:07 von VerGreeneyes aktualisiert]




Z 
Strong supporter
......

...

Status:Offline
Date registered: 03.08.2005
Post:72
Send Message
...   Created on 16.05.2007 - 12:05Jump to top Quote this post Report this post Edit Delete


Can you give a description of what exactly the shader does, how it effects graphics, and what type of games (2D, 3D or a mix of both) it's best suited for?

That would be very nice.
Maybe we can do this with all shaders posted.


I will leave feedback on your shader when I got my new system running, can't wait to try it out.




VerGreeneyes 
Strong supporter
......

...

Status:Offline
Date registered: 26.04.2007
Post:89
Send Message
...   Created on 16.05.2007 - 12:22Jump to top Quote this post Report this post Edit Delete


Sure; the original release had more of a description anyway.

This filter treats every pixel as if it were a perfect sphere. These spheres overlap, and the colour you see at a certain coordinate is calculated by adding up the average colour times depth of the overlapping spheres in that point and dividing the result by their joint depth.
More simply put, this filter blurs the edges between pixels, but in a slightly more intelligent way than usual.
This filter works best on 2D scenes, as it sees the scene in 2D. It's pretty fast, so I'm using it as a base to combine with 2x filters such as 2xSaI to smooth them out. (the result with 2xSaI is very impressive in 2D games, but unfortunately doesn't seem to work on all cards due to its complexity; if you want to give it a try though, it's in the 2xSaI topic)

[Dieser Beitrag wurde am 16.05.2007 - 12:23 von VerGreeneyes aktualisiert]





Similarly threads:
Topics Created by Replies Boardname
Wie findet ihr MoFi (Modified Filter) - AIM Crash Filter TsunamiDT 0 tsunamidt
CW-Filter: YF-110C, 500-Hz-CW-Filter 455 kHz DE1BUH 0 do2qp
Average wow Powerleveling price be falls during Christmas ! fgame 2 lisa19
Average wow Powerleveling price be falls during Christmas ! fgame 0 lisa19
Average wow Powerleveling price be falls during Christmas ! fgame 0 lisa19
Neuer Thread ...





Masthead

This forum is a free service of razyboard.com powered by:
Geizkragen Price Comparison. Top product in the price comparison: Krups Nespresso Essenza (XN2001)
Do you want a free forum in less than two minutes? Then click here!



blank