Author Topic: Pixel shader effects for FS2_open (DL)  (Read 20085 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)
I think it's only a matter of time. But you're right we cannot get any too complex effects from this. It's only a postfilter.


But we could try something less complicated, like simple blur on only red (shivans ;) ) parts of the screen. Just to achive a slight bloom effect.
--------------------------------------------------
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)
If it was possible yo get a bloom on only the pure red, pure blue, and pure green colors, for glowmaps, it might be nice. ;)
Freelance Modeler | Amateur Artist

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Here is an FS2_open optimized HDRish postfilter.

It's 100% working. Though it's not not perfect, it's far better for FS2 than the original effect.


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.2, 0.1, 0.05, 0.02 },
{ 0.02, 0.01, 0.005, 0.002 },
{ 0.004, 0.002, 0.001, 0.00025 }
};

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

ADD r0,  -Offset[10], fragment.texcoord[0];
ADD r1,  -Offset[ 8], fragment.texcoord[0];
ADD r2,  -Offset[ 7], fragment.texcoord[0];
ADD r3,  -Offset[ 6], fragment.texcoord[0];
ADD r4,  -Offset[ 5], fragment.texcoord[0];
ADD r5,  -Offset[ 4], fragment.texcoord[0];
ADD r6,  -Offset[ 3], fragment.texcoord[0];
ADD r7,  -Offset[ 2], fragment.texcoord[0];
ADD r8,  -Offset[ 1], fragment.texcoord[0];
ADD r9,  -Offset[ 0], 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[1].w, s0;
MAD s0, r1,  Weight[1].z, s0;
MAD s0, r2,  Weight[1].y, s0;
MAD s0, r3,  Weight[1].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[1].x, s0;
MAD s0, r8,  Weight[1].y, s0;
MAD s0, r9,  Weight[1].z, s0;
MAD s0, r10, Weight[1].w, s0;

MOV result.color, s0;

END";

shader gaussianYPixelShader =
"!!ARBfp1.0

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

PARAM Weight[3]=
{
{ 0.2, 0.1, 0.05, 0.02 },
{ 0.02, 0.01, 0.005, 0.002 },
{ 0.004, 0.002, 0.001, 0.00025 }
};

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[1].w, s0;
MAD s0, r1,  Weight[1].z, s0;
MAD s0, r2,  Weight[1].y, s0;
MAD s0, r3,  Weight[1].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[ 0], fragment.texcoord[0];
ADD r2,  Offset[ 1], fragment.texcoord[0];
ADD r3,  Offset[ 2], fragment.texcoord[0];
ADD r4,  Offset[ 3], fragment.texcoord[0];
ADD r5,  Offset[ 4], fragment.texcoord[0];
ADD r6,  Offset[ 5], fragment.texcoord[0];
ADD r7,  Offset[ 6], fragment.texcoord[0];
ADD r8,  Offset[ 7], fragment.texcoord[0];
ADD r9,  Offset[ 8], 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[1].x, s0;
MAD s0, r8,  Weight[1].y, s0;
MAD s0, r9,  Weight[1].z, s0;
MAD s0, r10, Weight[1].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";

shader outputPixelShader2 =
"!!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;


# 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";

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

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[0].source =  blur1;
texture[1].source =  backbuffer;
destination backbuffer;
apply outputPixelShader2;
--------------------------------------------------
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)
Quote
Originally posted by DaBrain
Here is an FS2_open optimized HDRish postfilter.

It's 100% working. Though it's not not perfect, it's far better for FS2 than the original effect.


Code: [Select]

...
[/B]



It's definitively the best HDRish i 've got.

Here some Comparaison :
With your HDRish :


Without the HDR :



But, unfortunately, i still have Fs2 crashes. I think Fs2_open hate my OpenGL systems :(

 

Offline Ransom

  • M. Night Russel
  • 210
  • It will not wait.
    • Rate of Injury
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by DaBrain
Here is an FS2_open optimized HDRish postfilter.

It's 100% working. Though it's not not perfect, it's far better for FS2 than the original effect.

Nope. It looks all weird and shimmery, and the blur seems to be mostly horizontal.

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
You're right about the horizontal thing. I'm not sure why it is that way. I'm sure I did all changes to the X and Y Gaussian the same way.

But I like it. It looks pretty cool IMO.
« Last Edit: January 07, 2005, 05:28:57 pm 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 DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
This one will give you a slightly different effect. (Not very much different.)

It's supposed to detect dark pixels and to exclude them from the blooming.
For now the effect is very weak, but I think it works already.


Download
--------------------------------------------------
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)
Quote
Originally posted by DaBrain
You're right about the horizontal thing. I'm not sure why it is that way. I'm sure I did all changes to the X and Y Gaussian the same way.

But I like it. It looks pretty cool IMO.


Anyway, you can take some pss code from the Ghost.pss (from pssEffect.zip)  and include the blur effect into the HDRish.pss.
The blur effect from the Ghost is perfect but they are too many that you can't play OpenGL game anylonger.

 

Offline Unknown Target

  • Get off my lawn!
  • 212
  • Push.Pull?
Pixel shader effects for FS2_open (DL)
This is for Radeon cards only, right?

Is there any way you can set it so that it shows up only for things of a certain brightness?

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by DaBrain
This one will give you a slightly different effect. (Not very much different.)

It's supposed to detect dark pixels and to exclude them from the blooming.
For now the effect is very weak, but I think it works already.


Download


If this didn't only work on the Horizontal, it'd be great (except for the way it pulls the regular hull colors to the sides, too, but that can't be helped)
Freelance Modeler | Amateur Artist

 

Offline FireCrack

  • 210
  • meh...
Pixel shader effects for FS2_open (DL)
this doesnt work with 4.4's does it?
actualy, mabye not.
"When ink and pen in hands of men Inscribe your form, bipedal P They draw an altar on which God has slaughtered all stability, no eyes could ever soak in all the places you anoint, and yet to see you all at once we only need the point. Flirting with infinity, your geometric progeny that fit inside you oh so tight with triangles that feel so right."
3.141592653589793238462643383279502884197169399375105820974944 59230781640628620899862803482534211706...
"Your ever-constant homily says flaw is discipline, the patron saint of imperfection frees us from our sin. And if our transcendental lift shall find a final floor, then Man will know the death of God where wonder was before."

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Pixel shader effects for FS2_open (DL)
Try this, I add the Motion Blur from the Ghost file into one of the Dabrain HDRish. You can see how the motion blur reacts.
You got blur when you move your ship on any direction and when you use Afterburner. In other case like Flying right ahead the blur disapear.

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.2, 0.1, 0.05, 0.02 },
{ 0.02, 0.01, 0.005, 0.002 },
{ 0.004, 0.002, 0.001, 0.00025 }
};

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

ADD r0,  -Offset[10], fragment.texcoord[0];
ADD r1,  -Offset[ 8], fragment.texcoord[0];
ADD r2,  -Offset[ 7], fragment.texcoord[0];
ADD r3,  -Offset[ 6], fragment.texcoord[0];
ADD r4,  -Offset[ 5], fragment.texcoord[0];
ADD r5,  -Offset[ 4], fragment.texcoord[0];
ADD r6,  -Offset[ 3], fragment.texcoord[0];
ADD r7,  -Offset[ 2], fragment.texcoord[0];
ADD r8,  -Offset[ 1], fragment.texcoord[0];
ADD r9,  -Offset[ 0], 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[1].w, s0;
MAD s0, r1,  Weight[1].z, s0;
MAD s0, r2,  Weight[1].y, s0;
MAD s0, r3,  Weight[1].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[1].x, s0;
MAD s0, r8,  Weight[1].y, s0;
MAD s0, r9,  Weight[1].z, s0;
MAD s0, r10, Weight[1].w, s0;

MOV result.color, s0;

END";

shader gaussianYPixelShader =
"!!ARBfp1.0

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

PARAM Weight[3]=
{
{ 0.2, 0.1, 0.05, 0.02 },
{ 0.02, 0.01, 0.005, 0.002 },
{ 0.004, 0.002, 0.001, 0.00025 }
};

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[1].w, s0;
MAD s0, r1,  Weight[1].z, s0;
MAD s0, r2,  Weight[1].y, s0;
MAD s0, r3,  Weight[1].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[ 0], fragment.texcoord[0];
ADD r2,  Offset[ 1], fragment.texcoord[0];
ADD r3,  Offset[ 2], fragment.texcoord[0];
ADD r4,  Offset[ 3], fragment.texcoord[0];
ADD r5,  Offset[ 4], fragment.texcoord[0];
ADD r6,  Offset[ 5], fragment.texcoord[0];
ADD r7,  Offset[ 6], fragment.texcoord[0];
ADD r8,  Offset[ 7], fragment.texcoord[0];
ADD r9,  Offset[ 8], 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[1].x, s0;
MAD s0, r8,  Weight[1].y, s0;
MAD s0, r9,  Weight[1].z, s0;
MAD s0, r10, Weight[1].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";

shader outputPixelShader2 =
"!!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;


# 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";

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

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[0].source =  blur1;
texture[1].source =  backbuffer;
destination backbuffer;
apply outputPixelShader2;

shader ghostPixelShader =
"!!ARBfp1.0

# Increasing the ghostFactor will increase the severity of this effect.
# To keep things the same brightness curFrameFactor and ghostFactor should
# add up to 1.

PARAM curFrameFactor = {0.2, 0.2, 0.2, 0.0};
PARAM ghostFactor = {0.8, 0.8, 0.8, 0.0};
TEMP thisFramesPixel;
TEMP lastFramesPixel;
OUTPUT oColor = result.color;

TEX thisFramesPixel, fragment.texcoord[0], texture[0], 2D;
TEX lastFramesPixel, fragment.texcoord[0], texture[1], 2D;

MUL thisFramesPixel, thisFramesPixel, curFrameFactor;
MAD oColor, lastFramesPixel, ghostFactor, thisFramesPixel;
END";

shader copyPixelShader =
"!!ARBfp1.0
OUTPUT oColor = result.color;
TEMP pixel;
TEX pixel, fragment.texcoord[0], texture[0], 2D;
MOV oColor, pixel;
END";

surface temp = allocsurf(width, height);

texture[0].source = backbuffer;
texture[1].source = temp;

destination temp;
apply ghostPixelShader;


texture[0].source = temp;
destination backbuffer;
apply copyPixelShader;


And the Picture :




The code I added for the Blur :

Code: [Select]

shader ghostPixelShader =
"!!ARBfp1.0

# Increasing the ghostFactor will increase the severity of this effect.
# To keep things the same brightness curFrameFactor and ghostFactor should
# add up to 1.

PARAM curFrameFactor = {0.2, 0.2, 0.2, 0.0};
PARAM ghostFactor = {0.8, 0.8, 0.8, 0.0};
TEMP thisFramesPixel;
TEMP lastFramesPixel;
OUTPUT oColor = result.color;

TEX thisFramesPixel, fragment.texcoord[0], texture[0], 2D;
TEX lastFramesPixel, fragment.texcoord[0], texture[1], 2D;

MUL thisFramesPixel, thisFramesPixel, curFrameFactor;
MAD oColor, lastFramesPixel, ghostFactor, thisFramesPixel;
END";

shader copyPixelShader =
"!!ARBfp1.0
OUTPUT oColor = result.color;
TEMP pixel;
TEX pixel, fragment.texcoord[0], texture[0], 2D;
MOV oColor, pixel;
END";

surface temp = allocsurf(width, height);

texture[0].source = backbuffer;
texture[1].source = temp;

destination temp;
apply ghostPixelShader;


texture[0].source = temp;
destination backbuffer;
apply copyPixelShader;

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Good idea. :yes:

So it only blurs in motion? I think that's a nice effect.

It looks a bit too blured on the shot, but I think it looks better in-game.


I'll try to get my hands on a Radeon notebook again. ;)
--------------------------------------------------
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)
No, it's totally too blured in games, the same as the shot :D
So, i try to reduce this effect in the ghostPixelShader, I think.

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Pixel shader effects for FS2_open (DL)
I change a minor parameters, now the screen are less blur than the original.

Take a look :
Before :


After :


I change those values :
Quote

PARAM curFrameFactor = {0.4, 0.4, 0.4, 0.0};
PARAM ghostFactor = {0.6, 0.6, 0.6, 0.0};


More the value in GhostFactor increase and more the screen will flashy and blured.
But if you increase the curFrameFactor, the blur effect isn't quite exagerated. But, if the ghostFactor value is too low, the game would be very dark.

It is what i saw during test.


Add this code at the end of the HDRish.pss file.
Or if you would only test the Blur effect make a new file a past this code :

Code: [Select]

shader ghostPixelShader =
"!!ARBfp1.0

# Increasing the ghostFactor will increase the severity of this effect.
# To keep things the same brightness curFrameFactor and ghostFactor should
# add up to 1.

PARAM curFrameFactor = {0.4, 0.4, 0.4, 0.0};
PARAM ghostFactor = {0.6, 0.6, 0.6, 0.0};
TEMP thisFramesPixel;
TEMP lastFramesPixel;
OUTPUT oColor = result.color;

TEX thisFramesPixel, fragment.texcoord[0], texture[0], 2D;
TEX lastFramesPixel, fragment.texcoord[0], texture[1], 2D;

MUL thisFramesPixel, thisFramesPixel, curFrameFactor;
MAD oColor, lastFramesPixel, ghostFactor, thisFramesPixel;
END";

shader copyPixelShader =
"!!ARBfp1.0
OUTPUT oColor = result.color;
TEMP pixel;
TEX pixel, fragment.texcoord[0], texture[0], 2D;
MOV oColor, pixel;
END";

surface temp = allocsurf(width, height);

texture[0].source = backbuffer;
texture[1].source = temp;

destination temp;
apply ghostPixelShader;


texture[0].source = temp;
destination backbuffer;
apply copyPixelShader;

 

Offline Fury

  • The Curmudgeon
  • 213
Pixel shader effects for FS2_open (DL)
Interesting pics of TBP EMW mission 5... ;)

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Pixel shader effects for FS2_open (DL)
I love seeing Earth in low Orbit :D

 

Offline FireCrack

  • 210
  • meh...
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by Raa
If it was possible yo get a bloom on only the pure red, pure blue, and pure green colors, for glowmaps, it might be nice. ;)


or just render glow and shine seperatly then do the blur on them.
actualy, mabye not.
"When ink and pen in hands of men Inscribe your form, bipedal P They draw an altar on which God has slaughtered all stability, no eyes could ever soak in all the places you anoint, and yet to see you all at once we only need the point. Flirting with infinity, your geometric progeny that fit inside you oh so tight with triangles that feel so right."
3.141592653589793238462643383279502884197169399375105820974944 59230781640628620899862803482534211706...
"Your ever-constant homily says flaw is discipline, the patron saint of imperfection frees us from our sin. And if our transcendental lift shall find a final floor, then Man will know the death of God where wonder was before."

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Tell me how to do that with a post-filter, and I'll do it. :p
Freelance Modeler | Amateur Artist

 

Offline FireCrack

  • 210
  • meh...
Pixel shader effects for FS2_open (DL)
I was talking about when the real thing was implememnted, that yu were continuingg on from your previous post.

Evidently confusion was sewn like grain in a cornfield.
actualy, mabye not.
"When ink and pen in hands of men Inscribe your form, bipedal P They draw an altar on which God has slaughtered all stability, no eyes could ever soak in all the places you anoint, and yet to see you all at once we only need the point. Flirting with infinity, your geometric progeny that fit inside you oh so tight with triangles that feel so right."
3.141592653589793238462643383279502884197169399375105820974944 59230781640628620899862803482534211706...
"Your ever-constant homily says flaw is discipline, the patron saint of imperfection frees us from our sin. And if our transcendental lift shall find a final floor, then Man will know the death of God where wonder was before."