Author Topic: Pixel shader effects for FS2_open (DL)  (Read 23411 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)
Oh this is bad. Looks like I'll have to become a master of shaders to achive the effect I want... I thought it was simple.
--------------------------------------------------
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)
Meh. Well, with info like this, maybe the SCP team can use it. :)  I'm going to go AFK for a bit now...
Freelance Modeler | Amateur Artist

 

Offline Target

  • 25
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by Raa


Doing that eliminated the effect.


Works for me, using cat 4.12. Still seems to wash everything out a little too much, even at .25.

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Pixel shader effects for FS2_open (DL)
Yeah, I had a typo. :nervous: But it still wasn't what I was hoping for...
Freelance Modeler | Amateur Artist

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by Target


Works for me, using cat 4.12. Still seems to wash everything out a little too much, even at .25.


Well, if the code from the last page made it a bit better, I can fix it in a few minutes.
--------------------------------------------------
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)
I retry those HDR with the Cat 4.12 and it works perfectly.
It seems Cat 4.11 hates Fs 2 open and the HDRish.

 

Offline phreak

  • Gun Phreak
  • 211
  • -1
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by Raa
http://dynamic4.gamespy.com/~freespace/forums/attachment.php?s=&postid=597581


well now we know the shader effect to use when looking at the sun or into the Colossus exploding.
Offically approved by Ebola Virus Man :wtf:
phreakscp - gtalk
phreak317#7583 - discord

 

Offline Turnsky

  • FOXFIRE Artisté
  • 211
  • huh?.. Who?.. hey you kids, git off me lawn!
Pixel shader effects for FS2_open (DL)
hrm, even though i'm not gonna try this (too much arsing around ;) ) it's a start. :nod:
   //Warning\\
---------------------------------------------------------------------------------
do not torment the sleep deprived artist, he may be vicious when cornered,
in case of emergency, administer caffeine to the artist,
he will become docile after that,
and less likely to stab you in the eye with a mechanical pencil
-----------------------------------------------------------------------------------

 

Offline aldo_14

  • Gunnery Control
  • 213
Pixel shader effects for FS2_open (DL)
Did you actually try changing the divisor atall?

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Wich one?

Edit: Please give me a shot of what this one does:

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[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

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


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

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;



Edit2: It could affect the performance a bit more.
« Last Edit: January 07, 2005, 05:48: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 MetalDestroyer

  • Starwars reborn!
  • 210
Pixel shader effects for FS2_open (DL)
Fs 2 crashes with your new HDRish.pss

 

Offline mitac

  • 28
Pixel shader effects for FS2_open (DL)
The first screen is without PS, the second with those settings you posted.





Can't see any difference at all.
marcet sine adversario virtus.

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Ok, I need to make sure why this happens. I'll post two new codes. I hope one of them will fix it.

Try this one first:


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[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

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


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;
--------------------------------------------------
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)
And this is my second try:


Code: [Select]
shader samplePixelShader =
"!!ARBfp1.0

TEMP Temp;

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

END";

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


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;
--------------------------------------------------
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 mitac

  • 28
Pixel shader effects for FS2_open (DL)
They're supposed to look all the same, are they? :doubt:
marcet sine adversario virtus.

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Uhm, no.

Do they look the same?
--------------------------------------------------
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 Singh

  • Hasn't Accomplished Anything Special Or Notable
  • 211
  • Degrees of guilt.
Pixel shader effects for FS2_open (DL)
im trying out the second entry now. piccies to come :D

Oh - and it only works with ATI cards right?
"Blessed be the FREDder that knows his sexps."
"Cursed be the FREDder that trusts FRED2_Open."
Dreamed of much, accomplished little. :(

 

Offline mitac

  • 28
Pixel shader effects for FS2_open (DL)
Yeah. Though I get the impression it's linked to my machine; I see no difference between the PS and non-PS setup, with the exception of the original build in the .zip file.

Edit : and, yeah, it's an ATI card here. ;)
« Last Edit: January 07, 2005, 06:59:35 am by 1928 »
marcet sine adversario virtus.

 

Offline Singh

  • Hasn't Accomplished Anything Special Or Notable
  • 211
  • Degrees of guilt.
Pixel shader effects for FS2_open (DL)
same here...not much difference seemingly.

Just to check though, do we need the other files from that directory? Or will only the two you suggested do?
"Blessed be the FREDder that knows his sexps."
"Cursed be the FREDder that trusts FRED2_Open."
Dreamed of much, accomplished little. :(

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
The other files from the zip will have other effects.
But I think HDRish is the best.

I really don't understad why this doesn't work.
 :(


The last code should at least give some result.

Edit: Please try this one:
Code: [Select]
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";



If this works I'll replace the blurs with gaussian filters.
« Last Edit: January 07, 2005, 07:17:23 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)
----------------------------------