Author Topic: Pixel shader effects for FS2_open (DL)  (Read 15295 times)

0 Members and 1 Guest are viewing this topic.

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Well, this is only for the ATI user (which doesn't include me :( ):

The Radeon 9xxx cards have (driver) feature that allows to use postfilter PS effects. Probably nothing new to you.
It was never really important, as the standard effects were boring.

But I just found a nice bloom effect called HDRish. (It's no real HDR!)

Here is everything you need to know:
http://rage3d.com/board/showthread.php?t=33787285&page=1&pp=30

Just dl 'pssControl2.zip' and  'entries.zip' from this site:
http://www.beyond3d.com/downloads/smartshader/

Use HDRish and play OpenGL FS2_open.



If you choose to test this, drop some screens here.
I'd like to know how it looks like. ;)
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Hmm. I'll try this out right now. Hold on.
Freelance Modeler | Amateur Artist

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Ok, well, they are right, the effect is completely overdone. If it could be tuned down, it'd be perfect...

Here's some screenies:







Freelance Modeler | Amateur Artist

 

Offline aldo_14

  • Gunnery Control
  • 213
Pixel shader effects for FS2_open (DL)
aaaaah've hud a wee bit too...too...mu-mu-much tae drink.......it'sh a wee bit blurry

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Should be no problem. You can open the pss file with Nootepad.

I'm not really sure what has to be changed, as I don't know much about pixelshader.
There should be an entry called 'gaussian something'.

Try to lower some values there.

I'd edit it myself but I can't test anything. :(

BTW I think the menu will alway look strange.
« Last Edit: January 06, 2005, 11:05:31 am by 1688 »
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Really? Notepad?

*goes off to try*
Freelance Modeler | Amateur Artist

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Code: [Select]

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[3]=
{
{ 0.182008, 0.116053, 0.073999, 0.047184 },
{ 0.030086, 0.019183, 0.012232, 0.007799 },
{ 0.004973, 0.003171, 0.002022, 0.001289 }
};

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[3]=
{
{ 0.182008, 0.116053, 0.073999, 0.047184 },
{ 0.030086, 0.019183, 0.012232, 0.007799 },
{ 0.004973, 0.003171, 0.002022, 0.001289 }
};

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;




What do I change to what?
Freelance Modeler | Amateur Artist

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Well, I'm not sure. Actually I have no clue.

I think you have to change something in this part:



Edit: Forget it. I think I was wrong.



I think the clamped part is the gaussian radius, which has to be reduced.


Or try to reduce the PARAM Weight.
It sounds like it could control the intensity.

I'll ask someone who should know what has to be changed.
« Last Edit: January 06, 2005, 11:25:19 am by 1688 »
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline Target

  • 25
Pixel shader effects for FS2_open (DL)
"how to tone HDRish down Straight from the NitroGL man himself


Quote:
If you want to tone it down a bit, just change line 207 from:
ADD result.color, back, blur;
to:
MAD result.color, blur, 0.75, back;

That will drop the effect by 25%"


From the thread at rage3d.

 

Offline aldo_14

  • Gunnery Control
  • 213
Pixel shader effects for FS2_open (DL)
Maybe try changing the divisor of
Code: [Select]
surface blur0 = allocsurf(width/4, height/4);
surface blur1 = allocsurf(width/4, height/4);

(?)

I don't really have a clue myself; try http://www.driverheaven.net/dhinterviews/smartshader/ maybe (search for allocsurf)

I think it creates a copy of the image being rendered, and downsizes, and finally adds the downsized image over the top; i.e. so it's blurred by being shrunk and then overlaid.  So maybe try div by 2?

EDIT; think blur0 and blur1 are used for x and y respectively.  Not sure why.....
« Last Edit: January 06, 2005, 11:21:01 am by 181 »

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Looks like you're right.

@Target this will indeed weaken the effect.
But I think what we want is to rise the contrast of the image befor the blooming is applied to the brightest parts.

This would cause only the really bright parts to shine.

@Raa Try to edit the file like Target suggested and try to reduce the gaussian size like aldo suggested.
Edit2: @Raa be sure to edit both the gaussianX and gaussionY filter! It's in the code two times.



Edit: This could look relly nice if it was to be implemented in the code. (As non-postfilter)
Only for shine-, glow-maps and glowpoints (suns, thrusters).
« Last Edit: January 06, 2005, 11:38:39 am by 1688 »
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Pixel shader effects for FS2_open (DL)
Oh my god it's too good to hear that.

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by Target
"how to tone HDRish down Straight from the NitroGL man himself


Quote:
If you want to tone it down a bit, just change line 207 from:
ADD result.color, back, blur;
to:
MAD result.color, blur, 0.75, back;

That will drop the effect by 25%"


From the thread at rage3d.


Doing that eliminated the effect.
Freelance Modeler | Amateur Artist

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Try this:
Code: [Select]
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[3]=
{
{ 0.91004, 0.58026, 0.036999, 0.023592 },
{ 0.015043, 0.09591, 0.06116, 0.003899 },
{ 0.002486, 0.001585, 0.001011, 0.00644 }
};

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[3]=
{
{ 0.91004, 0.58026, 0.036999, 0.023592 },
{ 0.015043, 0.09591, 0.06116, 0.003899 },
{ 0.002486, 0.001585, 0.001011, 0.00644 }
};

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/2, height/2);
surface blur1 = allocsurf(width/2, height/2);

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;

--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Just got an answer:
Quote
Der Filter wird durch die beiden Weight Felder gesteuert. IIRC sind die Werte dabei vom Zentrum zu Rand gespeichert. Um den Effekt abzuschwächen muss man die Werte im Zentrum erhöhen und die am Rand verringern. Die Gesamtsumme muss aber gleich bleiben.


[crappy_translation]
The filter intensity is controlled by the 'weight' fields.
IIRC the values are saved from the center to the edge.
To weaken the effect you have to increase the values in the center and reduce the values for the edge. But the total sum has to stay the same.
[/crappy_translation]


That would mean the left value is the center.

Code: [Select]
PARAM Weight[3]=
{
{[i][b] 0.182008[/b][/i], 0.116053, 0.073999, 0.047184 },
{ 0.030086, 0.019183, 0.012232, 0.007799 },
{ 0.004973, 0.003171, 0.002022, 0.001289 }
};
« Last Edit: January 06, 2005, 11:55:29 am by 1688 »
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline aldo_14

  • Gunnery Control
  • 213
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by DaBrain

Edit: This could look relly nice if it was to be implemented in the code. (As non-postfilter)
Only for shine-, glow-maps and glowpoints (suns, thrusters).


If I'm understanding it right, it works in a similar-ish way to what Sticks was implementing with the 'overburn' effect... I think he (at least initially) was copying the z-buffer image, shrinking it, and then overlaying an less opaque version.

 
Pixel shader effects for FS2_open (DL)
Now the ATI users have pixelshader effects and the nVidia users have env- and shinemapping, what an unfair world.
My Sytem

Wer das liest ist doof!

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
I don't know about that.

But I saw the pic. And it looked like that.


@Overlord ATI user will have env maps too, soon.
And Nvida user will be able to use postfilter PS with an upcomming program called DX Tweaker. Which will  btw enable real HDR for all games.
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by DaBrain
Try this:
*snip*



:lol:


Nope.
Freelance Modeler | Amateur Artist

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by Overlord
Now the ATI users have pixelshader effects and the nVidia users have env- and shinemapping, what an unfair world.


Actually, now I have all of them! :D
Freelance Modeler | Amateur Artist