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

Homepage Members Register Login Search Old board


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


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

PeteBernert 
Admin
...............

...

Status:Offline
Date registered: 04.10.2003
Post:818
Send Message
...   Created on 07.11.2004 - 14:52Jump to top Quote this post Report this post Edit Delete


I am monitoring this thread, so ppl, feel free to discuss/post your shaders here. If somebody thinks he has done a nice one, worthy for release, make a "complete post", showing the fragment & vertex shader, and a small description what the shader is doing and on what cards it is working... and if he/she wants, I can put it on my site, no problem.




<Luigi>
unregistried

...   Created on 08.11.2004 - 11:51Jump to top Quote this post Report this post Edit Delete


I have ported the "Emboss Shader" from ShadX (page 1 of this thread) to ARBvp/ARBfp (this time without errors, I hope) whit a little modification for color glitch reduction. Tested on NV 6800:

!!ARBvp1.0

OPTION ARB_position_invariant;

# program.env[1].x/y will give the plugin's "effect level" offset

PARAM filterOffset = program.env[1];

ATTRIB sample = vertex.texcoord[ 0 ];

# gl_TexCoord[0] = gl_MultiTexCoord0; //center
# gl_TexCoord[1] = gl_TexCoord[0] - offsetx ; //left
# gl_TexCoord[2] = gl_TexCoord[0] - offsetx - offsety; //top-left
# gl_TexCoord[3] = gl_TexCoord[0] - offsety ; //top
# gl_TexCoord[4] = gl_TexCoord[0] + offsetx ; //right
# gl_TexCoord[5] = gl_TexCoord[0] + offsetx + offsety; //bottom-right
# gl_TexCoord[6] = gl_TexCoord[0] + offsety ; //bottom

MOV result.texcoord[ 0 ].x, sample.x;
MOV result.texcoord[ 0 ].y, sample.y;
ADD result.texcoord[ 1 ].x, sample.x, -filterOffset.x;
MOV result.texcoord[ 1 ].y, sample.y;
ADD result.texcoord[ 2 ].x, sample.x, -filterOffset.x;
ADD result.texcoord[ 2 ].y, sample.y, -filterOffset.y;
MOV result.texcoord[ 3 ].x, sample.x;
ADD result.texcoord[ 3 ].y, sample.y, -filterOffset.y;
ADD result.texcoord[ 4 ].x, sample.x, filterOffset.x;
MOV result.texcoord[ 4 ].y, sample.y;
ADD result.texcoord[ 5 ].x, sample.x, filterOffset.x;
ADD result.texcoord[ 5 ].y, sample.y, filterOffset.y;
MOV result.texcoord[ 6 ].x, sample.x;
ADD result.texcoord[ 6 ].y, sample.y, filterOffset.y;

END

!!ARBfp1.0

TEMP color0, color1, color2, color3, color4, color5, color6;

PARAM toGray = { 0.3, 0.59, 0.11, 0.0 };
PARAM divtwo = { 0.5, 0.5, 0.5, 0.0 };

# c = texture2DProj(OGL2Texture, gl_TexCoord[0]); //center
# l = texture2DProj(OGL2Texture, gl_TexCoord[1]); //left
# tl = texture2DProj(OGL2Texture, gl_TexCoord[2]); //top-left
# t = texture2DProj(OGL2Texture, gl_TexCoord[3]); //top
# r = texture2DProj(OGL2Texture, gl_TexCoord[4]); //right
# br = texture2DProj(OGL2Texture, gl_TexCoord[5]); //bottom-right
# b = texture2DProj(OGL2Texture, gl_TexCoord[6]); //bottom

TEX color0, fragment.texcoord[ 0 ], texture[ 0 ], 2D;
TEX color1, fragment.texcoord[ 1 ], texture[ 0 ], 2D;
TEX color2, fragment.texcoord[ 2 ], texture[ 0 ], 2D;
TEX color3, fragment.texcoord[ 3 ], texture[ 0 ], 2D;
TEX color4, fragment.texcoord[ 4 ], texture[ 0 ], 2D;
TEX color5, fragment.texcoord[ 5 ], texture[ 0 ], 2D;
TEX color6, fragment.texcoord[ 6 ], texture[ 0 ], 2D;

# calculate emboss

# 0.5 * (r + b) + -0.5 * (l + t) + (br - tl);

ADD color4, color4, color6;
ADD color1, color1, color3;
ADD color5, color5,-color2;
MUL color4, color4, divtwo;
MUL color1, color1, divtwo;
ADD color1,-color1, color4;
ADD color1, color1, color5;
DP3 color1, color1, toGray;

# add emboss to color0

ADD result.color, color0, color1;

END

Pete, if ShadX want, you can put it on your site.
Please test it, if you can... I am a little careless
Ciao.




<ShadX>
unregistried

...   Created on 09.11.2004 - 10:36Jump to top Quote this post Report this post Edit Delete


Very good job, Guest!
we bury the war axe?
Luigi, OK for me.
Bye




<ShadX>
unregistried

...   Created on 09.11.2004 - 11:00Jump to top Quote this post Report this post Edit Delete


An other question for Pete.
Is possible to implement an external (like full screen filter) GLSL (or ARB) x2 filter on Hi-Res textures ?
Guest, what do you think about?




<ShadX>
unregistried

...   Created on 09.11.2004 - 18:30Jump to top Quote this post Report this post Edit Delete


An example of 2x Hi-Res texture GLSL:
Vartex program

// Super Simplified hq2x (SShq2x) GLslang shader - ported ShadX. Comments by Pete Bernert (copied from Scale2x)
//
// see the .slf file for algorithm/license informations
//
// How to use the shaders: copy both files into the emu's "shaders" subdirectory,
// and rename them to "gpuPeteOGL2.slv" and "gpuPeteOGL2.slf".
// Configure the plugin: set "shader effects" to mode "5 - GLslang files".
//
// Important: to get a real SShq2x effect, your configured window/fullscreen size has
// to be at least twice as the internal resolution. That means:
// if your internal resolution is "0 - low", than the window/fullscreen size has to be at
// least 640x480 with most games. If you are using an internal resolution of "1 - high",
// your window/fullscreen size has to be at least 1280x960... it will not crash or
// something, if you are using smaller window/fullscreen sizes, but the algorithm will
// not work properly on all pixels. Also, the above values may vary, depending on the
// psx game's display size. The complete formula to set your window/fullscreen size is:
//
// "psx game resolution" * "plugin internal resolution mode + 1" * 2
//
// So, for a psx game which is using 320x240, and the "1 - high" mode, you would need
// 320x240 * (1 + 1) * 2 = 640x480 * 2 = 1280x960... mmmkay?
//
// Ah, and final note: SShq2X works best on games using clear 2D gfx


uniform vec4 OGL2Param;
uniform vec4 OGL2Size;

void main()
{
vec4 offsetx;
vec4 offsety;

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

offsetx.x = 1.0/OGL2Size.x; // setup one x/y texel offset
offsetx.y = 0.0;
offsetx.w = 0.0;
offsetx.z = 0.0;
offsety.y = 1.0/OGL2Size.y;
offsety.x = 0.0;
offsety.w = 0.0;
offsety.z = 0.0;

gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_TexCoord[0] + offsetx;
gl_TexCoord[2] = gl_TexCoord[0] + offsetx + offsety;
gl_TexCoord[3] = gl_TexCoord[0] + offsety;
}

Fragment program

// Super Simplified hq2x (SShq2x) GLslang shader - ported by ShadX
//
// hq2x Homepage: http://www.hiend3d.com/hq2x.html
// Original license informations:
// "Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."
//
// OGL2Size.x = texture x size (for example "2048" in "high internal resolution" setting)
// OGL2Size.y = texture y size (for example "1024" in "high internal resolution" setting)
// OGL2Size.z = tex rect width used for current rendering (psx display width)
// OGL2Size.w = tex rect height used for current rendering (psx display height)
//
// B = black C = any color
//
// [B][B]matrix 1
// [B][C]
//
// [B][B]matrix 2
// [C][B]
//
// [C][B]matrix 3
// [B][B]
//
// [B][C]matrix 4
// [B][B]
//
// [B][C]matrix 5
// [B][C]
//
// [B][B]matrix 6
// [C][C]
//
// [C][B]matrix 7
// [C][B]
//
// [C][C]matrix 8
// [B][B]
//
// [B][C]matrix 9
// [C][C]
//
// [C][B]matrix 10
// [C][C]
//
// [C][C]matrix 11
// [B][C]
//
// [C][C]matrix 12
// [C][B]
//
// [C][C]matrix 13
// [C][C]

uniform vec4 OGL2Param;
uniform vec4 OGL2Size;
uniform sampler2D OGL2Texture;

void main()
{
vec4 colA,colB,colC,colD,col;
vec3 black;

black.x = 0.0;
black.y = 0.0;
black.z = 0.0;


colA = texture2DProj(OGL2Texture, gl_TexCoord[0]); // (top-left)
colB = texture2DProj(OGL2Texture, gl_TexCoord[1]); // (top-right)
colC = texture2DProj(OGL2Texture, gl_TexCoord[2]); // (bottom-left)
colD = texture2DProj(OGL2Texture, gl_TexCoord[3]); // (bottom-right)

if(colA == colB && colB == colC && colC != colD && colC.xyz == black) // do the SShq2x rule 1
col=colA;
else
if(colA == colB && colB == colD && colD != colC && colD.xyz == black ) // do the SShq2x rule 2
col=colA;
else
if(colB == colC && colC == colD && colD != colA && colD.xyz == black ) // do the SShq2x rule 3
col=colB;
else
if(colA == colC && colC == colD && colD != colA && colD.xyz == black ) // do the SShq2x rule 4
col=colA;
else
if(colA == colC && colC != colB && colC != colD && colC.xyz == black ) // do the SShq2x rule 5
col=colC;
else
if(colA == colB && colB != colC && colB != colD && colB.xyz == black ) // do the SShq2x rule 6
col=colB;
else
if(colB == colD && colD != colC && colD != colA && colD.xyz == black ) // do the SShq2x rule 7
col=(colA+colC)/2.0;
else
if(colC == colD && colD != colA && colD != colC && colD.xyz == black ) // do the SShq2x rule 8
col=(colA+colB)/2.0;
else
if(colA != colB && colA != colC && colA != colD && colA.xyz == black ) // do the SShq2x rule 9
col=colA;
else
if(colB != colA && colB != colC && colB != colD && colB.xyz == black ) // do the SShq2x rule 10
col=(colA+colC+colD)/3.0;
else
if(colC != colA && colC != colB && colC != colD && colC.xyz == black ) // do the SShq2x rule 11
col=(colA+colB+colD)/3.0;
else
if(colD != colA && colD != colB && colD != colC && colB.xyz == black ) // do the SShq2x rule 12
col=(colA+colB+colC)/3.0;
else
if(colA.xyz != black && colB.xyz != black && colC.xyz != black && colD.xyz != black ) // do the SShq2x rule 13
col=(colA+colB+colC+colD)/4.0;

gl_FragColor = col;
}
Pete, Guest, anyone... optimizations or suggestions are welcome...
Bye




<ShadX>
unregistried

...   Created on 11.11.2004 - 09:49Jump to top Quote this post Report this post Edit Delete


Hi Guest,
I have seen an error (?) in your fragment programs:
colA=colC
colA = texture2DProj(OGL2Texture, gl_TexCoord[0] + gl_TexCoord[1] - gl_TexCoord[2]);
colC = texture2DProj(OGL2Texture, gl_TexCoord[0] + gl_TexCoord[1] - gl_TexCoord[2]);
Bye




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

...

Status:Offline
Date registered: 30.07.2004
Post:854
Send Message
...   Created on 11.11.2004 - 11:59Jump to top Quote this post Report this post Edit Delete


2xGLSL textures would be a good thing indeed (a worthy cause to burry the war axe)

PS: Thanks for reminding me for the bug.That explains some things...

[Dieser Beitrag wurde am 20.06.2005 - 18:45 von guest aktualisiert]




The_Source ...
Real addict
.........

...

Status:Offline
Date registered: 14.07.2004
Post:495
Send Message
...   Created on 17.11.2004 - 05:41Jump to top Quote this post Report this post Edit Delete


With the latest NVIDIA drivers the block effect was almost cleared without any shaders (AFiltering is great!), but still it would be nice to create some new type of GPU plugin.





Signature
He wants to cure the minds,
The minds of entire humankind


The_Source ...
Real addict
.........

...

Status:Offline
Date registered: 14.07.2004
Post:495
Send Message
...   Created on 18.11.2004 - 07:07Jump to top Quote this post Report this post Edit Delete


The biggest pronlem of soft developers today is that they almost don't take care of optimizations.
Example: the block effect presents in Pete's and others GPU plugins. Everybody are trying to solve this problem by creating new and new shaders. However it can be solved in plugin itself by combining small blocks into one large polygon. Faseter and compatible with older cards. With only shaders available gamers will by real PSX instead expensive fast D3D9 card. Excuse me, but have anyone ever seen the block effect in Nintendo64? There is no such thing there and plugins are comaptible even with D3D6 with perfect image quality (AFiltering is used). And Nintendo64 is surely more powerful console then PSX.
Think about it.





Signature
He wants to cure the minds,
The minds of entire humankind


<ShadX>
unregistried

...   Created on 18.11.2004 - 17:07Jump to top Quote this post Report this post Edit Delete


For The_source:
the Nintendo64 support bilinear filtering and the games are developed for use it, the PSX don't support bilinear filtering and the games too.
If you play the PSX games on PS2 you can enable bilinear filtering but you obtain same glitch as enabling bilinear on Pete GPU plugins... and PS2 is more powerful then Nintendo64...
Bye




More : [1] [2] [3]

Similarly threads:
Topics Created by Replies Boardname
PSX 3d games vertex shaking 3 pete_bernert
nur ein fragment ErnestoMattig 2 wordshop
Vertex TeamPirnok 5 teampirnok
Programs pRedaTor 0 predator7
Please add ability to run external programs :) 3 guidemaster
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:
texture2dproj | vartex shader 3.0 | vartex shader | 2xglsl 2.0 shader | 2xglsl 2.0 | ogl2size | glsl fullscreen | 2xglsl filter
blank