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

Squashed 



...

Status:Offline
Date registered: 13.06.2005
Post:5
Send Message
...   Created on 20.06.2005 - 01:20Jump to top Quote this post Report this post Edit Delete


My first attempt at a shader, so if you have any comments, feel free to post.

My theory behind this was that there had to be a better way to filter textures in high resolution mode (1280 x 960) than what was presented in the plugin. So, I went with a directional approach. The first four textures I grab I use to test which direction the shader should shade in, then I grab the rest of the textures from that direction and blend them all together for a nice, linear blurring effect. This shader woorks best when there is no other texture filtering/ fullscreenfiltering applied, as they tend to dilute the color values and make it harder for the filter to detect in which direction to go. One problem that I'm having is with stuff that's being rendered inside the plugin, where it's not a premade texture made for 320x240 resolution. In those cases I get an effect where there's an outline surrounding it and it looks sort of strange. Anyways, here's the code:

gpuPeteOGL2.slv
uniform vec4 OGL2Size;

void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
}

gpuPeteOGL2.slf
uniform sampler2D OGL2Texture;
uniform vec4 OGL2Size;

void main()
{
float dx = 1.0 / OGL2Size.x;
float dy = 1.0 / OGL2Size.y;
vec4 a1 = texture2D(OGL2Texture, gl_TexCoord[0].xy);
vec4 nn = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(0.0, -2.0 * dy));
vec4 ee = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(2.0 * dx, 0.0));
vec4 ss = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(0.0, 2.0 * dy));
vec4 ww = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(-2.0 * dx, 0.0));
vec2 align = vec2((int(all(lessThan(abs(a1 - ww), vec4(0.025, 0.025, 0.025, 1.0)))) - int(all(lessThan(abs(a1 - ee), vec4(0.025, 0.025, 0.025, 1.0))))) * dx, (int(all(lessThan(abs(a1 - nn), vec4(0.025, 0.025, 0.025, 1.0)))) - int(all(lessThan(abs(a1 - ss), vec4(0.025, 0.025, 0.025, 1.0))))) * dy);
vec4 b1 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(align.x, 0.0));
vec4 b2 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(0.0, align.y));
vec4 c1 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(align.x, align.y));
vec4 d1 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(2 * align.x, 0.0));
vec4 d2 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(0.0, 2 * align.y));
vec4 e1 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(2 * align.x, align.y));
vec4 e2 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(align.x, 2 * align.y));
vec4 f1 = texture2D(OGL2Texture, gl_TexCoord[0].xy + vec2(2 * align.x, 2 * align.y));
gl_FragColor = (9.0 * a1 + 3.0 * (b1 + b2 + d1 + d2) + (c1 + e1 + e2 + f1)) / 25.0;
}




Squashed 



...

Status:Offline
Date registered: 13.06.2005
Post:5
Send Message
...   Created on 20.06.2005 - 22:51Jump to top Quote this post Report this post Edit Delete


Thought I'd add a bit since when I first posted this I wasn't thinking too clearly.

This shader is designed to work at 1280 x 960 resolution with internal resolutions of x - 2, y - 2.

For an internal resolution of x: 1, y: 2, replace
float dx = 1.0 / OGL2Size.x;
float dy = 1.0 / OGL2Size.y;
with
float dx = 0.5 / OGL2Size.x;
float dy = 1.0 / OGL2Size.y;

For an internal resolution of x: 1, y: 1, replace
float dx = 1.0 / OGL2Size.x;
float dy = 1.0 / OGL2Size.y;
with
float dx = 0.5 / OGL2Size.x;
float dy = 0.5 / OGL2Size.y;

Also, I'd thought of using the fact that rgb values for textures are 5-bit and the rendered values are 8-bit to differentiate between the two so that the shader doesn't shade things that are being rendered at high resolution, but wasn't able to develop an algorithm that consistenly differentiated between the two.





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
Filter Odin 27 fruchtweinkeller
Filter BenQ 6 frank_axo
Filter Lumi 4 david1990
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!



Verwandte Suchbegriffe:
ogl2size | ogl2size pete
blank