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

<guest>
unregistried

...   Created on 06.01.2005 - 21:17Jump to top Quote this post Report this post Edit Delete


Well, it's not really for Pete's OpenGL plugin, but for ATI's smartshader feature.

My first problem is that I don't have an ATI card, so I can't test my affords

My second problem is that I've never done this before. And the only language I coded before was Turbo Pascal.


So I thought: "Why not just take the HDRish file and alter it a bit."


I've already reduced the effects intensity and the gaussian size. But now I want only the brightest parts of the image to recive the bloom effect.

I've not the slightest idea how to realize that.


This is the code so far:

shader samplePixelShader =
"!!ARBfp1.0

TEMP Temp;

TEX result.color, fragment.texcoord[0], texture[0], 2D;

END";

shader gaussianXPixelShader =
"!!ARBfp1.0

PARAM Offset[11]={ program.local[0..10] };

PARAM Weight[2]=
{
{ 0.2056, 0.13455275, 0.05549925, 0.023592 },
{ 0.0339855, 0.022268, 0.009174, 0.0038995 },
{ 0.0056175, 0.0036765, 0.0015165, 0.0006445 }
};

TEMP s0, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10;

ADD r0, -Offset[10], fragment.texcoord[0];
ADD r1, -Offset[ 9], fragment.texcoord[0];
ADD r2, -Offset[ 8], fragment.texcoord[0];
ADD r3, -Offset[ 7], fragment.texcoord[0];
ADD r4, -Offset[ 6], fragment.texcoord[0];
ADD r5, -Offset[ 5], fragment.texcoord[0];
ADD r6, -Offset[ 4], fragment.texcoord[0];
ADD r7, -Offset[ 3], fragment.texcoord[0];
ADD r8, -Offset[ 2], fragment.texcoord[0];
ADD r9, -Offset[ 1], fragment.texcoord[0];
ADD r10, -Offset[ 0], fragment.texcoord[0];
MOV s0, fragment.texcoord[0];

TEX r0, r0, texture[0], 2D;
TEX r1, r1, texture[0], 2D;
TEX r2, r2, texture[0], 2D;
TEX r3, r3, texture[0], 2D;
TEX r4, r4, texture[0], 2D;
TEX r5, r5, texture[0], 2D;
TEX r6, r6, texture[0], 2D;
TEX r7, r7, texture[0], 2D;
TEX r8, r8, texture[0], 2D;
TEX r9, r9, texture[0], 2D;
TEX r10, r10, texture[0], 2D;

TEX s0, s0, texture[0], 2D;

MUL s0, s0, Weight[0].x;
MAD s0, r0, Weight[2].w, s0;
MAD s0, r1, Weight[2].z, s0;
MAD s0, r2, Weight[2].y, s0;
MAD s0, r3, Weight[2].x, s0;
MAD s0, r4, Weight[1].w, s0;
MAD s0, r5, Weight[1].z, s0;
MAD s0, r6, Weight[1].y, s0;
MAD s0, r7, Weight[1].x, s0;
MAD s0, r8, Weight[0].w, s0;
MAD s0, r9, Weight[0].z, s0;
MAD s0, r10, Weight[0].y, s0;

ADD r0, Offset[ 0], fragment.texcoord[0];
ADD r1, Offset[ 1], fragment.texcoord[0];
ADD r2, Offset[ 2], fragment.texcoord[0];
ADD r3, Offset[ 3], fragment.texcoord[0];
ADD r4, Offset[ 4], fragment.texcoord[0];
ADD r5, Offset[ 5], fragment.texcoord[0];
ADD r6, Offset[ 6], fragment.texcoord[0];
ADD r7, Offset[ 7], fragment.texcoord[0];
ADD r8, Offset[ 8], fragment.texcoord[0];
ADD r9, Offset[ 9], fragment.texcoord[0];
ADD r10, Offset[10], fragment.texcoord[0];

TEX r0, r0, texture[0], 2D;
TEX r1, r1, texture[0], 2D;
TEX r2, r2, texture[0], 2D;
TEX r3, r3, texture[0], 2D;
TEX r4, r4, texture[0], 2D;
TEX r5, r5, texture[0], 2D;
TEX r6, r6, texture[0], 2D;
TEX r7, r7, texture[0], 2D;
TEX r8, r8, texture[0], 2D;
TEX r9, r9, texture[0], 2D;
TEX r10, r10, texture[0], 2D;

MAD s0, r0, Weight[0].y, s0;
MAD s0, r1, Weight[0].z, s0;
MAD s0, r2, Weight[0].w, s0;
MAD s0, r3, Weight[1].x, s0;
MAD s0, r4, Weight[1].y, s0;
MAD s0, r5, Weight[1].z, s0;
MAD s0, r6, Weight[1].w, s0;
MAD s0, r7, Weight[2].x, s0;
MAD s0, r8, Weight[2].y, s0;
MAD s0, r9, Weight[2].z, s0;
MAD s0, r10, Weight[2].w, s0;

MOV result.color, s0;

END";

shader gaussianYPixelShader =
"!!ARBfp1.0

PARAM Offset[11]={ program.local[0..10] };

PARAM Weight[2]=
{
{ 0.2056, 0.13455275, 0.05549925, 0.023592 },
{ 0.0339855, 0.022268, 0.009174, 0.0038995 },
{ 0.0056175, 0.0036765, 0.0015165, 0.0006445 }
};

TEMP s0, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10;

ADD r0, -Offset[10], fragment.texcoord[0];
ADD r1, -Offset[ 9], fragment.texcoord[0];
ADD r2, -Offset[ 8], fragment.texcoord[0];
ADD r3, -Offset[ 7], fragment.texcoord[0];
ADD r4, -Offset[ 6], fragment.texcoord[0];
ADD r5, -Offset[ 5], fragment.texcoord[0];
ADD r6, -Offset[ 4], fragment.texcoord[0];
ADD r7, -Offset[ 3], fragment.texcoord[0];
ADD r8, -Offset[ 2], fragment.texcoord[0];
ADD r9, -Offset[ 1], fragment.texcoord[0];
ADD r10, -Offset[ 0], fragment.texcoord[0];
MOV s0, fragment.texcoord[0];

TEX r0, r0, texture[0], 2D;
TEX r1, r1, texture[0], 2D;
TEX r2, r2, texture[0], 2D;
TEX r3, r3, texture[0], 2D;
TEX r4, r4, texture[0], 2D;
TEX r5, r5, texture[0], 2D;
TEX r6, r6, texture[0], 2D;
TEX r7, r7, texture[0], 2D;
TEX r8, r8, texture[0], 2D;
TEX r9, r9, texture[0], 2D;
TEX r10, r10, texture[0], 2D;

TEX s0, s0, texture[0], 2D;

MUL s0, s0, Weight[0].x;
MAD s0, r0, Weight[2].w, s0;
MAD s0, r1, Weight[2].z, s0;
MAD s0, r2, Weight[2].y, s0;
MAD s0, r3, Weight[2].x, s0;
MAD s0, r4, Weight[1].w, s0;
MAD s0, r5, Weight[1].z, s0;
MAD s0, r6, Weight[1].y, s0;
MAD s0, r7, Weight[1].x, s0;
MAD s0, r8, Weight[0].w, s0;
MAD s0, r9, Weight[0].z, s0;
MAD s0, r10, Weight[0].y, s0;

ADD r0, Offset[ 0], fragment.texcoord[0];
ADD r1, Offset[ 1], fragment.texcoord[0];
ADD r2, Offset[ 2], fragment.texcoord[0];
ADD r3, Offset[ 3], fragment.texcoord[0];
ADD r4, Offset[ 4], fragment.texcoord[0];
ADD r5, Offset[ 5], fragment.texcoord[0];
ADD r6, Offset[ 6], fragment.texcoord[0];
ADD r7, Offset[ 7], fragment.texcoord[0];
ADD r8, Offset[ 8], fragment.texcoord[0];
ADD r9, Offset[ 9], fragment.texcoord[0];
ADD r10, Offset[10], fragment.texcoord[0];

TEX r0, r0, texture[0], 2D;
TEX r1, r1, texture[0], 2D;
TEX r2, r2, texture[0], 2D;
TEX r3, r3, texture[0], 2D;
TEX r4, r4, texture[0], 2D;
TEX r5, r5, texture[0], 2D;
TEX r6, r6, texture[0], 2D;
TEX r7, r7, texture[0], 2D;
TEX r8, r8, texture[0], 2D;
TEX r9, r9, texture[0], 2D;
TEX r10, r10, texture[0], 2D;

MAD s0, r0, Weight[0].y, s0;
MAD s0, r1, Weight[0].z, s0;
MAD s0, r2, Weight[0].w, s0;
MAD s0, r3, Weight[1].x, s0;
MAD s0, r4, Weight[1].y, s0;
MAD s0, r5, Weight[1].z, s0;
MAD s0, r6, Weight[1].w, s0;
MAD s0, r7, Weight[2].x, s0;
MAD s0, r8, Weight[2].y, s0;
MAD s0, r9, Weight[2].z, s0;
MAD s0, r10, Weight[2].w, s0;

MOV result.color, s0;

END";

shader outputPixelShader =
"!!ARBfp1.0

TEMP back, blur;

TEX blur, fragment.texcoord[0], texture[0], 2D;
TEX back, fragment.texcoord[0], texture[1], 2D;

ADD blur, blur, blur;
ADD result.color, back, blur;

END";

surface blur0 = allocsurf(width/4, height/4);
surface blur1 = allocsurf(width/4, height/4);

gaussianXPixelShader.constant[ 0] = { (4.0*ds_dx)* 1.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 1] = { (4.0*ds_dx)* 3.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 2] = { (4.0*ds_dx)* 5.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 3] = { (4.0*ds_dx)* 7.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 4] = { (4.0*ds_dx)* 9.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 5] = { (4.0*ds_dx)*11.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 6] = { (4.0*ds_dx)*13.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 7] = { (4.0*ds_dx)*15.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 8] = { (4.0*ds_dx)*17.45, 0, 0, 0 };
gaussianXPixelShader.constant[ 9] = { (4.0*ds_dx)*19.45, 0, 0, 0 };
gaussianXPixelShader.constant[10] = { (4.0*ds_dx)*21.45, 0, 0, 0 };

gaussianYPixelShader.constant[ 0] = { 0, (4.0*dt_dy)* 1.45, 0, 0 };
gaussianYPixelShader.constant[ 1] = { 0, (4.0*dt_dy)* 3.45, 0, 0 };
gaussianYPixelShader.constant[ 2] = { 0, (4.0*dt_dy)* 5.45, 0, 0 };
gaussianYPixelShader.constant[ 3] = { 0, (4.0*dt_dy)* 7.45, 0, 0 };
gaussianYPixelShader.constant[ 4] = { 0, (4.0*dt_dy)* 9.45, 0, 0 };
gaussianYPixelShader.constant[ 5] = { 0, (4.0*dt_dy)*11.45, 0, 0 };
gaussianYPixelShader.constant[ 6] = { 0, (4.0*dt_dy)*13.45, 0, 0 };
gaussianYPixelShader.constant[ 7] = { 0, (4.0*dt_dy)*15.45, 0, 0 };
gaussianYPixelShader.constant[ 8] = { 0, (4.0*dt_dy)*17.45, 0, 0 };
gaussianYPixelShader.constant[ 9] = { 0, (4.0*dt_dy)*19.45, 0, 0 };
gaussianYPixelShader.constant[10] = { 0, (4.0*dt_dy)*21.45, 0, 0 };

texture[0].magfilter = "linear";

texture[0].source = backbuffer;
destination blur0;
apply samplePixelShader;

texture[0].source = blur0;
destination blur1;
apply gaussianXPixelShader;

texture[0].source = blur1;
destination blur0;
apply gaussianYPixelShader;

texture[0].source = blur0;
texture[1].source = backbuffer;
destination backbuffer;
apply outputPixelShader;




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

...

Status:Offline
Date registered: 30.07.2004
Post:856
Send Message
...   Created on 06.01.2005 - 23:20Jump to top Quote this post Report this post Edit Delete


Hello!

I couldn't advice you directly, since i wrote only a few glSlang shaders (=different shader language).

I think <luigi> wrote also in ARB and posted some examples in this forum section.

You must somehow adapt this lines in the next files:

- gpuPeteOGL2.fp
- gpuPeteOGL2.vp

and copy them in the "ePSXe/shaders" directory. Then in the OGL2 plugin config window you select 3.option (ARB program) under "Shader effects".

Maybe you know it already, but hey...

I would start with what already works and then try to change something. And watch for possible licence

[Dieser Beitrag wurde am 26.03.2005 - 16:48 von guest aktualisiert]




<guest>
unregistried

...   Created on 07.01.2005 - 01:02Jump to top Quote this post Report this post Edit Delete


Changing something that's already working is exactly my style of learning new things.


<luigi> made a brightness specific fragment shader?

I'll take a look at that.

Thanks




<Luigi>
unregistried

...   Created on 07.01.2005 - 11:17Jump to top Quote this post Report this post Edit Delete


Try this:
shader outputPixelShader =
"!!ARBfp1.0

# threshold for tag shader (try different values)
PARAM thresh = {0.5, 0.5, 0.5, 0.5};

TEMP back, blur, temp;

TEX blur, fragment.texcoord[0], texture[0], 2D;
TEX back, fragment.texcoord[0], texture[1], 2D;

ADD blur, blur, blur;

# subtract threshold value from the 'back' value
SUB temp, back, thresh;

# if temp value is smaller than threshold, kill fragment
KIL blur;

ADD result.color, back, blur;

END";
Ciao




<<guest>>
unregistried

...   Created on 07.01.2005 - 12:43Jump to top Quote this post Report this post Edit Delete


Thanks for your help. Now I'll just ask an ATI user to test this.

Until the DX Tweaker (postfilter for Nvidia and ATI cards) is released.




<ShadX>
unregistried

...   Created on 07.01.2005 - 15:02Jump to top Quote this post Report this post Edit Delete


Hi guest,
what wants to say "[***censored***]"?
Bye




<Lugi>
unregistried

...   Created on 07.01.2005 - 15:31Jump to top Quote this post Report this post Edit Delete


Sorry <guest>, but it doesn't work.
I'm tryng to debag...
Ciao




<<guest>>
unregistried

...   Created on 07.01.2005 - 18:19Jump to top Quote this post Report this post Edit Delete


Yeah, looks like it caused some crashes.

But I think I'm slowly getting an understanding of the language.


BTW I think I should register.




<<guest>>
unregistried

...   Created on 07.01.2005 - 18:35Jump to top Quote this post Report this post Edit Delete


Let me correct myself.


Looks like it works. (Crashed for one person, but worked for another.)

Man this stuff is so hard to test without an ATI card.




<<guest>>
unregistried

...   Created on 07.01.2005 - 20:39Jump to top Quote this post Report this post Edit Delete


Look like I'm unable to achive the effect I want.






More : [1] [2] [3]

Similarly threads:
Topics Created by Replies Boardname
Plugin that changes specific colors only? dex 25 pete_bernert
Der 'Rob Effect' stupidlamb 67 bellacullen
Butterfly Effect ernie 0 meistertony
Butterfly Effect CrucifySorrow 1 shizoo
Butterfly Effect Ellesime 1 countcain
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:
epsxe brightness | gpupeteogl2.vp lines
blank