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

0 Members and 1 Guest are viewing this topic.

Offline Singh

  • Hasn't Accomplished Anything Special Or Notable
  • 211
  • Degrees of guilt.
Pixel shader effects for FS2_open (DL)
i dont see a difference....

question: am i supposed to enable smarthshaders in the driver options for it to work?
"Blessed be the FREDder that knows his sexps."
"Cursed be the FREDder that trusts FRED2_Open."
Dreamed of much, accomplished little. :(

 

Offline FireCrack

  • 210
  • meh...
Pixel shader effects for FS2_open (DL)
umm.. you need to be in openGL, i dont have an "ebale smarthaders" option.
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)
Quote
Originally posted by Singh
i dont see a difference....

question: am i supposed to enable smarthshaders in the driver options for it to work?



You have first to run Fs 2 open in OpenGL mode. But before doing this, install the 2 zip into you hdd, and then copy/past one of the following modification from Dabrain or me if you want the Motion Blur, into a txt file and rename it as a .pss file.

Then execute the pssControl2.exe and select the file you have just created or if you want tested the original, select the HDRish.pss fromm the All directory or from the NitroGl directory.

You can close the pssControl2 without deactivated the SmartShader you have selected, or let it open and play Fs2 open or TBP 3.0 :D

Have fun !

 

Offline Singh

  • Hasn't Accomplished Anything Special Or Notable
  • 211
  • Degrees of guilt.
Pixel shader effects for FS2_open (DL)
I did exactly that......but yet notice little difference......:/
"Blessed be the FREDder that knows his sexps."
"Cursed be the FREDder that trusts FRED2_Open."
Dreamed of much, accomplished little. :(

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Pixel shader effects for FS2_open (DL)
Try with the original HDRish from one of both zip. Run fs 2, normally, you will notice a great change for lightning.

Just for info, it run only with 9x00 Radeon card series. Otherwise, you can't see any difference.

 

Offline Singh

  • Hasn't Accomplished Anything Special Or Notable
  • 211
  • Degrees of guilt.
Pixel shader effects for FS2_open (DL)
I have a 9200SE, will it run on that?
"Blessed be the FREDder that knows his sexps."
"Cursed be the FREDder that trusts FRED2_Open."
Dreamed of much, accomplished little. :(

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Pixel shader effects for FS2_open (DL)
Hm i don't now but I just know it from the Rage3d forum. Try anyway. Hope it will work.

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
HDRish uses some Shader 2.0 instructions AFAIK.
So it won't run on the 8500, 9000, 9100 and 9200.

But even with the Shader 1.4 instructions you should be able to achive an almost simliar effect. I just have no clue how to do that. :(


Try some other shader files. Some might work.



This one should work:

shader grayscalePixelShader =
"!!ARBfp1.0
PARAM  scale = {0.30, 0.59, 0.11, 1.0};
TEMP   pixel;
OUTPUT oColor = result.color;

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


DP3 oColor, pixel, scale;
END";

texture[0].source = backbuffer;
apply grayscalePixelShader;

If not, I doubt any other effect will work.




BTW I think this feature will be added for OpenGL first, as fragmentprograms are only an extension.

Many emulator plugins have added this feature (only for OpenGL) so I think it's pretty easy to add.
« Last Edit: January 09, 2005, 06:56: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 Singh

  • Hasn't Accomplished Anything Special Or Notable
  • 211
  • Degrees of guilt.
Pixel shader effects for FS2_open (DL)
nm then. I'll just enjoy lighty's shineys then :)
"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)
Someone gave me this code.

Can you test it?

Code: [Select]

//
// Vertex shader for modifying image brightness by
// interpolation and extrapolation
//
// Author: Randi Rost
//
// Copyright (c) 2003-2004: 3Dlabs, Inc.
//
// See 3Dlabs-License.txt for license information
//

varying vec2 TexCoord;

void main (void)

{
gl_Position = ftransform();
TexCoord = gl_MultiTexCoord0.st;
}

//
// Fragment shader for modifying image brightness by
// interpolation and extrapolation
//
// Author: Randi Rost
//
// Copyright (c) 2003-2004: 3Dlabs, Inc.
//
// See 3Dlabs-License.txt for license information
//

varying vec2 TexCoord;
uniform float Alpha;
uniform sampler2D Image;

void main (void)
{
gl_FragColor = texture2D(Image, TexCoord) * Alpha;
}

//
// Vertex shader for modifying image contrast by
// interpolation and extrapolation
//
// Author: Randi Rost
//
// Copyright (c) 2003-2004: 3Dlabs, Inc.
//
// See 3Dlabs-License.txt for license information
//

varying vec2 TexCoord;

void main (void)

{
gl_Position = ftransform();
TexCoord = gl_MultiTexCoord0.st;
}

//
// Fragment shader for modifying image contrast by
// interpolation and extrapolation
//
// Author: Randi Rost
//
// Copyright (c) 2002: 3Dlabs, Inc.
//
// See 3Dlabs-License.txt for license information
//

varying vec2 TexCoord;

uniform vec3 AvgLuminance;
uniform float Alpha;
uniform sampler2D Image;

void main (void)
{
vec3 color = texture2D(Image, TexCoord).rgb;
color = mix(AvgLuminance, color, Alpha);
gl_FragColor = vec4 (color, 1.0);
}

and 3Dlabs-License.txt

/************************************************************************
* *
* Copyright (C) 2002-2004 3Dlabs Inc. Ltd. *
* *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* *
* Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the following *
* disclaimer in the documentation and/or other materials provided *
* with the distribution. *
* *
* Neither the name of 3Dlabs Inc. Ltd. nor the names of its *
* contributors may be used to endorse or promote products derived *
* from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
************************************************************************/
--------------------------------------------------
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)
Dab, your code is base on C or C++, so i don't think it will work with the pssControl2.exe.
And we have to compile it to try. erf

 

Offline DaBrain

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

I took a look at this, but I didn't notice. Stupid me.
--------------------------------------------------
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 Drew

  • 29
    • http://www.galactic-quest.com
Pixel shader effects for FS2_open (DL)
if you used 1.1 pixle shaders 1.1 vertex shaders, most of the community would be covered down to the crappy radeon 8500, and there really isnt _that_ big of a difference besides performance.

If we could somehow manage to covert alot of the straight texture effects into shaders, it would become much more avalible to lower end systems.
[(WWF - steroids + ties - spandex) / Atomic Piledrivers] - viewing audience = C-SPAN

My god.. He emptied the gasoline tank from the van onto your cat, lit him on fire, threw him in the house and dove for cover.  :wtf: Family indeed.  ~ KT

Happiness is belt fed.

 

Offline Turnsky

  • FOXFIRE Artisté
  • 211
  • huh?.. Who?.. hey you kids, git off me lawn!
Pixel shader effects for FS2_open (DL)
Quote
Originally posted by Drew
if you used 1.1 pixle shaders 1.1 vertex shaders, most of the community would be covered down to the crappy radeon 8500, and there really isnt _that_ big of a difference besides performance.

If we could somehow manage to covert alot of the straight texture effects into shaders, it would become much more avalible to lower end systems.


just for a point of reference, Radeon 9000's have 1.2 pixel shaders. :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 DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
Not quite. It's pixel shader 1.4 for 8500, 9000, 9100, 9200.
Geforce 4 TI has pixel shader 1.3
Geforce 3 has pixel shader 1.1
--------------------------------------------------
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)
----------------------------------

 
Pixel shader effects for FS2_open (DL)
Be advised people, (i dunno if anyone has already noticed, not gonna wade thru all that code in this thread) --- The White Screen problem only occurs with Catalyst 4.11 on my Radeon 9800 Pro. It goes away if you upgrade to 4.12. :)

Keep at it guys...ideally, we want an HDR style effect that is only applied to the lightest highlights...not everything like it is pretty much done right now. In JK3: Jedi Academy they specify where they do and do not want this kind of glow...we can't do THAT at present (that was done with JK3's texture files)...but we can at least filter it so it doesn't go crazy and blur/glow EVERYTHING...

...id write it myself but best i can do right now is tweak a few settings and see what happens, im not much of a coder --- but maybe i will be. given time, maybe if i look at the design docs for smartshader i found on that site link dabrain gave...

oh btw...one more thing. ive found that it looks best with the following:
- If using a bright smartshader, decrease gamma correction drastically in either FS2 or in your control panel
- put your ambient lighting really low (ambient_factor 60 or lower)
- use Taylor's OpenGL build.
- make sure you have the Media VP's and/or Lightspeed's special shinemapping installed
- Weep in joy at the beauty while watching your FPS eat the toilet (depends on your computer --- if its uber, you may just get to cry and not watch toiletry FPS)
« Last Edit: January 14, 2005, 04:43:49 pm by 1644 »

 

Offline Ransom

  • M. Night Russel
  • 210
  • It will not wait.
    • Rate of Injury
Pixel shader effects for FS2_open (DL)
It should be an option whether to glow everything or just highlights. Personally I like the effect of blurring everything.

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Pixel shader effects for FS2_open (DL)
The effect we aim for is like this:

1.Copy current screen into the buffer (as texture).
2.Increase saturation 25%
3.Decrease brightness 25%
4.Increase contrast 50%
5.(SUB [fragments wih lower values than set]
6.(KIL [these fragments])
7.(apply gaussianPixelShader [just copy it from the first page])
8.(output)



I've just found a software called "Shader Designer".
It works somehow different from the *.pss files.

The bad thing is, it won't show me a preview for fragment shaders without a vertex shader.

I know how to do these steps now: 2-4 in this langauge and 1, 5-8 in the Assembler-like *.pss language. ;)

duh...


Edit: Step 2-4:
Code: [Select]

uniform sampler2D texture;
uniform float alpha;
const vec3 coef= vec3(0.2125, 0.7154, 0.0721);
void main()
{
  vec4 color = texture2D(texture,gl_TexCoord[0].st);  
  vec4 intensity = vec4(dot(color.rgb,coef));  
  gl_FragColor  =  mix(intensity, color,alpha)+ color + color - alpha - alpha -alpha
  + color ;
}
« Last Edit: January 14, 2005, 05:57:55 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)
----------------------------------

 
Pixel shader effects for FS2_open (DL)
Any chance of a Direct3D version of this type of smartshader activation prog existing? I'd like to apply these glow effects to Freelancer too :)

 
my modification of HDRish
the following will create a less-intense and tightly-spread glow that doesn't spill everywhere like the original did.

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;
MAD result.color, blur, 0.75, back;

END";

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

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

gaussianYPixelShader.constant[ 0] = { 0, (2.0*dt_dy)* 1.45, 0, 0 };
gaussianYPixelShader.constant[ 1] = { 0, (2.0*dt_dy)* 3.45, 0, 0 };
gaussianYPixelShader.constant[ 2] = { 0, (2.0*dt_dy)* 5.45, 0, 0 };
gaussianYPixelShader.constant[ 3] = { 0, (2.0*dt_dy)* 7.45, 0, 0 };
gaussianYPixelShader.constant[ 4] = { 0, (2.0*dt_dy)* 9.45, 0, 0 };
gaussianYPixelShader.constant[ 5] = { 0, (2.0*dt_dy)*11.45, 0, 0 };
gaussianYPixelShader.constant[ 6] = { 0, (2.0*dt_dy)*13.45, 0, 0 };
gaussianYPixelShader.constant[ 7] = { 0, (2.0*dt_dy)*15.45, 0, 0 };
gaussianYPixelShader.constant[ 8] = { 0, (2.0*dt_dy)*17.45, 0, 0 };
gaussianYPixelShader.constant[ 9] = { 0, (2.0*dt_dy)*19.45, 0, 0 };
gaussianYPixelShader.constant[10] = { 0, (2.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;


My version...I took a few suggestions from other places...such as the line
Code: [Select]
MAD result.color, blur, 0.75, back;
that line came from elsewhere on the same forum that referred the original files...it tones down the glow. i also did a little logical checking around and figured "oh look at these 4.0 values in here, I bet they deal with the size of the glow!" so I did a Find and Replace on all the "dt_dy"'s and "ds_dx"'s that were in the thing. The Ds_DX  ones control the width of the glows, the dt_dy ones control the height (so you can make glows that are vertical or horizontal only if you want, but why you'd want to is beyond me).

Result: A soft glow that spreads over a smaller area around what it is glowing up. Looks MUCH better imho and is very fast -- note however that this does not include any of the dark pixel optimizations DaBrain's version has.

UPDATE: For strange results, do a Find and Replace on "2.0*" in the above code, or "4.0*" in the original HDRish, without the quotes, and replace it with numbers lower than 1.0 (0.5 is fine) --- causes VERY strange effects on the lighting...the menus get all funky for one thing...

UPDATE 2: Eliminating Shimmering Once and For All Has a Nasty Price
Code: [Select]
surface blur0 = allocsurf(width/4, height/4);
surface blur1 = allocsurf(width/4, height/4);

Those lines...the number 4 determines how much less resolution the gaussian has. In other words, /4 samples only every four pixels for the blur.
/1 : samples EVERY SINGLE DAMN PIXEL, at a severe severe severe SEVERE cost to your video card's framerate.
/2 : samples 2x2 pixels at a time...which means every 2 pixels that exist are treated as ONE pixel with ONE color (arbitrarily, it appears).
/4: samples 4x4 pixels at a time. 4 pixels are recognized as one.
/6: samples 6x6 pixel region at a time. 6 pixels are treated and displayed as one single pixel enlarged to fit your resolution.

and so on...

...What we need is a code to make it take the AVERAGE of four pixels or six pixels or eight pixels and use that average for the blur effect, rather than a straight resolution chopping which is what is currently having.

The bigger that number, the more mosaic-y your HDRishnish effects are going to be. The only way to cut back on this is if it is somehow made to be the average RGB and brightness of four or more pixels together rather than just using one of them to represent the whole region of four or more pixels/unit.

That would be the best tradeoff between performace and quality. Right now, the larger the number after that divide sign, the less resolution and the faster the HDR effect, but the worse it looks and the more it shimmers.
« Last Edit: January 16, 2005, 07:22:41 pm by 1644 »