PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Injecting Postprocessing effects like bloom (split from FXAA thread)


BeetleatWar1977
2011-07-22, 15:47:49
Nun steh ich da und muss den Startpost moderieren^^




Link to SVN - Projectpage: https://www.assembla.com/spaces/fxaa-pp-inject/documents

Gast
2011-08-05, 13:27:33
Hi,

Is it possible to add our own shaders ?

For example, I have tried to add a simple tonemap shader like so

I started by adding a line to shader.fx

#include "Tonemap.h"

The contents of Tonemap.h are as follows,



#define s0 screenSampler
#define Luminance 0.10
#define fMiddleGray 0.15
#define fWhiteCutoff 0.5

float4 main( float2 tex )
{
float4 color = tex2D(s0, tex) * fMiddleGray / ( Luminance + 0.001 );

color *= ( 1.0 + ( color / ( fWhiteCutoff * fWhiteCutoff ) ) );
color /= ( 1.0 + color );

return color;
}


This is a simple shader that works in various shader testers, but crashes when using some_dude's dll.
Any ideas ?

Gast
2011-08-05, 14:31:00
[some dude]
About "Tonemap.h":
Yes, it is possible to use such simple shaders (instead of the sharpening pass).

Replace the line "//Replace this line with #include "Sharpen.h" to add a sharpening pass" in shader.fx with #include "Tonemap.h"

Use those contents for "Tonemap.h":
#define USE_ADDITIONAL_SHADER 1
#define s0 screenSampler
#define Luminance 0.10
#define fMiddleGray 0.15
#define fWhiteCutoff 0.5

float4 main( float2 tex )
{
float4 color = tex2D(s0, tex) * fMiddleGray / ( Luminance + 0.001 );

color *= ( 1.0 + ( color / ( fWhiteCutoff * fWhiteCutoff ) ) );
color /= ( 1.0 + color );

return color;
}

Gast
2011-08-05, 14:37:12
can we use more than one pass? (sharpen + tonemap)

Gast
2011-08-05, 15:39:11
I just want a combo with:

- FXAA
- Sharpen
- Brightness/Contrast
- Color tone


:)

Gast
2011-08-05, 15:56:22
[some dude]
In general the answer is no (due to current internal working). However with such simple shaders (which only sample one texel) it can be done. Actually the sharpening pass is combined with a luma pass already because the luma pass is a simple one.

Here is an example how to use sharpen and tonemap at the same time (contents of the CustomShader.h file):
#define USE_ADDITIONAL_SHADER 1
//My redefinitions
#define s0 screenSampler
#define width BUFFER_WIDTH
#define height BUFFER_HEIGHT
#define px BUFFER_RCP_WIDTH
#define py BUFFER_RCP_HEIGHT

/* Modified Sharpen complex v2 from Media Player Classic Home Cinema */
/* Parameters */

// pour le calcul du flou
#define moyenne 0.6
#define dx (moyenne*px)
#define dy (moyenne*py)

#define CoefFlou 2
#define CoefOri (1+ CoefFlou)

// pour le sharpen
#define SharpenEdge 0.2
#define Sharpen_val0 2
#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)


float4 SharpenPass( float2 tex ) {

// recup du pixel original
float4 ori = tex2D(s0, tex);

// calcul image floue (filtre gaussien)
float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
float4 c2 = tex2D(s0, tex + float2(0,-dy));
float4 c3 = tex2D(s0, tex + float2(dx,-dy));
float4 c4 = tex2D(s0, tex + float2(-dx,0));
float4 c5 = tex2D(s0, tex + float2(dx,0));
float4 c6 = tex2D(s0, tex + float2(-dx,dy));
float4 c7 = tex2D(s0, tex + float2(0,dy));
float4 c8 = tex2D(s0, tex + float2(dx,dy));

// filtre gaussien
// [ 1, 2 , 1 ]
// [ 2, 4 , 2 ]
// [ 1, 2 , 1 ]
// pour normaliser les valeurs, il faut diviser par la somme des coef
// 1 / (1+2+1+2+4+2+1+2+1) = 1 / 16 = .0625
float4 flou = (c1+c3+c6+c8 + 2*(c2+c4+c5+c7)+ 4*ori)*0.0625;

// soustraction de l'image flou à l'image originale
float4 cori = CoefOri*ori - CoefFlou*flou;

// détection des contours
// récuppération des 9 voisins
// [ c1, c2 , c3 ]
// [ c4,ori , c5 ]
// [ c6, c7 , c8 ]
c1 = tex2D(s0, tex + float2(-px,-py));
c2 = tex2D(s0, tex + float2(0,-py));
c3 = tex2D(s0, tex + float2(px,-py));
c4 = tex2D(s0, tex + float2(-px,0));
c5 = tex2D(s0, tex + float2(px,0));
c6 = tex2D(s0, tex + float2(-px,py));
c7 = tex2D(s0, tex + float2(0,py));
c8 = tex2D(s0, tex + float2(px,py));

// par filtre de sobel
// Gradient horizontal
// [ -1, 0 ,1 ]
// [ -2, 0, 2 ]
// [ -1, 0 ,1 ]
float delta1 = (c3 + 2*c5 + c8)-(c1 + 2*c4 + c6);

// Gradient vertical
// [ -1,- 2,-1 ]
// [ 0, 0, 0 ]
// [ 1, 2, 1 ]
float delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);

// calcul
if (sqrt( mul(delta1,delta1) + mul(delta2,delta2)) > SharpenEdge) {
// si contour, sharpen
//return float4(1,0,0,0);
return ori*Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1;
} else {
// sinon, image corrigée
return cori;
}
}

#define Luminance 0.10
#define fMiddleGray 0.15
#define fWhiteCutoff 0.5

float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput * fMiddleGray / ( Luminance + 0.001 );

color *= ( 1.0 + ( color / ( fWhiteCutoff * fWhiteCutoff ) ) );
color /= ( 1.0 + color );

return color;
}

float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput
float4 pass2 = TonemapPass( pass1, tex);
//...more simple passes here ...
//return final color
return pass2;
}

Gast
2011-08-05, 16:43:22
@ [Some Dude]

The Sharpening + Tonemapping worked fine, many thanks.

I have tried my old HDR shader and it also worked ok. This is good for anyone wanting Contrast + Gamma in their games.


#define Exposure 0.400
#define Gamma 1.000

float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;

color = max(0, color);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

return color;
}


That worked well combined with the sharpening.
Is it possible to also include lerp commands ? I am trying to get the whole HDR shader working, which also includes lens colors + Blueshift, like so


#define Defog 0.000
#define FogColor {0.0, 0.0, 0.0, 0.0}
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.10

float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float3 d = color * float3(1.05f, 0.97f, 1.27f);
color = lerp(color, d, BlueShift);

return c;
}


using the same method as the one at the top of this post I am unable to get this working. Again, any help most welcome.
And also again, many thanks for all that you have done so far. :)

Gast
2011-08-05, 17:14:23
now we need the BLOOM effect


:)

Gast
2011-08-05, 17:20:06
@ [Some Dude]

The Sharpening + Tonemapping worked fine, many thanks.

I have tried my old HDR shader and it also worked ok. This is good for anyone wanting Contrast + Gamma in their games.

did u have some color filter (color correction) shader ?

Gast
2011-08-05, 20:42:37
bloom

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0, in float2 uv1 : TEXCOORD1)
{
float4 c_center = texRECT(samp0, uv0.xy).rgba;

float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0);
uv0 += float2(0.003, 0.003);
float radius1 = 0.0013;
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius1);

float radius2 = 0.0046;
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius2);

bloom_sum *= 0.07;
bloom_sum -= float4(0.3, 0.3, 0.3, 0.3);
bloom_sum = max(bloom_sum, float4(0,0,0,0));

float2 vpos = (uv1 - float2(.5, .5)) * 2;
float dist = (dot(vpos, vpos));
dist = 1 - 0.0*dist;

ocol0 = (c_center * 0.7 + bloom_sum) * dist;
}

Gast
2011-08-05, 22:25:28
[some dude]
About lerp: lerp is a hlsl/cg function and works fine. However your code contains a few mistakes.
Replace the lines
#define FogColor {0.0, 0.0, 0.0, 0.0}
float3 d = color * float3(1.05f, 0.97f, 1.27f);
return c;
with
#define FogColor float4(0.0, 0.0, 0.0, 0.0)
float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
return color;

You seem to mix up float3 and float 4. In general stick to one type. Just remember that the fourth component is set to luma afterwards anyway.

In the next beta I will output the compilation errors to the logfile to simplify custom shader coding.

The Guest
2011-08-05, 22:31:02
cool, love this BlueShift effect


#define Defog 0.000
#define FogColor float4(0.0, 0.0, 0.0, 0.0)
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.10

float4 TonemapPass( float4 colorInput, float2 tex ){
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

return color;
}

Gast
2011-08-05, 22:34:49
cool, love this BlueShift effect


#define Defog 0.000
#define FogColor float4(0.0, 0.0, 0.0, 0.0)
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.10

float4 TonemapPass( float4 colorInput, float2 tex ){
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

return color;
}


Could you post some screenshots?

Gast
2011-08-06, 00:25:25
Once again, some_dude, many thanks, worked perfectly.

>>You seem to mix up float3 and float 4. In general stick to one type. Just remember that the fourth component is set to luma afterwards anyway.

I didn't spot that one, thanks. I have been so used to ENB shader editing that this new way is slightly different and needs a little bit of learning (I am a amateur shader editor, at this).

I have tried a 3rd pass with my old Technicolor shader, it works, but it does not translate to the screen as working.

This is how far I have got so far.


#define Defog 0.000
#define FogColor float4(0.0, 0.0, 0.0, 0.0)
#define Exposure 1.300
#define Gamma 1.500
#define BlueShift 0.20

float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

return color;
}

#define redfilter float4(0.8, 1.0, 0.8, 1.00)
#define greenfilter float4(0.30, 1.0, 0.0, 1.0)
#define bluefilter float4(0.25, 1.0, 1.0, 1.0)
#define redorangefilter float4(1.05, 0.620, 0.0, 1.0)
#define cyanfilter float4(0.0, 1.30, 1.0, 1.0)
#define magentafilter float4(1.0, 0.0, 1.05, 1.05)
#define yellowfilter float4(1.6, 1.6, 0.05, 1.0)
#define amount 1.00

float4 TechnicolorPass( float4 colorInput, float2 tex ) : COLOR0
{
float4 tcol = tex2D(s0, tex);

float4 filtgreen = tcol * greenfilter;
float4 filtblue = tcol * magentafilter;
float4 filtred = tcol * redorangefilter;
float4 rednegative = float((filtred.r + filtred.g + filtred.b)/3.0);
float4 greennegative = float((filtgreen.r + filtgreen.g + filtgreen.b)/3.0);
float4 bluenegative = float((filtblue.r+ filtblue.g + filtblue.b)/3.0);
float4 redoutput = rednegative + cyanfilter;
float4 greenoutput = greennegative + magentafilter;
float4 blueoutput = bluenegative + yellowfilter;
float4 result = redoutput * greenoutput * blueoutput;

return lerp(tcol, result, amount);
}

float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
#define Defog 0.000
#define FogColor float4(0.0, 0.0, 0.0, 0.0)
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.10

float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

return color;
}

#define redfilter float4(1.0, 0.0, 0.0, 1.0)
#define greenfilter float4(0.0, 1.0, 0.0, 1.0)
#define bluefilter float4(0.0, 0.0, 1.0, 1.0)
#define redorangefilter float4(0.99, 0.263, 0.0, 1.0)
#define cyanfilter float4(0.0, 1.0, 1.0, 1.0)
#define magentafilter float4(1.0, 0.0, 1.0, 1.0)
#define yellowfilter float4(1.0, 1.0, 0.0, 1.0)
#define amount 1.00

float4 TechnicolorPass( float4 colorInput, float2 tex ) : COLOR0
{
float4 tcol = tex2D(s0, tex);

float4 filtgreen = tcol * greenfilter;
float4 filtblue = tcol * magentafilter;
float4 filtred = tcol * redorangefilter;
float4 rednegative = float((filtred.r + filtred.g + filtred.b)/3.0);
float4 greennegative = float((filtgreen.r + filtgreen.g + filtgreen.b)/3.0);
float4 bluenegative = float((filtblue.r+ filtblue.g + filtblue.b)/3.0);
float4 redoutput = rednegative + cyanfilter;
float4 greenoutput = greennegative + magentafilter;
float4 blueoutput = bluenegative + yellowfilter;
float4 result = redoutput * greenoutput * blueoutput;

return lerp(tcol, result, amount);
}

float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput

float4 pass2 = TonemapPass( pass1, tex);

float4 pass3 = TechnicolorPass( pass2, tex);


I also have a simple Bleachbypass running, but that didn't look very good.

BTW, some_dude, Do you mind if I include this in my RealityIV GTAIV mod ?
I will give full credit to your good self in a Readme.

Lastly, since I cannot seem to register here (don't speak German), I will address myself as my screen name, DKT70.
Many thanks for all your help, some_dude.

Gast
2011-08-06, 00:29:22
Sorry for the above post, it has been posted wrong. It seems the forum has posted the reply TWICE, so please ignore the double shader settings, there are only one set of instructions, not two. I think it is because I get the question wrong because of the German text, I have to refresh until a maths question is asked. Sorry.

Gast
2011-08-06, 00:49:37
[some dude]
@DKT70: There are some semantic issues. First of all in all passes after the first (complex) pass use "colorInput" instead of "tex2D(s0, tex)".
So e.g. replace the line
float4 tcol = tex2D(s0, tex);
with
float4 tcol = colorInput;

tex2D samples the very first image buffer and should not be used by the chained passes. That is why "colorInput" is given to the following passes.
(as you see in the comment //Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput)
Also do not use any semantic keywords in your own passes (e.g. : COLOR0).
So just replace
float4 TechnicolorPass( float4 colorInput, float2 tex ) : COLOR0
with
float4 TechnicolorPass( float4 colorInput, float2 tex )

Feel free to use it in your mode, it is supposed to be as free as the current FXAA release. So I suppose my license is compatible with the beer license (http://en.wikipedia.org/wiki/Beerware)

Gast
2011-08-06, 01:01:07
so, this is the DKT70 correct code:

#define Defog 0.000
#define FogColor float4(0.0, 0.0, 0.0, 0.0)
#define Exposure 0.300
#define Gamma 1.500
#define BlueShift 0.20

float4 TonemapPass( float4 colorInput, float2 tex ){
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

return color;
}

#define redfilter float4(0.8, 1.0, 0.8, 1.00)
#define greenfilter float4(0.30, 1.0, 0.0, 1.0)
#define bluefilter float4(0.25, 1.0, 1.0, 1.0)
#define redorangefilter float4(1.05, 0.620, 0.0, 1.0)
#define cyanfilter float4(0.0, 1.30, 1.0, 1.0)
#define magentafilter float4(1.0, 0.0, 1.05, 1.05)
#define yellowfilter float4(1.6, 1.6, 0.05, 1.0)
#define amount 1.00

float4 TechnicolorPass( float4 colorInput, float2 tex ) {
float4 tcol = colorInput;

float4 filtgreen = tcol * greenfilter;
float4 filtblue = tcol * magentafilter;
float4 filtred = tcol * redorangefilter;
float4 rednegative = float((filtred.r + filtred.g + filtred.b)/3.0);
float4 greennegative = float((filtgreen.r + filtgreen.g + filtgreen.b)/3.0);
float4 bluenegative = float((filtblue.r+ filtblue.g + filtblue.b)/3.0);
float4 redoutput = rednegative + cyanfilter;
float4 greenoutput = greennegative + magentafilter;
float4 blueoutput = bluenegative + yellowfilter;
float4 result = redoutput * greenoutput * blueoutput;

return lerp(tcol, result, amount);
}


float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput
float4 pass2 = TonemapPass( pass1, tex);
//...more simple passes here ...
float4 pass3 = TechnicolorPass( pass2, tex);
//return final color
return pass3;
}



i get a lot of white area with this settings :(

Gast
2011-08-06, 01:40:00
What is the HSLS color pattern ?

float4(1.05, 0.620, 0.0, 1.0)

Gast
2011-08-06, 01:43:23
[DKT70]

Once again, thanks to some_dude for the help, most appreciated.

I now have the following working,

HDR Tonemapping, which includes :-
Gamma
Contrast
Lens Filter Coloring
Blue Shift - This is for shifting the color palette to the blue spectrum - useful for settings that are a little too yellow.
Vignetting - adds a dark camera lens affect around the edges of the screen
Saturation levels.

Here is the code if anyone wants to try it. The only downside is that these effects affect both 2D and 3D, so menus will/may also be affected.

Do standard code tags work in this forum ? Going to try for now


#define Defog 0.000 // Strength of Lens Colors.
#define FogColor float4(0.0, 0.0, 0.0, 0.0) //Lens-style color filters for Blue, Red, Yellow, White.
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.20 // Higher = more blue in image.
#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
#define VignetteRadius 1.00 // lower values = stronger radial effect from center
#define VignetteAmount -0.90 // Strength of black. -2.00 = Max Black, 1.00 = Max White.
#define saturation 0.0 // use negative values for less saturation.


float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

float2 tc = tex - VignetteCenter;
float v = length(tc) / VignetteRadius;
color += pow(v, 4) * VignetteAmount;

float4 middlegray = float(color.r + color.g + color.b) * 0.333;
float4 diffcolor = color - middlegray;
color += diffcolor *+ saturation;

return color;
}

float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput
float4 pass2 = TonemapPass( pass1, tex);
//...more simple passes here ...
//return final color
return pass2;
}


Put that in customshader.h at the end.
I shall now attempt to fix Technicolor effects + add bleach bypass.

racerX
2011-08-06, 01:56:52
Great DKT70,

perfect, i almost finish to include Vignette from Shazzam but u are one step forward :D

give us BLOOM and i delete my ENB Series right now :)

Gast
2011-08-06, 02:47:23
racerx, I am sure bloom is 2-pass, so not sure if that would work. Would be nice, we could possibly create a sky mask and map the bloom to the sky mask creating a sun bloom + lens flare effect.
I did this with ENB 0.82, you can see it in action by downloading the Icenhancer ENB mod since this has my sun shader effects in this mod.

Ok, here is a updated uber-shader


#define Defog 0.000 // Strength of Lens Colors.
#define FogColor float4(0.0, 0.0, 0.0, 0.0) //Lens-style color filters for Blue, Red, Yellow, White.
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.20 // Higher = more blue in image.
#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
#define VignetteRadius 1.00 // lower values = stronger radial effect from center
#define VignetteAmount -0.90 // Strength of black. -2.00 = Max Black, 1.00 = Max White.
#define saturation 0.0 // use negative values for less saturation.
#define Opacity 0.50 // Bleach Bypass values, higher = stronger effect.


float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

float3 lumCoeff = float3(0.25, 0.65, 0.1);
float lum = dot (lumCoeff, color.rgb);
float3 blend = lum.rrr;
float L = min(1, max (0, 10 * (lum - 0.45)));
float3 result1 = 2.0f * color.rgb * blend;
float3 result2 = 1.0f - 2.0f * (1.0f - blend) * (1.0f - color.rgb);
float3 newColor = lerp(result1, result2, L);
float A2 = Opacity * color.rgb;
float3 mixRGB = A2 * newColor;
color.rgb += ((1.0f - A2) * mixRGB);

// Sepia Tones - float3(1.00, 1.00, 1.00) values are for R G B
// float gray = dot(color.rgb, float4(0.3, 0.59, 0.11, 0));
// color.rgb = float4(color.rgb * float3(1.00, 1.00, 1.00) , 1);

float2 tc = tex - VignetteCenter;
float v = length(tc) / VignetteRadius;
color += pow(v, 4) * VignetteAmount;

float4 middlegray = float(color.r + color.g + color.b) * 0.333;
float4 diffcolor = color - middlegray;
color += diffcolor *+ saturation;

return color;
}

float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput
float4 pass2 = TonemapPass( pass1, tex);
//...more simple passes here ...
//return final color
return pass2;
}


Opacity is for the Bleach Bypass, this isn't by me, I just converted a nvidia fx shader from their library. Not 100% sure if this is working correctly.

For fun I have included my sepia code for playing around with, not meant for serious work, but some of you may find it useful for something. Just untag the 2 // lines under the line "// Sepia Tones". The tones themselves are in

float3(1.00, 1.00, 1.00) , 1);

1.00, 1.00, 1.00 are RGB values. For some examples of Sepia tones


Auburn
(1.09, 0.53, 0.26)

Beige
(2.45, 2.45, 2.20)

Bistre
(0.61, 0.43, 0.31)

Bole
(1.21, 0.68, 0.59)

Bronze
(2.05, 1.27, 0.50)

Brown
(1.50, 0.75, 0)

Buff
(2.40, 2.20, 1.30)

Burgundy
(1.44, 0, 0.32)

Burnt sienna
(2.33, 1.16, 0.81)

Burnt umber
(1.38, 0.51, 0.36)

Camel
(1.93, 1.54, 1.07)

Chamoisee
(1.60, 1.20, 0.90)

Chestnut
(2.05, 0.92, 0.92)

Chocolate
(1.23, 0.63, 0)

Citrine
(2.08, 2.08, 0.10)

Copper
(1.84, 1.15, 0.51)

Cordovan
(1.37, 0.63, 0.69)

Desert sand
(2.37, 2.01, 1.75)

Earth yellow
(2.25, 1.69, 0.95)

Ecru
(1.94, 1.78, 1.28)

Fallow
(1.93, 1.54, 1.07)

Fawn
(2.29, 1.70, 1.12)

Fulvous
(2.28, 1.32, 0)

Isabelline
(2.24, 2.20, 2.36)

Khaki
(1.95, 1.76, 1.45)

Liver
(0.83, 0.75, 0.79)

Mahogany
(0.192, 0.64, 0)

Maroon
(1.28, 0, 0)

Ochre
(2.04, 1.19, 0.34)

Raw umber
(1.46, 1.02, 0.68)

Redwood
(1.71, 0.78, 0.82)

Rufous
(1.68, 0.28, 0.07)

Russet
(1.28, 0.70, 0.27)

Rust
(1.83, 0.65, 0.14)

Sandy brown
(2.44, 1.64, 0.96)

Seal brown
(0.50, 0.20, 0.20)

Sepia
(1.12, 0.66, 0.20)

Sienna
(1.36, 0.45, 0.23)

Sinopia
(2.03, 0.65, 0.11)

Tan
(2.10, 1.80, 1.40)

Taupe
(0.72, 0.60, 0.50)

Umber
(0.99, 0.81, 0.71)

Wenge
(1.00, 0.84, 0.82)

Wheat
(2.45, 2.22, 1.79)


Anything will do, they don't have to be sepia-based colors.

Gast
2011-08-06, 02:57:40
How do we go about using the "uber shader" ? heh. Do we attach it to the customershader that was on page 17?

racerX
2011-08-06, 03:17:12
@ DKT70

Sepia Tone dont work here :(

u will tweak your TechnicolorPass ?? cant combine with Bleach Bypass so i prefer TechnicolorPass :)

Gast
2011-08-06, 03:25:34
Yep, as from P17.

Racerx,

Try this, change the following lines so they look like this.

// Sepia Tones - float3(1.00, 1.00, 1.00) values are for R G B
float gray = dot(color.rgb, float4(0.3, 0.59, 0.11, 0));
color.rgb = float4(color.rgb * float3(1.12, 0.66, 0.20) , 1);

That should give you a sepia tone according to values from wiki. It is not really useful, but a laugh just playing around with what can and cannot be done.

racerX
2011-08-06, 03:28:54
yeah, now works :)

BeetleatWar1977
2011-08-06, 06:21:58
Great DKT70,

perfect, i almost finish to include Vignette from Shazzam but u are one step forward :D

give us BLOOM and i delete my ENB Series right now :)
racerx, I am sure bloom is 2-pass, so not sure if that would work. Would be nice, we could possibly create a sky mask and map the bloom to the sky mask creating a sun bloom + lens flare effect.
I did this with ENB 0.82, you can see it in action by downloading the Icenhancer ENB mod since this has my sun shader effects in this mod.

Ok, here is a updated uber-shader


#define Defog 0.000 // Strength of Lens Colors.
#define FogColor float4(0.0, 0.0, 0.0, 0.0) //Lens-style color filters for Blue, Red, Yellow, White.
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.20 // Higher = more blue in image.
#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
#define VignetteRadius 1.00 // lower values = stronger radial effect from center
#define VignetteAmount -0.90 // Strength of black. -2.00 = Max Black, 1.00 = Max White.
#define saturation 0.0 // use negative values for less saturation.
#define Opacity 0.50 // Bleach Bypass values, higher = stronger effect.


float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

float3 lumCoeff = float3(0.25, 0.65, 0.1);
float lum = dot (lumCoeff, color.rgb);
float3 blend = lum.rrr;
float L = min(1, max (0, 10 * (lum - 0.45)));
float3 result1 = 2.0f * color.rgb * blend;
float3 result2 = 1.0f - 2.0f * (1.0f - blend) * (1.0f - color.rgb);
float3 newColor = lerp(result1, result2, L);
float A2 = Opacity * color.rgb;
float3 mixRGB = A2 * newColor;
color.rgb += ((1.0f - A2) * mixRGB);

// Sepia Tones - float3(1.00, 1.00, 1.00) values are for R G B
// float gray = dot(color.rgb, float4(0.3, 0.59, 0.11, 0));
// color.rgb = float4(color.rgb * float3(1.00, 1.00, 1.00) , 1);

float2 tc = tex - VignetteCenter;
float v = length(tc) / VignetteRadius;
color += pow(v, 4) * VignetteAmount;

float4 middlegray = float(color.r + color.g + color.b) * 0.333;
float4 diffcolor = color - middlegray;
color += diffcolor *+ saturation;

return color;
}

float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput
float4 pass2 = TonemapPass( pass1, tex);
//...more simple passes here ...
//return final color
return pass2;
}


Opacity is for the Bleach Bypass, this isn't by me, I just converted a nvidia fx shader from their library. Not 100% sure if this is working correctly.

For fun I have included my sepia code for playing around with, not meant for serious work, but some of you may find it useful for something. Just untag the 2 // lines under the line "// Sepia Tones". The tones themselves are in

float3(1.00, 1.00, 1.00) , 1);

1.00, 1.00, 1.00 are RGB values. For some examples of Sepia tones


Auburn
(1.09, 0.53, 0.26)

Beige
(2.45, 2.45, 2.20)

Bistre
(0.61, 0.43, 0.31)

Bole
(1.21, 0.68, 0.59)

Bronze
(2.05, 1.27, 0.50)

Brown
(1.50, 0.75, 0)

Buff
(2.40, 2.20, 1.30)

Burgundy
(1.44, 0, 0.32)

Burnt sienna
(2.33, 1.16, 0.81)

Burnt umber
(1.38, 0.51, 0.36)

Camel
(1.93, 1.54, 1.07)

Chamoisee
(1.60, 1.20, 0.90)

Chestnut
(2.05, 0.92, 0.92)

Chocolate
(1.23, 0.63, 0)

Citrine
(2.08, 2.08, 0.10)

Copper
(1.84, 1.15, 0.51)

Cordovan
(1.37, 0.63, 0.69)

Desert sand
(2.37, 2.01, 1.75)

Earth yellow
(2.25, 1.69, 0.95)

Ecru
(1.94, 1.78, 1.28)

Fallow
(1.93, 1.54, 1.07)

Fawn
(2.29, 1.70, 1.12)

Fulvous
(2.28, 1.32, 0)

Isabelline
(2.24, 2.20, 2.36)

Khaki
(1.95, 1.76, 1.45)

Liver
(0.83, 0.75, 0.79)

Mahogany
(0.192, 0.64, 0)

Maroon
(1.28, 0, 0)

Ochre
(2.04, 1.19, 0.34)

Raw umber
(1.46, 1.02, 0.68)

Redwood
(1.71, 0.78, 0.82)

Rufous
(1.68, 0.28, 0.07)

Russet
(1.28, 0.70, 0.27)

Rust
(1.83, 0.65, 0.14)

Sandy brown
(2.44, 1.64, 0.96)

Seal brown
(0.50, 0.20, 0.20)

Sepia
(1.12, 0.66, 0.20)

Sienna
(1.36, 0.45, 0.23)

Sinopia
(2.03, 0.65, 0.11)

Tan
(2.10, 1.80, 1.40)

Taupe
(0.72, 0.60, 0.50)

Umber
(0.99, 0.81, 0.71)

Wenge
(1.00, 0.84, 0.82)

Wheat
(2.45, 2.22, 1.79)


Anything will do, they don't have to be sepia-based colors.

Im on a 1pass Bloomshader - just give me one hour or two ;)

Edit: a first Testpics... basicly it workes

off:
http://www.abload.de/thumb/screenshot38047ctx.png (http://www.abload.de/image.php?img=screenshot38047ctx.png)

On:
http://www.abload.de/thumb/screenshot3893deio.png (http://www.abload.de/image.php?img=screenshot3893deio.png)


The code to get a Downsampled Map for the Bloom - or other effects:


#define s0 screenSampler
#define width BUFFER_WIDTH
#define height BUFFER_HEIGHT
#define px BUFFER_RCP_WIDTH
#define py BUFFER_RCP_HEIGHT



float4 Bloom( float2 Tex )
{
#define NUM_SAMPLES2 16
float4 BlurColor2 = 0.0f;
float4 BKThreshold = 0.0f;
float NRGSamples = 1.0f;
NRGSamples = NUM_SAMPLES2 /2;
float MaxSamples = (NUM_SAMPLES2+1)*(NUM_SAMPLES2+1);
float MaxDistance = sqrt(NRGSamples*NRGSamples*2);
float CurDistance = MaxDistance;
float4 Blurtemp= 0;
float4 SceneColor = tex2D(s0,Tex);

for(int Samplex = (- NRGSamples); Samplex < NRGSamples+1; Samplex = Samplex + 1)
{



for(int Sampley = (- NRGSamples); Sampley < NRGSamples+1; Sampley = Sampley + 1)
{

CurDistance = sqrt ( (Samplex * Samplex) + (Sampley*Sampley));

Blurtemp.rgb = tex2D(s0, float2(Tex.x +(Tex.x*Samplex*px),Tex.y +(Tex.y*Sampley*py)));

BlurColor2.rgb += lerp(Blurtemp.rgb,SceneColor.rgb, 1 - ((MaxDistance - CurDistance)/MaxDistance));

}



}


BlurColor2.rgb = (BlurColor2.rgb / MaxSamples);

return BlurColor2;

}

Gast
2011-08-06, 09:01:51
@Previous: That's more colour-correction esque than bloom.. notice how the whole scene has been corrected into the same shades as the HUD?

BeetleatWar1977
2011-08-06, 10:10:59
@Previous: That's more colour-correction esque than bloom.. notice how the whole scene has been corrected into the same shades as the HUD?

Not really - it was just a Testscreen, implementation is not finished yet.

Would upload some Screens but abload seems to be down.

Edit: other hoster

http://www.bilderhoster.net/thumbs/ncn9gr8j.jpg (http://www.bilderhoster.net/img.php?id=ncn9gr8j.jpg)

http://www.bilderhoster.net/thumbs/8x6c55az.jpg (http://www.bilderhoster.net/img.php?id=8x6c55az.jpg)

Gast
2011-08-06, 10:30:45
@Previous: That's more like it, awesome job. Just needs a little more feather or displacement and it'll be perfect. ;)

BeetleatWar1977
2011-08-06, 11:17:53
@Previous: That's more like it, awesome job. Just needs a little more feather or displacement and it'll be perfect. ;)
The adjustment is a piece of.....

an other Game:
http://www.abload.de/thumb/screenshot4934kvx1.png (http://www.abload.de/image.php?img=screenshot4934kvx1.png) http://www.abload.de/thumb/screenshot500004py.png (http://www.abload.de/image.php?img=screenshot500004py.png)

i think i should calculate the amount dynamic.

BeetleatWar1977
2011-08-06, 12:34:04
@Previous: That's more like it, awesome job. Just needs a little more feather or displacement and it'll be perfect. ;)
Ok - Code to be added @ shaders.fx

after the samplers

#include "Bloom.h"

float MinBloom =0.70f;




in myshader

float4 c1 = 0.0f;
float Bloomamount = saturate ( (dot(c0.xyz,float3(0.299, 0.587, 0.114))- MinBloom ) + (1/ 1-MinBloom) );
float BloomScale = 1.2f/c0.w;
c1 = Bloom (Tex) * BloomScale;
c0.rgb =lerp(c0,c1, Bloomamount).rgb;

c0.w = 1;

return saturate(c0);

Bloom.h


#define s0 screenSampler
#define width BUFFER_WIDTH
#define height BUFFER_HEIGHT
#define px BUFFER_RCP_WIDTH
#define py BUFFER_RCP_HEIGHT



float4 Bloom( float2 Tex )
{
#define NUM_SAMPLES2 8
float4 BlurColor2 = 0.0f;
float4 BKThreshold = 0.0f;
float NRGSamples = 1.0f;
NRGSamples = NUM_SAMPLES2 /2;
float Samplescaler =8.0f;
float MaxSamples = (NUM_SAMPLES2+1)*(NUM_SAMPLES2+1);
float MaxDistance = sqrt(NRGSamples*NRGSamples*2*Samplescaler);
float CurDistance = MaxDistance;
float4 Blurtemp= 0;
float4 SceneColor = tex2D(s0,Tex);

for(int Samplex = (- NRGSamples); Samplex < NRGSamples+1; Samplex = Samplex + 1)
{



for(int Sampley = (- NRGSamples); Sampley < NRGSamples+1; Sampley = Sampley + 1)
{

CurDistance = sqrt ( ((Samplex * Samplex) + (Sampley*Sampley))*Samplescaler);

Blurtemp.rgb = tex2D(s0, float2(Tex.x +(Tex.x*Samplex*px*Samplescaler),Tex.y +(Tex.y*Sampley*py*Samplescaler)));

BlurColor2.rgb += lerp(Blurtemp.rgb,SceneColor.rgb, 1 - ((MaxDistance - CurDistance)/MaxDistance));

}



}


BlurColor2.rgb = (BlurColor2.rgb / MaxSamples);

return BlurColor2;

}

Gast
2011-08-06, 14:14:27
Cheers for the bloom shader, beetleatwar.

Here are a couple of early GTAIV shots using the effects I posted a page back.
This is stock GTAIV using my RealityIV mod, with a few times 9am - 6pm adjusted for the new effects.

http://i52.tinypic.com/2la8phe.jpg
http://i51.tinypic.com/1ziuz6.jpg
http://i56.tinypic.com/10gl43n.jpg

racerX
2011-08-06, 15:26:53
@BeetleatWar1977

where i insert this code ? any line in my Customshader.h ?

float4 c1 = 0.0f;
float Bloomamount = saturate ( (dot(c0.xyz,float3(0.299, 0.587, 0.114))- MinBloom ) + (1/ 1-MinBloom) );
float BloomScale = 1.2f/c0.w;
c1 = Bloom (Tex) * BloomScale;
c0.rgb =lerp(c0,c1, Bloomamount).rgb;

c0.w = 1;

return saturate(c0);

Thanks for make me delete my ENB Series :D

BeetleatWar1977
2011-08-06, 15:27:14
>>Should i integrade the shader to yours?

Is that possible ?
If you could, that would be great. Perhaps put up a download for anyone wanting it, as well.


#define Defog 0.000 // Strength of Lens Colors.
#define FogColor float4(0.0, 0.0, 0.0, 0.0) //Lens-style color filters for Blue, Red, Yellow, White.
#define Exposure 0.400
#define Gamma 1.000
#define BlueShift 0.20 // Higher = more blue in image.
#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
#define VignetteRadius 1.00 // lower values = stronger radial effect from center
#define VignetteAmount -0.90 // Strength of black. -2.00 = Max Black, 1.00 = Max White.
#define saturation 0.0 // use negative values for less saturation.
#define Opacity 0.50 // Bleach Bypass values, higher = stronger effect.

#define NUM_SAMPLES2 8 //Number of samples, taken for the Bloomeffekt: Don make that to high!! 8 means 81 Samples per Pixel, 16 will be 289 Samples!
float MinBloom = 0.70f; //The min level which the effect starts
float Samplescaler = 8.0f; //Scalr for the sampler - the larger this one, the larger the area affektet
float BloomScale = 1.5f; // The Power of the Bloom

float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0);
color = lerp(color, d, BlueShift);

float3 lumCoeff = float3(0.25, 0.65, 0.1);
float lum = dot (lumCoeff, color.rgb);
float3 blend = lum.rrr;
float L = min(1, max (0, 10 * (lum - 0.45)));
float3 result1 = 2.0f * color.rgb * blend;
float3 result2 = 1.0f - 2.0f * (1.0f - blend) * (1.0f - color.rgb);
float3 newColor = lerp(result1, result2, L);
float A2 = Opacity * color.rgb;
float3 mixRGB = A2 * newColor;
color.rgb += ((1.0f - A2) * mixRGB);

// Sepia Tones - float3(1.00, 1.00, 1.00) values are for R G B
// float gray = dot(color.rgb, float4(0.3, 0.59, 0.11, 0));
// color.rgb = float4(color.rgb * float3(1.00, 1.00, 1.00) , 1);

float2 tc = tex - VignetteCenter;
float v = length(tc) / VignetteRadius;
color += pow(v, 4) * VignetteAmount;

float4 middlegray = float(color.r + color.g + color.b) * 0.333;
float4 diffcolor = color - middlegray;
color += diffcolor *+ saturation;

return color;
}

float4 Bloom( float4 ColorInput2,float2 Tex )
{

float4 BlurColor2 = 0.0f;
float4 BKThreshold = 0.0f;
float NRGSamples = 1.0f;
NRGSamples = NUM_SAMPLES2 /2;
float MaxSamples = (NUM_SAMPLES2+1)*(NUM_SAMPLES2+1);
float MaxDistance = sqrt(NRGSamples*NRGSamples*2*Samplescaler);
float CurDistance = MaxDistance;
float4 Blurtemp= 0;


for(int Samplex = (- NRGSamples); Samplex < NRGSamples+1; Samplex = Samplex + 1)
{



for(int Sampley = (- NRGSamples); Sampley < NRGSamples+1; Sampley = Sampley + 1)
{

CurDistance = sqrt ( ((Samplex * Samplex) + (Sampley*Sampley))*Samplescaler);

Blurtemp.rgb = tex2D(s0, float2(Tex.x +(Tex.x*Samplex*px*Samplescaler),Tex.y +(Tex.y*Sampley*py*Samplescaler)));

BlurColor2.rgb += lerp(Blurtemp.rgb,ColorInput2.rgb, 1 - ((MaxDistance - CurDistance)/MaxDistance));

}



}


BlurColor2.rgb = (BlurColor2.rgb / MaxSamples);


float Bloomamount = saturate ( (dot(ColorInput2.xyz,float3(0.299, 0.587, 0.114))- MinBloom ) / MinBloom );
float4 BlurColor = BlurColor2 * BloomScale;
BlurColor2.rgb =lerp(ColorInput2,BlurColor, Bloomamount).rgb ;
BlurColor2.a = ColorInput2.a;
return saturate (BlurColor2);
}

float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
float4 pass1 = SharpenPass(tex);
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput
float4 pass2 = TonemapPass( pass1, tex);
//Bloompass
float4 pass3 = Bloom (pass2,tex);
//...more simple passes here ...
//...more simple passes here ...

//return final color
return pass3;
}

no prob ;)


More parameters to play with :D

[dzp]Viper
2011-08-06, 15:29:45
Wouldnt it be better to create a UI-Tool?

As the tool is right now there are not many people who are going to use this...

A real "tool" with a user interface would be extremly helpfull..

BeetleatWar1977
2011-08-06, 15:34:42
Viper;8872103']Wouldnt it be better to create a UI-Tool?

As the tool is right now there are not many people who are going to use this...

A real "tool" with a user interface would be extremly helpfull..

I would say - if this is going to be final, then a (config)tool make sense.

At this time, with parameters changing every hour - not really.

racerX
2011-08-06, 16:00:46
@BeetleatWar1977

what i have to do to get Bloom ? ok, i copy your last code that merged with DKT70 shaders, and insert in my Customshader.h

but i need the codes of page20, insert to shader.fx and create Bloom.h too ?

my game is crashing.

Thanks

BeetleatWar1977
2011-08-06, 16:10:50
@BeetleatWar1977

what i have to do to get Bloom ? ok, i copy your last code that merged with DKT70 shaders, and insert in my Customshader.h

but i need the codes of page20, insert to shader.fx and create Bloom.h too ?

my game is crashing.

Thanks
This should help:

#define FXAA_PC 1
#define FXAA_HLSL_3 1
#define FXAA_QUALITY__PRESET 39
//#define FXAA_QUALITY__PRESET 12


#include "Fxaa3_11.h"

uniform extern texture gScreenTexture;
uniform extern texture gLumaTexture;

//Difinitions: BUFFER_WIDTH, BUFFER_HEIGHT, BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT

sampler screenSampler = sampler_state
{
Texture = <gScreenTexture>;
MinFilter = POINT;
MagFilter = POINT;
MipFilter = POINT;
AddressU = BORDER;
AddressV = BORDER;
SRGBTexture = FALSE;
};
sampler lumaSampler = sampler_state
{
Texture = <gLumaTexture>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU = BORDER;
AddressV = BORDER;
SRGBTexture = FALSE;
};

#include "Sharpen.h"
#include "Customshader.h"


//Replace this line with #include "Sharpen.h" to add a sharpening pass

float4 LumaShader( float2 Tex : TEXCOORD0 ) : COLOR0
{
#ifdef USE_ADDITIONAL_SHADER
float4 c0 = main(Tex);
#else
float4 c0 = tex2D(screenSampler,Tex);
#endif
c0.w = dot(c0.xyz,float3(0.299, 0.587, 0.114)); //store luma in alpha
//c0.w = sqrt(dot(c0.xyz,float3(0.299, 0.587, 0.114))); //store luma in alpha
return c0;
}

float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 c0 = FxaaPixelShader(
Tex, //pos
0, //fxaaConsolePosPos (?)
lumaSampler, //tex
lumaSampler, //fxaaConsole360TexExpBiasNegOne
lumaSampler, //fxaaConsole360TexExpBiasNegTwo
float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT), //fxaaQualityRcpFrame
float4(-0.5*BUFFER_RCP_WIDTH,-0.5*BUFFER_RCP_HEIGHT,0.5*BUFFER_RCP_WIDTH,0.5*BUFFER_RCP_HEIGHT), //fxaaConsoleRcpFrameOpt
float4(-2.0*BUFFER_RCP_WIDTH,-2.0*BUFFER_RCP_HEIGHT,2.0*BUFFER_RCP_WIDTH,2.0*BUFFER_RCP_HEIGHT), //fxaaConsoleRcpFrameOpt2
float4(8.0*BUFFER_RCP_WIDTH,8.0*BUFFER_RCP_HEIGHT,-4.0*BUFFER_RCP_WIDTH,-4.0*BUFFER_RCP_HEIGHT), //fxaaConsole360RcpFrameOpt2
0.50, //fxaaQualitySubpix (default: 0.75)
0.166, //fxaaQualityEdgeThreshold
0.0833, //fxaaQualityEdgeThresholdMin
8.0, //fxaaConsoleEdgeSharpness
0.125, //fxaaConsoleEdgeThreshold
0.05, //fxaaConsoleEdgeThresholdMin
0 //fxaaConsole360ConstDir
);
c0.w = 1;
return saturate(c0);
}


technique PostProcess1
{
pass p1
{
PixelShader = compile ps_3_0 LumaShader();
}
}

technique PostProcess2
{
pass p1
{
PixelShader = compile ps_3_0 MyShader();
}
}

if not - post the logfile created

racerX
2011-08-06, 16:19:25
yep, now works ;)

but i lost a lot of FPS :(

BeetleatWar1977
2011-08-06, 17:47:56
yep, now works ;)

but i lost a lot of FPS :(
I will try some performancetuning later - any other wishes?

racerX
2011-08-06, 18:00:33
I will try some performancetuning later - any other wishes?
let me see... pepperoni pizza ? :D

i think shaders are fine at moment, i get realistic effects/colors with that... maybe depth of field in future but i know this can be a fps killer :)

Thanks again ;)

Tom Yum 72
2011-08-06, 21:05:11
Man kann Bloom adden? Geht das auch mit depth of field?

BeetleatWar1977
2011-08-06, 21:08:39
Man kann Bloom adden? Geht das auch mit depth of field?

Bloom ging - für DoF fehlen mir die Informationen zur Tiefe.

Motionblur könnte klappen.

Tom Yum 72
2011-08-06, 21:11:14
Motionblur? Cool,versuch mal bitte. Schade wegen Dof,das wäre der Knaller.

BeetleatWar1977
2011-08-06, 21:15:34
Motionblur? Cool,versuch mal bitte. Schade wegen Dof,das wäre der Knaller.
Morgen - für heute hab ich genug geproggt.

Gast
2011-08-06, 21:37:27
[DKT70]

@ BeetleatWar1977,

Thanks for combining the effects, works well, thanks.

BeetleatWar1977
2011-08-06, 22:01:29
[DKT70]

@ BeetleatWar1977,

Thanks for combining the effects, works well, thanks.

No prob - have you some time for Screenshots?

Ultranist
2011-08-06, 22:31:18
Vergleichsbilder?

Bloom OFF
http://www.shrani.si/t/3N/Gb/2RQRgn7Y/screenshot16013.jpg (http://www.shrani.si/?3N/Gb/2RQRgn7Y/screenshot16013.png)

Bloom ON
http://www.shrani.si/t/1Z/u/4MOdsgZq/screenshot16200.jpg (http://www.shrani.si/?1Z/u/4MOdsgZq/screenshot16200.png)

Gast
2011-08-06, 22:41:49
>>No prob - have you some time for Screenshots?

I will try. I will probably not use it in GTAIV since there is no way of directly controlling the bloom from the game, otherwise I would have to have bloom on at all times, including Cloudy and Rainy times.
I will setup a test environment for GTAIV for testing your bloom, and post some screens a bit later.

Is there any bbcode for this forum for posting thumbnails ?
As a guest, I don't see any advanced controls for posting. If not, I will post some screenshots on a website that supports linking to thumbs.

DrFreaK666
2011-08-06, 23:30:41
Bloom OFF
http://www.shrani.si/t/3N/Gb/2RQRgn7Y/screenshot16013.jpg (http://www.shrani.si/?3N/Gb/2RQRgn7Y/screenshot16013.png)

Bloom ON
http://www.shrani.si/t/1Z/u/4MOdsgZq/screenshot16200.jpg (http://www.shrani.si/?1Z/u/4MOdsgZq/screenshot16200.png)

Der Schatten... ;D

edit: Könnte jemand seine Config hochladen (mit Allem drum udn dran (Bloom, Sharpener...))? Ich blick hier langsam nicht mehr durch. Danke :smile:

SA
2011-08-07, 01:54:38
Is it possible to do a version for GTASA with these shaders included :) ?
http://wiki.multitheftauto.com/wiki/Shader_examples

At least the two road shines and the water

The Guest
2011-08-07, 03:53:59
Is it possible to do a version for GTASA with these shaders included :) ?
http://wiki.multitheftauto.com/wiki/Shader_examples

At least the two road shines and the water
i think this is a global plugin, for every each game. This is not so restricted on GTA like ENB Series.

why include a road shader if will be used on Fifa ? :D :D

Hübie
2011-08-07, 04:21:53
Hab hier (http://www.forum-3dcenter.org/vbulletin/showpost.php?p=8873089&postcount=4027) mal was reingestellt. Die unteren Screenshots sind mit den shaderfiles gemacht. Völlig überstrahlt und FXAA geht net.

SA
2011-08-07, 05:00:21
i think this is a global plugin, for every each game. This is not so restricted on GTA like ENB Series.

why include a road shader if will be used on Fifa ? :D :D
ENB is not GTA restricted neither :P
It's just SA is a endless game, And a perfect graphic hack hasn't been made yet for it, ENB is not enough, Many people will be happy if these shaders are accomplished. :)

Gast
2011-08-07, 11:39:39
can anyone make a code "Car Reflection" look like "enb"

thank you~

BeetleatWar1977
2011-08-07, 12:04:23
>>No prob - have you some time for Screenshots?

I will try. I will probably not use it in GTAIV since there is no way of directly controlling the bloom from the game, otherwise I would have to have bloom on at all times, including Cloudy and Rainy times.
I will setup a test environment for GTAIV for testing your bloom, and post some screens a bit later.

Is there any bbcode for this forum for posting thumbnails ?
As a guest, I don't see any advanced controls for posting. If not, I will post some screenshots on a website that supports linking to thumbs.
eg use Abload - the code for the thumbnails works (Forum1)

Solche Stellen gibt es auch in GTA4. Vielleicht sind die zu transparent. Vor allem bei so dünnen Kabeln oder Leitungen ist mir das aufgefallen.
Oder auch in WOT - das könnte aber Einstellungssache beim FXAA sein - vielleicht noch etwas mit den werten rumspielen.
Hab hier (http://www.forum-3dcenter.org/vbulletin/showpost.php?p=8873089&postcount=4027) mal was reingestellt. Die unteren Screenshots sind mit den shaderfiles gemacht. Völlig überstrahlt und FXAA geht net.
Ich hab kein GTA - am Anfang der Post.h findest du alles zum Einstellen ;)


Soderle, was ich eigentlich wollte:

Ich hab noch etwas rumgespielt:

man kann in der Post.h jetzt die einzelnen Effekte an/ausschalten:

// comment these to deaktivate the Functions
#define USE_SHARPENING
#define USE_TONEMAP
#define USE_BLOOM
#define USE_LIMITER

ausserdem hab ich einen begrenzer für die Ausgabe eingefügt, mit den Werten.
// this two can be used to limit the range of the output - eg for Videorecording or TV´s or Testing purposes
float4 MinColor= float4(0.0f,0.0f,0.0f,0.0f);
float4 MaxColor= float4(1.0f,1.0f,1.0f,1.0f);

könnt ihr den Ausgabebereich einstellen (wenn z.B. jemand am Fernseher zockt, wären das:

// this two can be used to limit the range of the output - eg for Videorecording or TV´s or Testing purposes
float4 MinColor= float4(0.0625f,0.0625f,0.0625ff,0.0f);
float4 MaxColor= float4(0.984375f,0.984375f,0.984375ff,1.0f);

die Performance sollte eigentlich auch etwas besser sein.




I've played around a bit:

you can now turn in the Post.h the individual effects on / off:

/ / comment these to the deaktivate Functions
# define USE_SHARPENING
# define USE_TONEMAP
# define USE_BLOOM
# define USE_LIMITER

I'm also inserted a limiter , with the values.
/ / this two can be used to limit the range of the output - eg for video recording or TV's or testing purposes
float4 MinColor = float4 (0.0f, 0.0f, 0.0f, 0.0f);
float4 MaxColor = float4 (1.0f, 1.0f, 1.0f, 1.0f);

you can adjust the output range (for example, if someone gaming on television, were that:

/ / this two can be used to limit the range of the output - eg for video recording or TV's or testing purposes
float4 MinColor = float4 (0.0625f, 0.0625f, 0.0625ff, 0.0f);
float4 MaxColor = float4 (0.984375f, 0.984375f, 0.984375ff, 1.0f);

performance should actually be something better.

BeetleatWar1977
2011-08-07, 12:51:33
[some dude]
@DrFreaK666: SSAO or DoF requires more information about the scene (depth) than it is provided in the general case. Also there will be no support for DirectX 7/8 because sufficient shader technology is provided since DirectX 9.0c.

I looked around the net and the current "bugs" (e.g. in Starcraft 2, Crysis 2 or Stalker SoC) are due to people not knowing where to put the files, forgetting to disable MSAA or using other tools which force different game setting.
The only real cause why no FXAA is supported is when the logfile contains the line "pDevice->CreateDeferredContext failed". Then, unfortunately, it just won't work.

Would it be possible to get an additional Sampler with a linear downscaled version (eg /4) of the screen? Would speed PP up like hell ;)

Gast
2011-08-07, 13:54:09
[some dude]
@BeetleatWar1977: If you are refering to the usual postprocessing approach which is done on lower scale and blended to the output afterwards, then it is not as simple as adding another sampler. Additionally it would require more logic and configuration which are likely to result in incompatibility and performance loss.
I took a brief look at PP V2 and noticed that float4 Bloom( float4 ColorInput2,float2 Tex ) uses tex2D which doesn't take previous passes into account and samples only the original/unmodified buffer.

BeetleatWar1977
2011-08-07, 14:15:09
[some dude]
@BeetleatWar1977: If you are refering to the usual postprocessing approach which is done on lower scale and blended to the output afterwards, then it is not as simple as adding another sampler. Additionally it would require more logic and configuration which are likely to result in incompatibility and performance loss.
I took a brief look at PP V2 and noticed that float4 Bloom( float4 ColorInput2,float2 Tex ) uses tex2D which doesn't take previous passes into account and samples only the original/unmodified buffer.

I use the original buffer to get the samples - and lerp it to the modifed. The bloom is blurred, so nobody would see the difference ;)

how about to simple create mipmaps? i could maybe use a smaller to get the same effect.

Gast
2011-08-07, 17:22:16
Bloom doesnt work for me.

Cant see any diference, especially on dark scenes.

only FPS drop (image lag)



:(

Tom Yum 72
2011-08-07, 17:22:28
Öhm, ...ein/ausschalten in dem ich davor das // setze ? In der Post.h ?

BeetleatWar1977
2011-08-07, 17:27:05
Zwei Probleme mit deinem Paket festgestellt.

1. Direkte Vergleiche zwischen beta 9 und deiner Version sind nicht möglich da 2 von 4 Dateien sich nicht ersetzen lassen ohne aus dem Spiel rauszugehen.
2. Nachdem ich alle 4 Dateien ersetzt habe (ohne Post.h) startet Mafia II nicht mehr.

PS: In die Dateien reinzuschauen bringt mich nicht weiter, das ist alles fachchinesisch für mich. ;)
ohne Post.h kanns nicht gehen - weil er die Datei vom Hauptprogramm aus nicht mehr findet.

Bloom doesnt work for me.

Cant see any diference, especially on dark scenes.

only FPS drop (image lag)



:(
Parameter is set very low - try:

float MinBloom = 0.65f;
float BloomScale = 1.30f;

Öhm, ...ein/ausschalten in dem ich davor das // setze ? In der Post.h ?

Ja - mt Comment " // " ists aus ;)



Also nochmal für Leute OA ;)

so ist aus:
//#define USE_TONEMAP

und so wärs an
#define USE_TONEMAP

zu finden ab Zeile 29 in der Post.h

dargo
2011-08-07, 17:30:32
Boah... ich blick hier echt nicht mehr durch. :freak:

Wo muss ich jetzt überall // vor setzen:

#define USE_SHARPENING
#define USE_TONEMAP
#define USE_BLOOM
#define USE_LIMITER
#define USE_ADD_SHARPENING

Nur bei 2-4 oder bei allen wenn ich das PP-Gedöns nicht haben will?

BeetleatWar1977
2011-08-07, 17:32:48
#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
#define USE_LIMITER
#define USE_ADD_SHARPENING

du kannst auch die 2 Filter einzeln probieren:

#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
//#define USE_LIMITER
//#define USE_ADD_SHARPENING

oder halt umgekehrt

//#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
//#define USE_LIMITER
#define USE_ADD_SHARPENING


edit:


Außerdem ist mir aufgefallen, dass es irgendwie den Kontrast des Spieles ändert, welcher Befehl wäre denn hier auszuschalten damit wirklich nur FXAA arbeitet?
Danke im voraus ;)
alle ;)

edit2:
Außer, dass das Bild dunkler wird, passiert bei mir nichts. Keine Glättung.
http://www.abload.de/img/screenshot18722637.png
http://www.abload.de/img/screenshot1989e0ko.png

der Screen: http://www.abload.de/img/screenshot18722637.png
ist doch geglättet?


Edit3:
Wenn alle Funktionen drin sind, brauchen wir wohl wirklich ein Configtool - evtl mit Vorschaufunktion. Freiwillige vor?

Gast
2011-08-07, 17:38:20
Parameter is set very low - try:

float MinBloom = 0.65f;
float BloomScale = 1.30f;


nop, only brightness my image, nothing affect dark areas (no whitening blur).


http://ryanspeets.com/wp-content/uploads/2011/03/bloom-300x187.jpg


can u post a screenshot with this working correctly ?

BeetleatWar1977
2011-08-07, 17:45:21
nop, only brightness my image, nothing affect dark areas (no whitening blur).


http://ryanspeets.com/wp-content/uploads/2011/03/bloom-300x187.jpg


can u post a screenshot with this working correctly ?
Hm - what have you used for the example?

Edit: Oh, i forgot something - i removed the "bleeding" of the bloom because of the HUD - it would be unreadable on some games.

dargo
2011-08-07, 17:48:31
#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
#define USE_LIMITER
#define USE_ADD_SHARPENING

du kannst auch die 2 Filter einzeln probieren:

#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
//#define USE_LIMITER
//#define USE_ADD_SHARPENING

oder halt umgekehrt

//#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
//#define USE_LIMITER
#define USE_ADD_SHARPENING

Merci. =)

noAA
http://s7.directupload.net/images/110807/temp/iq8b2sis.jpg (http://s7.directupload.net/file/d/2609/iq8b2sis_jpg.htm)

FXAA @Beetle
http://s7.directupload.net/images/110807/temp/35hipmoj.jpg (http://s7.directupload.net/file/d/2609/35hipmoj_jpg.htm)

Man sieht, dass deine Version sehr gut auch die Stromleitungen erfasst im Gegensatz zur beta 9. Habe hier beides an gehabt, sowohl USE_SHARPENING als auch USE_ADD_SHARPENING. Dafür wird das Dach bsw. etwas schlechter geglättet. Auf der anderen Seite büßt die Bildschärfe mit deiner Version imho überhaupt nichts ein. Das finde ich schon sehr erfreulich. Ich probiere mal noch die einzelen "Schärfer" aus. :)

Edit:
Hier mal mit:
//#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
//#define USE_LIMITER
#define USE_ADD_SHARPENING
http://s1.directupload.net/images/110807/temp/bd5w7qle.jpg (http://s1.directupload.net/file/d/2609/bd5w7qle_jpg.htm)

Und mit:
#define USE_SHARPENING
//#define USE_TONEMAP
//#define USE_BLOOM
//#define USE_LIMITER
//#define USE_ADD_SHARPENING
http://s7.directupload.net/images/110807/temp/gba6ydnj.jpg (http://s7.directupload.net/file/d/2609/gba6ydnj_jpg.htm)

Die Szene ist zu dynamisch um da noch Unterschiede zu erkennen. Ich würde sagen ersteres minimal im Vorteil.

Gast
2011-08-07, 21:53:30
@BeetleatWar1977
float MinBloom value seems to depends a lot on how the graphics cards color handeling is set.
As example, I use a value of 0.6 and get good results, while another person gets greytones on some objects in the same game.
So the bloom effect is missing some sort of pre-check to be more accurate.

racerX
2011-08-08, 03:06:24
yep, no Bloom only brightness too

http://img263.imageshack.us/img263/6650/gscbloom.jpg

:(

BeetleatWar1977
2011-08-08, 06:43:41
@BeetleatWar1977
float MinBloom value seems to depends a lot on how the graphics cards color handeling is set.
As example, I use a value of 0.6 and get good results, while another person gets greytones on some objects in the same game.
So the bloom effect is missing some sort of pre-check to be more accurate.
I have stumbled into a little problem. The tonemapping-pass can push the colorvalues beyond 1.0 - which lead to unexpected results. Im on it.

BeetleatWar1977
2011-08-09, 07:26:33
I did some tests with only pre sharpen and bloom, it still can go wrong if the value is set to low OR to high.
So I looked a bit around and tested some things out.
Could you please test this edited Dx9 version out?
http://www13.zippyshare.com/v/36950352/file.html

this contains the same error as mine - limiter wont work *g*

i will rework the whole bloom algorythm - for the bug and the performance.

BeetleatWar1977
2011-08-09, 09:15:59
Was muss ich bei Need for Speed: Hot Pursuit 2010 machen damit man FXAA hat? Würde das gerne mal testen aber so ganz sehe ich mich nicht aus was man nun braucht. Vielleicht kann man denn Start Post mal so anpassen damit man sich auskennt.
einfach die Files für DX9 in den Spieleordner kopieren und starten.

Für die Jungs, die wegen das Blooms meckern:

for the guys niggling about the bloom: (niggling - is that the right translation?)



#define Defog 0.000 // Strength of Lens Colors.
#define FogColor float4(0.0, 0.0, 0.0, 0.0) //Lens-style color filters for Blue, Red, Yellow, White.
#define Exposure 0.000
#define Gamma 1.000
#define BlueShift 0.20 // Higher = more blue in image.
#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
#define VignetteRadius 1.00 // lower values = stronger radial effect from center
#define VignetteAmount -0.30 // Strength of black. -2.00 = Max Black, 1.00 = Max White.
#define saturation 0.01 // use negative values for less saturation.
#define Opacity 0.20 // Bleach Bypass values, higher = stronger effect.

#define NUM_SAMPLES2 16 //Number of samples, taken for the Bloomeffekt: Dont make that to high!! 4 are 25 Samples, 8 means 81 Samples per Pixel, 16 will be 289 Samples!, must be a divider of 2
float MinBloom = 0.70f; //The min level which the effect starts
float Samplescaler = 1.5f; //Scaler for the sampler - the larger this one, the larger the area affectet
float BloomScale = 0.30f; // The Power of the Bloom


float addsharpen = 0.01; //Controls the additional Sharpening - applied after the PP, this is a fast&simple one

// this two can be used to limit the range of the output - eg for Videorecording or TV´s or Testing purposes
float4 MinColor= float4(0.0f,0.0f,0.0f,0.0f);
float4 MaxColor= float4(1.0f,1.0f,1.0f,1.0f);



// comment these to deaktivate the Functions
#define USE_SHARPENING
#define USE_TONEMAP
#define USE_BLOOM
//#define USE_LIMITER
#define USE_ADD_SHARPENING
//#define USE_ADD_SHARPENING_AFTER_FXAA

float CalcLum ( float4 colorInput )
{
float3 lumCoeff = float3(0.299, 0.587, 0.114);
float lum = dot (lumCoeff, colorInput.rgb);
return lum;
}


float4 TonemapPass( float4 colorInput, float2 tex )
{

float4 color = colorInput;
color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);

float4 d = color * float4(1.05f, 0.97f, 1.27f, 1.0f);
color = lerp(color, d, BlueShift);


float lum = CalcLum (color);
float3 blend = lum.rrr;
float L = min(1, max (0, 10 * (lum - 0.45)));
float3 result1 = 2.0f * color.rgb * blend;
float3 result2 = 1.0f - 2.0f * (1.0f - blend) * (1.0f - color.rgb);
float3 newColor = lerp(result1, result2, L);
float A2 = Opacity * color.rgb;
float3 mixRGB = A2 * newColor;
color.rgb += ((1.0f - A2) * mixRGB);

// Sepia Tones - float3(1.00, 1.00, 1.00) values are for R G B
// float gray = dot(color.rgb, float4(0.3, 0.59, 0.11, 0));
// color.rgb = float4(color.rgb * float3(1.00, 1.00, 1.00) , 1);

float2 tc = tex - VignetteCenter;
float v = length(tc) / VignetteRadius;
color += pow(v, 4) * VignetteAmount;

float4 middlegray = float(color.r + color.g + color.b) * 0.333;
float4 diffcolor = color - middlegray;
color += diffcolor *+ saturation;


return color;
}

float4 Bloom( float4 ColorInput2,float2 Tex )
{

float4 BlurColor2 = 0.0f;
float4 BKThreshold = 0.0f;
float NRGSamples = 1.0f;
NRGSamples = NUM_SAMPLES2 /2;
float MaxSamples = (NUM_SAMPLES2+1)*(NUM_SAMPLES2+1);
float MaxDistance = sqrt(NRGSamples*NRGSamples*2*Samplescaler);
float CurDistance = MaxDistance;
float4 Blurtemp= 0;
float Samplescaler2 = 0;


for(int Samplex = (- NRGSamples); Samplex < NRGSamples+1; Samplex = Samplex + 1)
{
for(int Sampley = (- NRGSamples); Sampley < NRGSamples+1; Sampley = Sampley + 1)
{
CurDistance = sqrt ( ((Samplex * Samplex) + (Sampley*Sampley))*Samplescaler);
Blurtemp.rgb = tex2D(s0, float2(Tex.x +(Tex.x*Samplex*px*Samplescaler),Tex.y +(Tex.y*Sampley*py*Samplescaler)));
BlurColor2.rgb += lerp(Blurtemp.rgb,ColorInput2.rgb, saturate (1.5 - ((MaxDistance - CurDistance)/MaxDistance)));
}
}


// for(int Samplex = (- NRGSamples); Samplex < NRGSamples+1; Samplex = Samplex + 1)
// {
// Samplescaler2 = Samplescaler * abs( NRGSamples/(NRGSamples -1 )); //BlurStart + BlurWidth*(i/(float) (NSAMPLES-1.0))
// CurDistance = sqrt ( ((Samplex * Samplex) + (Sampley*Sampley))*Samplescaler);
// Blurtemp.rgb += tex2Dbias(s0, float4(Tex.x +(Tex.x*Samplex*px*Samplescaler2),Tex.y+(Tex.y*Samplex*py*Samplescaler2) ,0,0));

// BlurColor2.rgb += lerp(Blurtemp.rgb,ColorInput2.rgb, 1 - ((MaxDistance - CurDistance)/MaxDistance));
// BlurColor2.rgb += Blurtemp.rgb;


BlurColor2.rgb = (BlurColor2.rgb / MaxSamples);
float Bloomcalc1 = CalcLum (ColorInput2);
float Bloomcalc2 = CalcLum (BlurColor2);
float Correctionammount = (1 + ( Bloomcalc1 - Bloomcalc2));
float4 BlurColor = BlurColor2 * Correctionammount;

Correctionammount = MinBloom * Correctionammount;
float Bloomamount = saturate ( (Bloomcalc1 - Correctionammount ) / Correctionammount );
BlurColor2.rgb =lerp((0,0,0,0),BlurColor, Bloomamount).rgb ;
BlurColor2.rgb = (ColorInput2 + saturate (BlurColor.rgb *BloomScale ));
float Bloomcalc3 = CalcLum (BlurColor2);
float Correctionammount2 = (1 + ( Bloomcalc1 - Bloomcalc3));
BlurColor2 = BlurColor2 * Correctionammount2;

BlurColor2.a = ColorInput2.a;
return BlurColor2;
}

float4 limiter (float4 orig,float2 tex) // this has always to be the last pass
{

orig = (orig*(MaxColor-MinColor)+MinColor);

return orig;
}

float4 sharp( float4 orig,float2 tex )
{
// Strength should be from 0.0 to 1.0

float4 color;

color = 9.0 * orig;
color -= tex2D( s0, tex.xy + float2(px, py));
color -= tex2D( s0, tex.xy + float2(0.0, py));
color -= tex2D( s0, tex.xy + float2(-px, py));
color -= tex2D( s0, tex.xy + float2(-px, 0));

color -= tex2D( s0, tex.xy + float2(-px, -py));
color -= tex2D( s0, tex.xy + float2(0, -py));
color -= tex2D( s0, tex.xy + float2(px, -py));
color -= tex2D( s0, tex.xy + float2(px, 0));
color = color * addsharpen + (1.0 - addsharpen) * orig;
color.a = orig.a;

return color;
}


float4 main( float2 tex) {
//SharpenPass has to be the first pass because it samples multiple texels
#ifdef USE_SHARPENING
float4 pass1 = SharpenPass(tex);
#else
float4 pass1 = tex2D(s0,tex);
#endif
//Custom simple pass which would have used tex2D(s0, tex) but now uses pass1 as colorInput
#ifdef USE_TONEMAP
float4 pass2 = TonemapPass( pass1, tex);
#else
float4 pass2 = pass1;
#endif
//Bloompass
#ifdef USE_BLOOM
float4 pass3 = Bloom (pass2,tex);
#else
float4 pass3 = pass2;
#endif
// additional Sharpening pass
#ifdef USE_ADD_SHARPENING
float4 pass4 = sharp (pass3,tex);
#else
float4 pass4 = pass3;
#endif
//...more simple passes here ...
//...more simple passes here ...




// Limiter - always last
#ifdef USE_LIMITER
float4 pass5 = limiter (pass4,tex);
#else
float4 pass5 = pass4;
#endif


//return final color
return pass5 ;
}

PS: I know, Performance is as slow as hell at the moment.

Violator
2011-08-09, 15:39:56
this contains the same error as mine - limiter wont work *g*

i will rework the whole bloom algorythm - for the bug and the performance.
Maybe make use of my re-arrangement too, much easier for average users to find out which settings to adjust if they are first in the file, or even better put it in a separate post.config
I know it's nitpicking, I just hate code messing all over instead of having a nice arrangement from start. ;D (object orientated even better)
The bloom is actually quite nice in the game I tested it up against, getting good feedback from other players too, and its possible to adjust settings and see the change asap without closing the game down, minimize/maximize is enough.
The Limiter seems to produce stuttering thou, maybe cause it gets a bit to much for a mmo.
I did cut out some of the code too, I don't think its needed with high precision on the first sharpening calculations with the additional post bloom sharpening.
The Tonemap contained a bit more than just tonemap, like vignette etc. , should be separated from the tonemap tbh., to avoid unnecessary calculations.
The cool thing with the tonemap are the leftovers, since that allows to tweak for accurate screenshots, means they look exactly as they look on live.

BeetleatWar1977
2011-08-09, 20:50:43
Schade, dass es kein OpenSVN mehr gibt. :(

***************************************
New version that includes the 3 most important adjustable settings for the AA amount in Settings.h
EDIT: Corrected a mistake in the pass order and added Vignette as separate effect.

http://www43.zippyshare.com/v/92569536/file.html

I think a neat game overlay written in C++ would be nice for controlling this.

Just tried V
:up:

float4 limiter (float4 orig,float2 tex) // this has always to be the last pass
{

orig = (orig*(MaxColor-MinColor)+MinColor);

return orig;
}


This limiter should me much better ;)

Violator
2011-08-09, 21:03:53
:up:

float4 limiter (float4 orig,float2 tex) // this has always to be the last pass
{

orig = (orig*(MaxColor-MinColor)+MinColor);

return orig;
}


This limiter should me much better ;)
Thanks, going to try that straight away.

Arcania doesn't start with this.
What does your log.log say?

Ronny145
2011-08-09, 21:05:24
What does your log.log say?


redirecting CreateDevice
D3DXCreateEffectFromFile failed
C:\Program Files (x86)\JoWooD Entertainment AG\ArcaniA - Gothic 4 Demo\shader.fx(11,10): error X1507: failed to open source file: 'fxaad3d9\Fxaa3_11.h'

Ronny145
2011-08-09, 21:28:04
Did you paste the folder so that you have 8 files in the fxaad3d9 folder?
"C:\Program Files (x86)\JoWooD Entertainment AG\ArcaniA - Gothic 4 Demo\fxaad3d9\" 8 files here*

All files included below and copied into the Arcania folder.

- Bloom.h
- FinalLimiter.h
- Post.h
- PostSharpen.h
- PreSharpen.h
- Tonemap.h
- Vignette.h
- Fxaa3_11.h

and

- d3d9.dll
- log.log
- Settings.h
- shader.fx

BeetleatWar1977
2011-08-09, 21:35:57
All files included below and copied into the Arcania folder.

- Bloom.h
- FinalLimiter.h
- Post.h
- PostSharpen.h
- PreSharpen.h
- Tonemap.h
- Vignette.h
- Fxaa3_11.h

and

- d3d9.dll
- log.log
- Settings.h
- shader.fx
das war der Fehler - du must den subfolder übernehmen ;)

\Arcania\fxaad3d9

Violator
2011-08-09, 21:36:02
All files included below and copied into the Arcania folder.

- Bloom.h
- FinalLimiter.h
- Post.h
- PostSharpen.h
- PreSharpen.h
- Tonemap.h
- Vignette.h
- Fxaa3_11.h

and

- d3d9.dll
- log.log
- Settings.h
- shader.fx

These:
- Bloom.h
- FinalLimiter.h
- Post.h
- PostSharpen.h
- PreSharpen.h
- Tonemap.h
- Vignette.h
- Fxaa3_11.h
Should be in a subfolder, since the "include" lines call them from there, check the code in shader.fx.

@Beetle
Your new limiter works wonders.
Check this: http://www55.zippyshare.com/v/91314320/file.html
Note that I included a LimiterStrenght setting which can be adjusted via Settings.h
Made it with 3 decimals since even the smallest adjustments affect the limiter.

Ronny145
2011-08-09, 21:37:23
das war der Fehler - du must den subfolder übernehmen ;)

\Arcania\fxaad3d9

Das sollte man dann in einer Readme erklären. Die fehlt.

Violator
2011-08-09, 21:41:01
Das sollte man dann in einer Readme erklären. Die fehlt.
Und Ich dachte richtige Männer lesen nicht :cool:
I'm gonna add a README with the next upload :)

Ronny145
2011-08-09, 21:51:44
The lowest float sharpen = 0.001 value is still too strong for Arcania. So I better stay with PRE_SHARPEN and Sharpen_val0. The other sharpen parameters deactivated because they are useless.

BeetleatWar1977
2011-08-09, 21:53:34
The lowest float sharpen = 0.001 value is still too strong for Arcania. So I better stay with PRE_SHARPEN and Sharpen_val0. The other sharpen parameters deactivated because they are useless.
you could add more decimals if neccessary :D

Du kannst soviele Nachkommastellen machen wie du willst.

Ronny145
2011-08-09, 21:55:13
you could add more decimals if neccessary :D

Du kannst soviele Nachkommastellen machen wie du willst.

Ich habe 0.0001 probiert, keine Änderung. Soll ich 0.00001 probieren? :freak: /auch keine Änderung

Violator
2011-08-09, 22:17:20
Und Ich dachte richtige Männer lesen nicht :cool:
I'm gonna add a README with the next upload :)
Added a readme.txt
http://www65.zippyshare.com/v/76513892/file.html

I hope I included all contributors to the credits, if not claim your right! :wink:

Violator
2011-08-09, 22:32:02
Ich habe 0.0001 probiert, keine Änderung. Soll ich 0.00001 probieren? :freak: /auch keine Änderung
Currently downloading the demo, going to check it out and see whats wrong tomorrow.

BeetleatWar1977
2011-08-09, 23:03:42
Currently downloading the demo, going to check it out and see whats wrong tomorrow.
oh - by the way:

float4 BlurColor2 = 0.0f;
float4 BKThreshold = 0.0f;
float NRGSamples = 1.0f;
NRGSamples = NUM_SAMPLES2 /2;
float MaxSamples = (NUM_SAMPLES2+1)*(NUM_SAMPLES2+1);
float MaxDistance = sqrt(NRGSamples*NRGSamples*2*Samplescaler);
float MaxSamplingdistance = (NRGSamples * Samplescaler) + 0.001;
float CurDistance = MaxDistance;
float4 Blurtemp= 0;
float Samplecount = 0;
for(int Samplex = (- NRGSamples); Samplex < NRGSamples+1; Samplex = Samplex + 1)
{
for(int Sampley = (- NRGSamples); Sampley < NRGSamples+1; Sampley = Sampley + 1)
{
CurDistance = sqrt ( ((Samplex * Samplex) + (Sampley*Sampley))*Samplescaler);
if (CurDistance < MaxSamplingdistance)
{
Blurtemp.rgb = tex2D(s0, float2(Tex.x +(Samplex*px*Samplescaler),Tex.y +(Sampley*py*Samplescaler))) - MinBloom;
BlurColor2.rgb += Blurtemp.rgb;
Samplecount = Samplecount + 1;
}
}
}
if ( Samplecount > 0)
{
BlurColor2.rgb = (BlurColor2.rgb / Samplecount);
}

Part of the new Bloom code, should speed it up a little if im finished (and make it true circular)

pedace
2011-08-10, 04:34:40
my attempt to rearrange from Violator version :)

http://www.mediafire.com/?qvk385aim132kke

- add Sepia as new Shader (examples inside injShaders folder)
- brought back brightness, saturation and Blueshift
- turn off bloom from settings unti it properly works with better performance
- add Technicolor by DKT70 (don't know if is working as supposed to be but i get cool tone with that)
- rename shaders folders to injShaders and settings file to injSettings.h (easy to find/identify or delete without mistakes with game files)

:)

BeetleatWar1977
2011-08-10, 07:47:10
Cool, I played a bit with it, seems good and somewhat faster.
Maybe attaching a time logger to the processes could be something while developing, at least that gives us a clearer idea of how much faster/slower the process change is.



I´m thinking of using precalculated offsets, but that would be resolution depanded. If im using offsets for 1080p and someone uses 720p (for example) the amount of the bloom will change.

Couldnt test the whole shader in FXComposer - it always crashes - any idea?


Edit: The new Bloomcode should reduce the neccessary samples by ~20% - but makes the Pipeline a little bit longer.

Dicker Igel
2011-08-10, 09:07:09
Mal 'ne Frage: Rennt das auch unter OGL und muss es immer ins Verzeichis wo die exe'en liegen?

Violator
2011-08-10, 21:56:44
I´m thinking of using precalculated offsets, but that would be resolution depanded. If im using offsets for 1080p and someone uses 720p (for example) the amount of the bloom will change.

You shouldn't use a hardcoded offset, get the full image, get the center and edges, get the luminance differences, calculate the bloom and apply it.
Include the time that the filter uses into the calculation to make it precise.

Just an idea as example:

float Bloomamount = NewLum + (CurrentLum - NewLum) * ( 1 - pow( 0.98f, 30 * ElapsedTime ) );
NewSample.rgb *= g_fMiddleGray/(NewLum + 0.001f);
NewSample.rgb -= BrightnessThreshold;
NewSample = max(NewSample, 0.0f);
NewSample.rgb /= (BrightnessOffsett +NewSample);
return NewSample;

Does that make any sense?


Couldnt test the whole shader in FXComposer - it always crashes - any idea?

Sorry, I don't know anything about FXComposer, I'm used to Eclipse, Visual Studio and notepad.

my attempt to rearrange from Violator version :)

http://www.mediafire.com/?qvk385aim132kke

- add Sepia as new Shader (examples inside injShaders folder)
- brought back brightness, saturation and Blueshift
- turn off bloom from settings unti it properly works with better performance
- add Technicolor by DKT70 (don't know if is working as supposed to be but i get cool tone with that)
- rename shaders folders to injShaders and settings file to injSettings.h (easy to find/identify or delete without mistakes with game files)

:)
Nice contribution, was thinking about it on my way to work and saw to my surprise that you already did it.


I added the additional sharpening precision as selectable.
http://www41.zippyshare.com/v/44519565/file.html


If someone can point into something a bit more like OpenSVN with http://trac.edgewall.org/timeline ....


Welche versionen gibt es denn nun? Und wie unterscheiden sich diese?
The difference is that the filter got sorted into individual files into their own subfolder with a global setting files, and also allowing more choices to the user.
All the posted/uploaded functions are in the file linked above, although, that one is currently only for DirectX9.

BeetleatWar1977
2011-08-10, 22:06:11
You shouldn't use a hardcoded offset, get the full image, get the center and edges, get the luminance differences, calculate the bloom and apply it.
Include the time that the filter uses into the calculation to make it precise.

Just an idea as example:

float Bloomamount = NewLum + (CurrentLum - NewLum) * ( 1 - pow( 0.98f, 30 * ElapsedTime ) );
NewSample.rgb *= g_fMiddleGray/(NewLum + 0.001f);
NewSample.rgb -= BrightnessThreshold;
NewSample = max(NewSample, 0.0f);
NewSample.rgb /= (BrightnessOffsett +NewSample);
return NewSample;

Does that make any sense?



Im ersten Moment nichtmal ansatzweise ;)

Warum zum Geier die Zeit mit einberechnen?

Violator
2011-08-10, 22:26:31
Im ersten Moment nichtmal ansatzweise ;)

Warum zum Geier die Zeit mit einberechnen?
Because your "character" is moving while the bloom filter does it's rendering.
So you can extend the calculation, while you are using the luminance that the user is adapted to, you can adjust it slowly frame by frame according to the original luminance.
End result should be a smoother bloom experience.
But such is usually used in the game engine, was just an idea.

Btw. here is how Nvidia suggest glow effect calculations.
http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html

BeetleatWar1977
2011-08-10, 22:31:47
Because your "character" is moving while the bloom filter does it's rendering.
So you can extend the calculation, while you are using the luminance that the user is adapted to, you can adjust it slowly frame by frame according to the original luminance.
End result should be a smoother bloom experience.
But such is usually used in the game engine, was just an idea.

Btw. here is how Nvidia suggest glow effect calculations.
http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html
You mean adding an temporal softening to the bloom? i have tried this on a other game last year - the result has just looked like motionblur.

Or just an lumadaption?


Oh, damn edit.
You mean an Post_Glow effect? i will get a look on this tomorrow.

Violator
2011-08-10, 22:53:05
You mean adding an temporal softening to the bloom? i have tried this on a other game last year - the result has just looked like motionblur.

Or just an lumadaption?


Oh, damn edit.
You mean an Post_Glow effect? i will get a look on this tomorrow.
Isn't bloom a blurred glow effect?
When I use the Bloom effect, it kinda extends the lightning effects on the rendered scene, and makes the uplighted areas and objects look more realistic.

Gast
2011-08-10, 23:02:22
Isn't bloom a blurred glow effect?
When I use the Bloom effect, it kinda extends the lightning effects on the rendered scene, and makes the uplighted areas and objects look more realistic.
yeah, this Glow from nvidia suggests is the Bloom what we wanna

doesnt matter the name, bring it :)

BeetleatWar1977
2011-08-11, 07:30:01
Isn't bloom a blurred glow effect?
When I use the Bloom effect, it kinda extends the lightning effects on the rendered scene, and makes the uplighted areas and objects look more realistic.
yeah, this Glow from nvidia suggests is the Bloom what we wanna

doesnt matter the name, bring it :)

have taken a look into the glow.

That glow shader is basicly the same as bloom - with 2 differences:
1. It will be applied to the whole screen - there is no threshold
2. the sample weight can be modified for different curves of the blureffect

BeetleatWar1977
2011-08-11, 09:36:06
first glowtest
http://www.abload.de/thumb/screenshot101752c3rg.png (http://www.abload.de/image.php?img=screenshot101752c3rg.png) http://www.abload.de/thumb/screenshot101714i3pt.png (http://www.abload.de/image.php?img=screenshot101714i3pt.png)

spajdr
2011-08-11, 09:52:18
first glowtest
http://www.abload.de/thumb/screenshot101752c3rg.png (http://www.abload.de/image.php?img=screenshot101752c3rg.png) http://www.abload.de/thumb/screenshot101714i3pt.png (http://www.abload.de/image.php?img=screenshot101714i3pt.png)

502 Bad Gateway :tongue:

EDIT.: It works now

Gast
2011-08-11, 13:25:42
502 Bad Gateway :\

Gast
2011-08-11, 17:11:26
first glowtest
http://www.abload.de/thumb/screenshot101752c3rg.png (http://www.abload.de/image.php?img=screenshot101752c3rg.png) http://www.abload.de/thumb/screenshot101714i3pt.png (http://www.abload.de/image.php?img=screenshot101714i3pt.png)
seems better :)

what about the performance ?

another link about bloom

http://kalogirou.net/2006/05/20/how-to-do-good-bloom-for-hdr-rendering/

Violator
2011-08-11, 20:30:41
first glowtest
http://www.abload.de/thumb/screenshot101752c3rg.png (http://www.abload.de/image.php?img=screenshot101752c3rg.png) http://www.abload.de/thumb/screenshot101714i3pt.png (http://www.abload.de/image.php?img=screenshot101714i3pt.png)
Nice, and I see that's WoT :)

I got the bloom to work with some small changes to the code, added some limits on 2 user set values too.
I didn't add the faster method yet, probably won't do that tonight either since it's time for some gaming.
http://www36.zippyshare.com/v/77452090/file.html

The Guest
2011-08-11, 21:11:22
Nice, and I see that's WoT :)

I got the bloom to work with some small changes to the code, added some limits on 2 user set values too.
I didn't add the faster method yet, probably won't do that tonight either since it's time for some gaming.
http://www36.zippyshare.com/v/77452090/file.html
Cool violator

but why this glowing blur dont affect the dark/black areas ?

http://myhdtvchoice.com/wp-content/uploads/2008/10/hdtv-blooming.jpg

Violator
2011-08-11, 21:44:26
Cool violator

but why this glowing blur dont affect the dark/black areas ?

http://myhdtvchoice.com/wp-content/uploads/2008/10/hdtv-blooming.jpg
It can, but it either needs some more downsampling or extraction in the bloom power to prevent overbloom (which I did set a limit for).

Maybe something like this from the linked article..
5×5, 11×11, 21×21 and 41×41:
The 21×21 filter is approximated by applying the 5×5 kernel on the 32×32 texture.
The 11×11 filter by applying the 5×5 kernel on the 64×64 texture.
The 5×5 by applying the 5×5 kernel on the 128×128 texture.
This way we get the 4 blurred textures that we add to the screen.


float4 s1 = tex2D((5x5kernel on 32x32 texture), texture coordinates to this array[0].xy).rgb;
float4 s2 = tex2D((5x5kernel on 64x64 texture), texture coordinates to this array[0].xy).rgb;
float4 s3 = tex2D((5x5kernel on 128x128 texture), texture coordinates to this array[0].xy).rgb;
float4 s4 = tex2D((5x5kernel on 256x256 texture), texture coordinates to this array[0].xy).rgb;
float Bloom = (s1 + s2 + s3 + s4)*BloomWidth;
Final = Original + (Bloom*BloomPower)

Gast
2011-08-11, 21:49:02
[DKT70]

Violator, great stuff, will have a play around with it in a short while.

Guest
2011-08-11, 21:56:37
hmm this Bloom affect the image color so TonemapPass must come after that to Saturation control be more accurate ;)

Violator
2011-08-11, 22:46:07
hmm this Bloom affect the image color so TonemapPass must come after that to Saturation control be more accurate ;)
Yea, just noticed that while playing a bit.
As for RIFT, the FXAA is a lot better than the ingame SSAA!
Smoothens the edges way more and gives a much sharper image.
The Bloom works well but as you noticed it affects the image color when the tonemap is used, so screenshots are less accurate too.
I didn't use the tonemap together with it when I changed and tested it.
Thanks for pointing it out. :cool:

no one
2011-08-12, 01:22:46
effect.txt from ENB 0.075 can load this extra shaders ?

TF2
2011-08-12, 15:38:50
is possible disable FXAA but keep with the other effects ?

so if i turn on AA will not disable all shaders and we can use this dll as a game enhancer :)

Gast
2011-08-12, 15:52:24
is possible disable FXAA but keep with the other effects ?

so if i turn on AA will not disable all shaders and we can use this dll as a game enhancer :)
That is possible, will add option for it once I get home, might be dirty but should work :)

Gast
2011-08-12, 16:12:46
Is it possible to do some kind of a bumpmapping effect ?
Or generating normalmaps from textures ?

BeetleatWar1977
2011-08-12, 17:35:27
Maybe we should to the fxaa first and then the PP? I will try later.

Hübie
2011-08-12, 17:53:51
Ehm. FXAA is afaik kinda PP ;D But i think i know what u mean.
Whats the status about a tool? I would appreciate it if u guys work together instead of developing three differnt strings.
Does the shaders work in DNF, too?

Violator
2011-08-12, 18:50:41
is possible disable FXAA but keep with the other effects ?

so if i turn on AA will not disable all shaders and we can use this dll as a game enhancer :)
As promised, you can turn off the AA.
Not the most pretty way to implement it into the code, but it works.
http://www20.zippyshare.com/v/21070780/file.html

TF2
2011-08-12, 19:05:37
As promised, you can turn off the AA.
Not the most pretty way to implement it into the code, but it works.
http://www20.zippyshare.com/v/21070780/file.html
sorry, i think u dont understanding

if i turn on AA for a game, this dll is usefull, dont load/work.

so if we can change shader.fx sequence to not depend the fxaa for work, will be amazing.
This will be the best game enhancer ! Independent if we using AA or FXAA

but thanks anyway, an extra option always is welcome :)

BeetleatWar1977
2011-08-12, 20:38:43
As promised, you can turn off the AA.
Not the most pretty way to implement it into the code, but it works.
http://www20.zippyshare.com/v/21070780/file.html

Don´t make any updates - im on something.

Violator
2011-08-12, 20:42:42
Don´t make any updates - im on something.
Ok :)

BeetleatWar1977
2011-08-12, 21:28:42
Ok :)
OK, contains modifed Files for applying the PP-Effects after the FXAA

Changed the FXAA-File Parameter
#define FXAA_GREEN_AS_LUMA 1
so it calculates the luminance on the fly, instead of using the green channel.

give it a try ;)

Violator
2011-08-12, 23:28:44
OK, contains modifed Files for applying the PP-Effects after the FXAA

Changed the FXAA-File Parameter
#define FXAA_GREEN_AS_LUMA 1
so it calculates the luminance on the fly, instead of using the green channel.

give it a try ;)
Just figured how to get the other effects added back, just had to change one value.
Uploading in a few.

EDIT: Here it is.
To all contributers: Please sign up on assembla and request SVN developer access together with assembla username via a PM to me here on 3DCenter.

Changeset 4 View (http://www.assembla.com/code/fxaa-pp-inject/subversion/changesets/4)

Revision 4 Zip (http://www.assembla.com/spaces/fxaa-pp-inject/documents)

Hübie
2011-08-12, 23:46:49
Well i tried GTA 4 and here are my (uncrompressed!) results:

http://www.abload.de/img/screenshot67272y7hs.png (http://www.abload.de/image.php?img=screenshot67272y7hs.png)

http://www.abload.de/img/screenshot67462e760.png (http://www.abload.de/image.php?img=screenshot67462e760.png)

I lost almost 25% of Performance @3360x2100. So my conclusion is that this is to much for the marginal better optic. Only very hard edges are drawn smoother. I don´t know if there´s any potential of optimization but i think there won´t be too much. In 1680x1050 it´s a too small gain in optic.
I´ll try other games later and post my results.

greetings

edit: please keep in mind that my ingame result is in 1680x1050 ;)

Guest
2011-08-13, 00:42:48
whats changed (dor a dummie) with this last updates ? more performance ? better quality/color ?

:D

Violator
2011-08-13, 19:22:57
whats changed (dor a dummie) with this last updates ? more performance ? better quality/color ?

:D
Revision 7 should perform better.
Try it out and give feedback.

BeetleatWar1977
2011-08-13, 19:32:43
Revision 7 should perform better.
Try it out and give feedback.

there are some parameters missing in the injFX_Settings.h for the PRE_Sharpen:



#define moyenne 0.6
#define dx (moyenne*px)
#define dy (moyenne*py)
#define CoefOri (1+ CoefBlur)
#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)


Must first install an svn tool - @the moment i search for a client.

Violator
2011-08-13, 20:10:59
there are some parameters missing in the injFX_Settings.h for the PRE_Sharpen:



#define moyenne 0.6
#define dx (moyenne*px)
#define dy (moyenne*py)
#define CoefOri (1+ CoefBlur)
#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)

Must first install an svn tool - @the moment i search for a client.

I don't think that those are missing :)
They are included via shader.fx

injFX_Settings.h
/*------------------------------------------------------------------------------
PRE_SHARPEN
------------------------------------------------------------------------------*/
//For higher precision in the calculation of contour, requires slightly more processing power
bool highQualitySharpen = 0; //0 = Disable | 1 = Enable

// Set values to calculate the amount of AA produced blur to consider for the sharpening pass
#define Average 0.8
#define CoefBlur 2

// Set values of the sharpening amount
#define SharpenEdge 0.2
#define Sharpen_val0 1.2

Post.h
#define dx (Average*px)
#define dy (Average*py)
#define CoefOri (1+ CoefBlur)
#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)

Average = moyenne

Do you know Eclipse IDE?
I'm using CDT 8.0:
http://www.eclipse.org/cdt/
http://img710.imageshack.us/img710/182/capturevtl.jpg
Together with subclipse 1.6.18:
http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
To get rid of an error message you need a JavaHL, I used the one from slik:
http://www.sliksvn.com/en/download

You can probably use Slik only, I just like to have an IDE to connect with.

Gast
2011-08-13, 21:50:50
Is it possible to introduce a delay timer between pre and post injection!, To display cost of Post Processing in Milli Seconds.

This will make easy to check optimization or cost of PP speed.

-----

Also is it possible to hook this to another DLL to ingest true triple buffering, as using this PP hook disables D3Doverrider.

Violator
2011-08-14, 03:21:37
Revision 11 with a new faster bloom code up now (samples and width settings are locked at the moment, so can't be adjusted by the user).
https://www.assembla.com/spaces/fxaa-pp-inject/documents

Whyt
2011-08-14, 15:41:01
Revision 11 with a new faster bloom code up now (samples and width settings are locked at the moment, so can't be adjusted by the user).
https://www.assembla.com/spaces/fxaa-pp-inject/documents

got some color problems with the new BLOOM in ARMA2 ...
the last one worked in ARMA2 without problems . the new one is switching between RGB if i rotate ingame :eek:

http://www.abload.de/thumb/screenshot4244p6gu.png (http://www.abload.de/image.php?img=screenshot4244p6gu.png)

http://www.abload.de/thumb/screenshot3948a46u.png (http://www.abload.de/image.php?img=screenshot3948a46u.png)

http://www.abload.de/thumb/screenshot3860kvkw.png (http://www.abload.de/image.php?img=screenshot3860kvkw.png)

Violator
2011-08-14, 17:56:49
got some color problems with the new BLOOM in ARMA2 ...

Which version of DirectX is Arma 2 using?
NVM. Checked Wiki, seems its 9

BeetleatWar1977
2011-08-14, 18:00:33
make a updated tonemapper, but can´t upload.

here is the code:


float4 TonemapPass( float4 colorInput, float2 tex )
{
float4 color = colorInput;

color = max(0, color - Defog * FogColor);
color *= pow(2.0f, Exposure);
color = pow(color, Gamma);
float4 d = color * float4(1.05f, 0.97f, 1.27f, color.a);
color = lerp(color, d, BlueShift);
float3 lumCoeff = float3(0.299, 0.587, 0.114);
float lum = dot (lumCoeff, color.rgb);
float3 blend = lum.rrr;
float L = min(1, max (0, 10 * (lum - 0.45)));
float3 result1 = 2.0f * color.rgb * blend;
float3 result2 = 1.0f - 2.0f * (1.0f - blend) * (1.0f - color.rgb);
float3 newColor = lerp(result1, result2, L);
float A2 = Bleach * color.rgb;
float3 mixRGB = A2 * newColor;
color.rgb += ((1.0f - A2) * mixRGB);

float4 middlegray = float(color.r + color.g + color.b) /3;
float4 diffcolor = color - middlegray;
color = (color + diffcolor * Saturation)/(1+(diffcolor*Saturation));
return color;
}

with the new code the saturation doesnt affect the brightness anymore

Whyt
2011-08-14, 18:24:51
Which version of DirectX is Arma 2 using?
NVM. Checked Wiki, seems its 9

Yep, DX9 .... just got the latest SVN via client ....will test in a few :cool:

EDIT : BLOOM working again with latest SVN , but performance drop in ARMA2 about 10fps with BLOOM ON

Violator
2011-08-14, 20:07:02
Yep, DX9 .... just got the latest SVN via client ....will test in a few :cool:

EDIT : BLOOM working again with latest SVN , but performance drop in ARMA2 about 10fps with BLOOM ON
Checkout rev. 20 and tell if it is better in ARMA2.

Gast
2011-08-14, 21:21:15
rev. 20

the bloom doesn't work,

nothing change in my game

Violator
2011-08-14, 21:36:46
rev. 20

the bloom doesn't work,

nothing change in my game
Set BloomPreset to 0 if you are adjusting BloomThreshold, BloomWidth and BloomPower.

Whyt
2011-08-14, 21:52:06
Everything back to normal on ARMA2 ! FPS also back to normal with BLOOM on :biggrin:

Phaid
2011-08-14, 23:03:38
Is it possible to use the sharpening filter with the DX10/11 version of some dude's FXAA injector?

Gast
2011-08-15, 10:47:56
Set BloomPreset to 0 if you are adjusting BloomThreshold, BloomWidth and BloomPower.

oh.3Q~

it works~ ^^

Violator
2011-08-16, 00:30:05
Is it possible to use the sharpening filter with the DX10/11 version of some dude's FXAA injector?
Revision 25 should allow just that.
I tested it with Age of Conan in DirectX 10 mode, bloom isn't working and the limiter is somewhat funny (didn't have time to look more into that today, but this should help http://http.developer.nvidia.com/Cg/ps_5_0.html)
The other filters seem to do fine.

dhwang
2011-08-16, 18:47:04
some dude:

Request "Excluded Colors" shader to avoid blurred text.
Here is the algorithm:

1. store the location if colors equal ExcludedColors (Could have multiple colors)
2. FXAA
3. restore colors from Step 1

Violator
2011-08-16, 20:11:32
some dude:

Request "Excluded Colors" shader to avoid blurred text.
Here is the algorithm:

1. store the location if colors equal ExcludedColors (Could have multiple colors)
2. FXAA
3. restore colors from Step 1
So what you want is the opposite of the Sepia filter?
Like, instead of adding some yellow you want to be able to remove some yellow?

BeetleatWar1977
2011-08-16, 20:22:25
So what you want is the opposite of the Sepia filter?
Like, instead of adding some yellow you want to be able to remove some yellow?
I think he would exclude the hud from the effects - but i dont think this will work well.

Violator
2011-08-16, 21:09:12
I think he would exclude the hud from the effects - but i dont think this will work well.
Indeed, a hardcoded HUD can't be excluded by post processing.

It is possible to excluded parts of the screen but that wouldn't be good since we have to rely on vertical and horizontal lines, so a HUD that has round and other swirly shapes, plus often it's spread over the screen can't be 100% excluded.. unless the HUD is added via a LUA script or alike, then it could be possible to let the script return the needed coordinates (it does that to a game like WoW anyway).

Gast
2011-08-16, 21:42:51
how can make this shader like blur?

or street figher 4 "ink , cartoon style"

Original:
http://i.imgur.com/6evmN.jpg

Blur:
http://i.imgur.com/6evmN.jpg

street figher 4

http://www.youtube.com/watch?v=TuCkpfM2pNo

thank you~

Gast
2011-08-16, 21:45:35
how can make this shader like blur?

or street figher 4 "ink , cartoon style"

Original:
http://i.imgur.com/6evmN.jpg

Blur:
http://i.imgur.com/WEuH1.jpg

street figher 4

http://www.youtube.com/watch?v=TuCkpfM2pNo

thank you~

Gast
2011-08-16, 21:46:34
how can make this shader like blur?

or street figher 4 "ink , cartoon style"

Original:
http://i.imgur.com/6evmN.jpg

Blur:
http://i.imgur.com/WEuH1.jpg

street figher 4

http://www.youtube.com/watch?v=TuCkpfM2pNo

thank you~

Violator
2011-08-16, 21:49:15
how can make this shader like blur?

or street figher 4 "ink , cartoon style"

Original:
http://i.imgur.com/6evmN.jpg

Blur:
http://i.imgur.com/6evmN.jpg

street figher 4

http://www.youtube.com/watch?v=TuCkpfM2pNo

thank you~
float fxaaQualitySubpix = 0.60; // Default: 0.75 Raise to increase amount of blur
And then take decrease the sharpening.

Looks like it uses some bloom on top, so add some of that too.

Gast
2011-08-16, 21:58:01
decrease which sharpen?

postSharpen or PreSharpen

thank you~

Violator
2011-08-16, 22:07:09
decrease which sharpen?

postSharpen or PreSharpen

thank you~
I would try to start out with disabling postSharpen and then lower the amount of preSharpen or visa versa.
Try with one of them at a time and see which one that gives you the best effect.
You can then always finetune with both of them afterwards.

Gast
2011-08-16, 22:26:45
look like DOF

Original:
http://i.imgur.com/doX1c.jpg

blur:
http://i.imgur.com/4gsmE.jpg

Gast
2011-08-16, 22:29:20
for opengl

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0, in float2 uv1 : TEXCOORD1)
{
float4 c_center = texRECT(samp0, uv0.xy).rgba;

float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0);
uv0 += float2(0.3, 0.3);
float radius1 = 1.3;
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius1);

float radius2 = 4.6;
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius2);

bloom_sum *= 0.05;
bloom_sum -= float4(0.3, 0.3, 0.3, 0.3);
bloom_sum = max(bloom_sum, float4(0,0,0,0));

float2 vpos = (uv1 - float2(.5, .5)) * 2;
float dist = (dot(vpos, vpos));
dist = 1 - 0.0*dist;

ocol0 = (c_center * 0.7 + bloom_sum) * dist;
}

Gast
2011-08-16, 22:38:52
Thx alot for this great thing. I did some screenshot comparisons for Color Tones for who wants to see the differences. (i used Rift game)

1680x1050 PNG (137mb) > http://www.mediafire.com/?w2m2ltzdgcnvhu0

1000x625 TIFF (55mb) > http://www.mediafire.com/?iri9bdp573j03al

1000x625 JPG (12mb) > http://www.mediafire.com/?g98ym4f15877kbc


Again, thx alot for afford.



example screens 1680x1050 png

Burgundy > http://www.abload.de/image.php?img=burgundy2q6a.png

Citrine > http://www.abload.de/image.php?img=citrinexqud.png


thx.

Violator
2011-08-17, 00:51:39
New version up now with 9 (I think well balanced) Performance - Quality presets for the AA, should make it easier for users with PC's or games that can't drag max FXAA.
Also trimmed down some code a bit and changed some user settings to be in 1 to 9 ranges (those who want can still use decimals, I forgot to add that to the comments).
Have looked a bit into user interfaces, and will start coding something with sliders or tuning knobs to control the whole tool with, maybe this weekend if I have the time.
That will be in C++ of course :) C# is nice and easy, but lets make it fast and more versatile instead.

Violator
2011-08-17, 00:56:00
look like DOF

Original:
http://i.imgur.com/doX1c.jpg

blur:
http://i.imgur.com/4gsmE.jpg
Try to use a dark yellow of the brown shader from the Sephia filter and only mix a tiny bit on top, like setting it to 1.05 or alike.

Example:
#define Earthyellow
#define GreyPower 1
#define SepiaPower 1.05

You don't have much saturation on there either.

dhwang
2011-08-17, 05:38:20
So what you want is the opposite of the Sepia filter?
Like, instead of adding some yellow you want to be able to remove some yellow?

I am not familiar with Sepia filter. The #1 complain for FXAA is blurred and text is the most obvious one. Because most text
uses only a few fixed colors, supposed we can restore these colors after FXAA then the text will be as sharp as original.

Gast
2011-08-17, 09:07:55
how to use?

http://www.assembla.com/code/fxaa-pp-inject/subversion/nodes/shader_templates/pp1?rev=26

Violator
2011-08-17, 12:23:04
how to use?

http://www.assembla.com/code/fxaa-pp-inject/subversion/nodes/shader_templates/pp1?rev=26
If your not familiar with SVN I suggest that you use the zipped releases.
http://www.assembla.com/spaces/fxaa-pp-inject/documents

Violator
2011-08-17, 12:32:42
I am not familiar with Sepia filter. The #1 complain for FXAA is blurred and text is the most obvious one. Because most text
uses only a few fixed colors, supposed we can restore these colors after FXAA then the text will be as sharp as original.
Manipulating a color will affect the whole scene you are viewing on your screen, that is the cost of post processing.
So you need to moderate the balance between fxaa and sharpening to the result that you like the best.
For separation between layer of graphics fxaa would only be possible to be injected in between game layer and something like a lua layer, not the graphical rendered layers of the game itself.
Maybe something like texmod could do exactly what you want, but there you will have difference from game to game.

Violator
2011-08-17, 12:34:36
for opengl


Thanks, will play a bit around with that code. :smile:

Gast
2011-08-17, 12:46:45
Cartoon~

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
//Changethis to increase the number of colors.
float numColors =8;

float4 to_gray = float4(0.3,0.59,0.11,0);
float x1 = dot(to_gray, texRECT(samp0, uv0+float2(1,1)));
float x0 = dot(to_gray, texRECT(samp0, uv0+float2(-1,-1)));
float x3 = dot(to_gray, texRECT(samp0, uv0+float2(1,-1)));
float x2 = dot(to_gray, texRECT(samp0, uv0+float2(-1,1)));
float edge = (x1 - x0) * (x1 - x0);
float edge2 = (x3 - x2) * (x3 - x2);
edge += edge2;
float4 color = texRECT(samp0, uv0).rgba;

float4 c0 = max(color - float4(edge, edge, edge, edge) * 12, float4(0,0,0,0));

//Change this number to increase the pixel size.
int pixelSize = 1;


float red = 0.0;
float green = 0.0;
float blue = 0.0;
bool rr = false;
bool bb = false;
bool gg = false;
int val = uv0[0];
int val2 = uv0[1];
int count = 1;

double colorN = 0.0;
double colorB = 0.0;
val = val % pixelSize;
val2 = val2 % pixelSize;

//if(val == 0 && val2 == 0 )
// c0 = texRECT(samp0, uv0).rgba;
//else
// c0 = texRECT(samp0, uv0-float2(val, val2)).rgba;

for(count = 1; count <= numColors ; count++){
colorN = count / numColors;

if ( c0.r <= colorN && c0.r >= colorB && rr == false ){
if (count == 1){
if(colorN >= 0.1)
red = 0.01;
else
red = colorN;
}
else if (count == numColors)
red = 0.95;
else
red = colorN ;

rr = true;
}

if (c0.b <= colorN && c0.b >= colorB && bb == false){
if (count == 1){
if(colorN >= 0.1)
blue = 0.01;
else
blue = colorN;
}
else if (count == numColors)
blue = 0.95;
else
blue = colorN ;

bb = true;
}

if (c0.g <= colorN && c0.g >= colorB && gg == false){
if (count == 1){
if(colorN >= 0.1)
green = 0.01;
else
green = colorN;
}
else if (count == numColors)
green = 0.95 ;
else
green = colorN ;
gg = true;
}

colorB = count / numColors;
if(rr == true && bb == true && gg == true)
break;
}



ocol0 = float4(red, green, blue, c0.a);
}

Gast
2011-08-17, 12:49:35
Cartoon Effect

http://i.imgur.com/pxevV.png

Gast
2011-08-17, 12:53:15
stereoscopic

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba; // Source Color
float sep = 5;
float red = c0.r;
float green = c0.g;
float blue = c0.b;


// Red Eye (Red)
float4 c1 = texRECT(samp0, uv0 + float2(sep,0)).rgba;
red = max(c0.r, c1.r);

// Right Eye (Cyan)
float4 c2 = texRECT(samp0, uv0 + float2(-sep,0)).rgba;
float cyan = (c2.g + c2.b) / 2;
green = max(c0.g, cyan);
blue = max(c0.b, cyan);


ocol0 = float4(red, green, blue, c0.a);
}

http://i.imgur.com/3aEMT.jpg

Gast
2011-08-17, 13:01:06
HDR,i like this effect too much~

last day i say i want this effect for direct X,not blur~

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0, in float2 uv1 : TEXCOORD1)
{
float4 c_center = texRECT(samp0, uv0.xy).rgba;

float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0);
uv0 += float2(0.3, 0.3);
float radius1 = 1.65;
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius1);
bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius1);

float radius2 = 1.5;
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius2);
bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius2);

bloom_sum *= 0.027;
bloom_sum -= float4(0.1, 0.1, 0.1, 0.1);
bloom_sum = max(bloom_sum, float4(0,0,0,0));

float2 vpos = (uv1 - float2(.5, .5)) * 2;
float dist = (dot(vpos, vpos));
dist = 1 - 0.1*dist;

ocol0 = (c_center * 0.7 + bloom_sum) * dist;
}

http://i.imgur.com/sWSJ3.jpg

Gast
2011-08-17, 13:09:52
colourful

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba;
float red = 0.0;
float green = 0.0;
float blue = 0.0;

if (c0.r > 0.25)
{
red = c0.r;
}

if (c0.g > 0.25)
{
green = c0.g;
}

if (c0.b > 0.25)
{
blue = c0.b;
}

ocol0 = float4(red, green, blue, 1.0);
}

Gast
2011-08-17, 13:33:40
wow, nice effects :)

thanks


please Violator, add this

_/VeRtigo
2011-08-17, 14:02:09
yes, and pls someone do the opengl version, the code is already on page 8

Gast
2011-08-17, 14:26:34
Using PP, can we do Depth_of_Field to emulate 3D Vision on 2D display!.

On scenes where 3D Vision works, do fake effect with Depth_of_Field to make it similar!.

Violator
2011-08-17, 22:51:33
Thanks for all the filter contributions :)
Which name may I add for the credits?

Just got anaglyphic 3D added to DirectX9 (good that a friend of mine had a pair of red/cyan glasses I could borrow for testing it) :)

Gast
2011-08-17, 23:46:53
may be use your name ,

i never mind about this,

but please convert the hdr code for

direct x,thank you^^

Gast
2011-08-18, 00:07:11
grayscale

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba;
float avg = (c0.r + c0.g + c0.b) / 3.0;
ocol0 = float4(avg, avg, avg, c0.a);
}

http://i.imgur.com/22X9N.jpg

painting

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba;
float4 c1 = texRECT(samp0, uv0 - float2(1, 0)).rgba;
float4 c2 = texRECT(samp0, uv0 - float2(0, 1)).rgba;
float4 c3 = texRECT(samp0, uv0 + float2(1, 0)).rgba;
float4 c4 = texRECT(samp0, uv0 + float2(0, 1)).rgba;

float red = c0.r;
float blue = c0.b;
float green = c0.g;

float red2 = (c1.r + c2.r + c3.r + c4.r) / 4;
float blue2 = (c1.b + c2.b + c3.b + c4.b) / 4;
float green2 = (c1.g + c2.g + c3.g + c4.g) / 4;

if(red2 > 0.3)
red = c0.r + c0.r / 2 ;
else
red = c0.r - c0.r / 2 ;

if(green2 > 0.3)
green = c0.g+ c0.g / 2;
else
green = c0.g - c0.g / 2;


if(blue2 > 0.3)
blue = c0.b+ c0.b / 2 ;
else
blue = c0.b - c0.b / 2 ;

ocol0 = float4(red, green, blue, c0.a);
}

http://i.imgur.com/7Vt6p.jpg

Gast
2011-08-18, 00:13:17
black white and red

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 emboss = (texRECT(samp0, uv0+1).rgba - texRECT(samp0, uv0-1).rgba)*2.0f;
emboss -= (texRECT(samp0, uv0+float2(1,-1)).rgba - texRECT(samp0, uv0+float2(-1,1)).rgba);
float4 color = texRECT(samp0, uv0).rgba;
if (color.r > 0.8 && color.b + color.b < 0.2)
ocol0 = float4(1,0,0,0);
else {
color += emboss;
if (dot(color.rgb, float3(0.3, 0.5, 0.2)) > 0.5)
ocol0 = float4(1,1,1,1);
else
ocol0 = float4(0,0,0,0);
}
}

http://i.imgur.com/w1U1x.png

the other stereoscopic

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba; // Source Color
float sep = 5;
float red = c0.r;
float green = c0.g;
float blue = c0.b;


// Red Eye (Red)
float4 c1 = texRECT(samp0, uv0 + float2(sep,0)).rgba;
red = max(c0.r, c1.r);

// Right Eye (Cyan)
float4 c2 = texRECT(samp0, uv0 + float2(-sep,0)).rgba;
float cyan = (c2.g + c2.b) / 2;
green = max(c0.g, cyan);
blue = max(c0.b, cyan);


ocol0 = float4(red, green, blue, c0.a);
}

http://i.imgur.com/bnjk5.jpg

Gast
2011-08-18, 00:26:29
the other cartoon~

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 to_gray = float4(0.3,0.59,0.11,0);
float x1 = dot(to_gray, texRECT(samp0, uv0+float2(1,1)));
float x0 = dot(to_gray, texRECT(samp0, uv0+float2(-1,-1)));
float x3 = dot(to_gray, texRECT(samp0, uv0+float2(1,-1)));
float x2 = dot(to_gray, texRECT(samp0, uv0+float2(-1,1)));
float edge = (x1 - x0) * (x1 - x0);
float edge2 = (x3 - x2) * (x3 - x2);
edge += edge2;
float4 color = texRECT(samp0, uv0).rgba;

ocol0 = max(color - float4(edge, edge, edge, edge) * 12, float4(0,0,0,0));
}

http://i.imgur.com/XJP77.jpg

handwriting

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba;
float4 tmp = float4(0, 0, 0, 0);
tmp += c0 - texRECT(samp0, uv0 + float2(2, 2)).rgba;
tmp += c0 - texRECT(samp0, uv0 - float2(2, 2)).rgba;
tmp += c0 - texRECT(samp0, uv0 + float2(2, -2)).rgba;
tmp += c0 - texRECT(samp0, uv0 - float2(2, -2)).rgba;
float grey = ((0.222 * tmp.r) + (0.707 * tmp.g) + (0.071 * tmp.b));
// get rid of the bottom line, as it is incorrect.
if (uv0[1] < 163)
tmp = 1;
c0 = c0+1-grey*7;
ocol0 = float4(c0.r, c0.g, c0.b, 1);
}

http://i.imgur.com/BrTZ8.jpg

Gast
2011-08-18, 00:48:46
FXAA_PPI_Rev_28

Anaglyph Effect

ScreenShots
http://i.imgur.com/udYum.jpg

Gast
2011-08-18, 00:51:55
wrong photo,again~

http://i.imgur.com/1gWrv.jpg

Gast
2011-08-18, 01:41:37
here is my shader file~

https://skydrive.live.com/P.mvc#!/?cid=bf34371166ce9a1b&permissionsChanged=1&id=BF34371166CE9A1B%21143

thank you "Violator" again

Violator
2011-08-18, 03:17:47
FXAA_PPI_Rev_28

Anaglyph Effect

Updated in Rev. 30
Should be working much better with Anaglyph glasses :rolleyes:

DrFreaK666
2011-08-18, 06:28:39
I want a 8bit-Filter (256 Colours :))

BeetleatWar1977
2011-08-18, 07:49:01
I want a 8bit-Filter (256 Colours :))
should be no problem



Aber mit welcher Farbtabelle?

DrFreaK666
2011-08-18, 08:08:48
should be no problem



Aber mit welcher Farbtabelle?

Ohje, da fragst du mich aber was ^^
Wenn ich bloß wüsste was du genau meinst (irgendwie erinnerts mich gerade an einen Thread von aths...

btw: I like this thread, but it´s getting very confusing...

Violator
2011-08-18, 10:25:02
Ohje, da fragst du mich aber was ^^
Wenn ich bloß wüsste was du genau meinst (irgendwie erinnerts mich gerade an einen Thread von aths...

btw: I like this thread, but it´s getting very confusing...
Guk mal hier:
http://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes

Gast
2011-08-18, 14:12:17
16 BIT ^^"

http://i.imgur.com/R8TN3.jpg

Violator
2011-08-18, 14:56:07
16 BIT ^^"

http://i.imgur.com/R8TN3.jpg
Yuk, not gonna add that lol

Gast
2011-08-18, 17:47:02
16 bit , not for direct x..............

uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba;

//Change this number to increase the pixel size.
int pixelSize = 3;

float red = 0.0;
float green = 0.0;
float blue = 0.0;
int val = uv0[0];
int val2 = uv0[1];

val = val % pixelSize;
val2 = val2 % pixelSize;

if(val == 0 && val2 == 0 ){
if (c0.r < 0.1 && c0.r >= 0)
red = 0.1;
if (c0.r < 0.20 && c0.r >= 0.1)
red = 0.20;
if (c0.r <0.40 && c0.r >= 0.20)
red = 0.40;
if (c0.r <0.60 && c0.r >= 0.40)
red = 0.60;
if (c0.r <0.80 && c0.r >= 0.60)
red = 0.80;
if (c0.r >= 0.80)
red = 1;

if (c0.b < 0.1 && c0.b >= 0)
blue = 0.1;
if (c0.b < 0.20 && c0.b >= 0.1)
blue = 0.20;
if (c0.b <0.40 && c0.b >= 0.20)
blue = 0.40;
if (c0.b <0.60 && c0.b >= 0.40)
blue = 0.60;
if (c0.b <0.80 && c0.b >= 0.60)
blue = 0.80;
if (c0.b >= 0.80)
blue = 1;


if (c0.g < 0.1 && c0.g >= 0)
green = 0.1;
if (c0.g < 0.20 && c0.g >= 0.1)
green = 0.20;
if (c0.g <0.40 && c0.g >= 0.20)
green = 0.40;
if (c0.g <0.60 && c0.g >= 0.40)
green = 0.60;
if (c0.g <0.80 && c0.g >= 0.60)
green = 0.80;
if (c0.g >= 0.80)
green = 1;

}
else{
float4 c1 = texRECT(samp0, uv0-float2(val, val2)).rgba;

if (c1.r < 0.1 && c1.r >= 0)
red = 0.1;
if (c1.r < 0.20 && c1.r >= 0.1)
red = 0.20;
if (c1.r <0.40 && c1.r >= 0.20)
red = 0.40;
if (c1.r <0.60 && c1.r >= 0.40)
red = 0.60;
if (c1.r <0.80 && c1.r >= 0.60)
red = 0.80;
if (c1.r >= 0.80)
red = 1;

if (c1.b < 0.1 && c1.b >= 0)
blue = 0.1;
if (c1.b < 0.20 && c1.b >= 0.1)
blue = 0.20;
if (c1.b <0.40 && c1.b >= 0.20)
blue = 0.40;
if (c1.b <0.60 && c1.b >= 0.40)
blue = 0.60;
if (c1.b <0.80 && c1.b >= 0.60)
blue = 0.80;
if (c1.b >= 0.80)
blue = 1;


if (c1.g < 0.1 && c1.g >= 0)
green = 0.1;
if (c1.g < 0.20 && c1.g >= 0.1)
green = 0.20;
if (c1.g <0.40 && c1.g >= 0.20)
green = 0.40;
if (c1.g <0.60 && c1.g >= 0.40)
green = 0.60;
if (c1.g <0.80 && c1.g >= 0.60)
green = 0.80;
if (c1.g >= 0.80)
green = 1;

}



ocol0 = float4(red, green, blue, c0.a);
}

BeetleatWar1977
2011-08-18, 19:53:09
first approach:

/*------------------------------------------------------------------------------
bitter
------------------------------------------------------------------------------*/
int bit = 4;
float4 bitter ( float4 ColorInput2 )
{
float3 bitter= round (ColorInput2.rgb * exp(bit))/exp(bit);

ColorInput2.rgb = bitter;

return ColorInput2;
}



reduce the channels to the bitdepth defined per channel (linear colorspace)

second one:

/*------------------------------------------------------------------------------
bitter
------------------------------------------------------------------------------*/
int bit = 8;
float4 bitter ( float4 ColorInput2 )
{

float colorcount = bit / 3;
float3 bitter= round (ColorInput2.rgb * exp(colorcount))/exp(colorcount);

ColorInput2.rgb = bitter;

return ColorInput2;
}


reduce all channel to the bits defined for all Channels


fast and easy ;)

Ich könnte auch bspws die Farbtabelle vom C64 nutzen, aber da bräuchte ich die RGB-Werte für die Farben.

DrFreaK666
2011-08-18, 19:56:33
Ich vergaß zu erwähnen dass ich 8bit mit pointsampling möchte.
Geht das?

BeetleatWar1977
2011-08-18, 19:59:43
Ich vergaß zu erwähnen dass ich 8bit mit pointsampling möchte.
Geht das?
Was meinst du jetzt mit Pointsampling - PixelperPixel ohne Farbverläufe?

Testpics:

http://www.abload.de/thumb/shot_034pd2d.jpg (http://www.abload.de/image.php?img=shot_034pd2d.jpg) http://www.abload.de/thumb/shot_036vfit.jpg (http://www.abload.de/image.php?img=shot_036vfit.jpg)

DrFreaK666
2011-08-18, 20:06:04
Was meinst du jetzt mit Pointsampling - PixelperPixel ohne Farbverläufe?

Testpics:

http://www.abload.de/thumb/shot_034pd2d.jpg (http://www.abload.de/image.php?img=shot_034pd2d.jpg) http://www.abload.de/thumb/shot_036vfit.jpg (http://www.abload.de/image.php?img=shot_036vfit.jpg)

Jab. So wie damals :D

BeetleatWar1977
2011-08-18, 20:13:17
Jab. So wie damals :D


Sag doch gleich das du einen Retroshader willst^^

Dann müssen wir uns aber wie gesagt auf eine bestimmte Farbpalette einigen, ich bau keine 30 verschiedene Versionen



http://www.abload.de/thumb/shot_037heoi.jpg (http://www.abload.de/image.php?img=shot_037heoi.jpg)




Edit: 16Color VGA-Standard

http://www.abload.de/thumb/screenshot12536jtp.png (http://www.abload.de/image.php?img=screenshot12536jtp.png)

Violator
2011-08-18, 22:02:05
@BeetleatWar1977
VIC-2 :D
http://unusedino.de/ec64/technical/misc/vic656x/colors/

C64
http://www.godot64.de/german/epalet.htm

Since this doesn't enhance I think one of them should be enough, maybe with some tuning option for each color channel.

I think the VIC-2 version of his is pretty close:
http://unusedino.de/ec64/technical/misc/vic656x/colors/dk-pepto.gif
http://unusedino.de/ec64/technical/misc/vic656x/colors/jo-pepto.gif

Odal
2011-08-19, 10:16:50
kann mal jemand einem shadernoob erklären was ich genau machen muss wenn ich einen spezifischen shader aus dem injFX_Shaders nutzen möchte? (z.b. den comic.h) und was ich genau machen muss wenn ich einen von den hier geposteten nutzen möchte

DrFreaK666
2011-08-21, 02:10:09
Sag doch gleich das du einen Retroshader willst^^

Dann müssen wir uns aber wie gesagt auf eine bestimmte Farbpalette einigen, ich bau keine 30 verschiedene Versionen



http://www.abload.de/thumb/shot_037heoi.jpg (http://www.abload.de/image.php?img=shot_037heoi.jpg)




Edit: 16Color VGA-Standard

http://www.abload.de/thumb/screenshot12536jtp.png (http://www.abload.de/image.php?img=screenshot12536jtp.png)

Hm, vielleicht ist so ein Shader doch nicht so optimal geeignet.
Vielleicht in Kombination mit einer niedrigen Auflösung.
Theretisch müsste es doch möglich sein 1680x1050 in 840x525 herunterzurechnen es aber wieder als 1680x1050 anzeigen zu lassen, oder?
Wahrscheinlich wäre das HUD unbrauchbar, aber in kombination mit einer 16-bit-Farbtiefe (256 Farben sind vielleicht doch zu wenig) und Point-Sampling müsste es Retro genug sein :)

Lohnt es sich irgendwie hq4x hinzu zu fügen, oder lohnt sich das nur bei extrem niedrig Aufgelöstem?
http://www.hiend3d.com/hq4x.html

here is my shader file~

https://skydrive.live.com/P.mvc#!/?cid=bf34371166ce9a1b&permissionsChanged=1&id=BF34371166CE9A1B%21143

thank you "Violator" again

How can I add the pp-filters to the current version (FXAA_PPI_Rev_37)?

edit: Prototype doesn´t work with it :-( It works now, but it has no effect

BeetleatWar1977
2011-08-21, 07:52:38
Hm, vielleicht ist so ein Shader doch nicht so optimal geeignet.
Vielleicht in Kombination mit einer niedrigen Auflösung.
Theretisch müsste es doch möglich sein 1680x1050 in 840x525 herunterzurechnen es aber wieder als 1680x1050 anzeigen zu lassen, oder?
Wahrscheinlich wäre das HUD unbrauchbar, aber in kombination mit einer 16-bit-Farbtiefe (256 Farben sind vielleicht doch zu wenig) und Point-Sampling müsste es Retro genug sein :)

Lohnt es sich irgendwie hq4x hinzu zu fügen, oder lohnt sich das nur bei extrem niedrig Aufgelöstem?
http://www.hiend3d.com/hq4x.html


bei kleiner Schrift lässt sich gar nichts mehr lesen - ich könnte aber auch den Rahmen vom Original C64 hinzufügen ;)

DrFreaK666
2011-08-21, 09:34:57
bei kleiner Schrift lässt sich gar nichts mehr lesen - ich könnte aber auch den Rahmen vom Original C64 hinzufügen ;)

ein Versuch wäre es wert wie diese Screenshots zeigen

Prototype (original (1680x1050))
http://www.abload.de/thumb/13p8c.jpg (http://www.abload.de/image.php?img=13p8c.jpg)

Prototype (1680 -> 1120 -> 1680)
http://www.abload.de/thumb/38rj4.jpg (http://www.abload.de/image.php?img=38rj4.jpg)

Prototype (1680 -> 840 -> 1680)
http://www.abload.de/thumb/2brds.jpg (http://www.abload.de/image.php?img=2brds.jpg)

Gast
2011-08-24, 15:47:35
long times no update~

can anyone add this effect?

http://www.hiend3d.com/hq4x.html

thank you~

Gast
2011-08-29, 02:34:43
Hello all.. sorry for english..
to me Deus Ex HR looks really bad with its yellow/green colors.. so i tried latest fxaa and other shaders tool(http://www.assembla.com/spaces/fxaa-pp-inject/documents).. my settings listed at below and wtih these settings i get red/pink/purple tone.. i need your help to change yellow/greenish to more blueish tone.. any help would be appreciated

screenshots
http://www.abload.de/gallery.php?key=fT31aYHG

/*=============================================================================== =======
"USER" ADJUSTABLE SETTINGS
================================================================================ ======*/

// TODO: Normalize values to be on a human range scale, whole numbers prefered, decimals usable for micro adjustments
// These values should have min/max limit checks included in their functions, so that the end user doesn't get crazy results

/*------------------------------------------------------------------------------
FILTER SELECTION
------------------------------------------------------------------------------*/
// Comment to deactivate an effect.
// Example: To disable the tonemap effect, use // in front of #define USE_TONEMAP
#define USE_ANTI_ALIASING
#define USE_TECHNICOLOR
#define USE_TONEMAP
#define USE_SEPIA
#define USE_VIGNETTE


/*------------------------------------------------------------------------------
FXAA SHADER
------------------------------------------------------------------------------*/
// Set values to calculate the amount of Anti Aliasing applied
float fxaaQualitySubpix = 0.65; // Default: 0.75 Raise to increase amount of blur
float fxaaQualityEdgeThreshold = 0.133; // Lower the value for more smoothing
float fxaaQualityEdgeThresholdMin = 0.0633; // Lower the value for more smoothing



/*------------------------------------------------------------------------------
TECHNICOLOR
------------------------------------------------------------------------------*/
#define TechniAmount 0.20 // 1.00 = Max
#define TechniPower 4.0 // lower values = whitening

// lower values = stronger channel
#define redNegativeAmount 1.00 // 1.00 = Max
#define greenNegativeAmount 1.0 // 1.00 = Max
#define blueNegativeAmount 1.0 // 1.00 = Max


/*------------------------------------------------------------------------------
TONEMAP
------------------------------------------------------------------------------*/
#define Gamma 1.10
#define Exposure 0.00
#define Saturation 0.05 // use negative values for less saturation.
#define BlueShift 3.00 // Higher = more blue in image.
#define Bleach 0.05 // Bleach bypass, higher = stronger effect
#define Defog 0.055 // Strength of Lens Colors.
#define FogColor float4(0.08, 0.28, 0.10, 3.0) //Lens-style color filters for Blue, Red, Yellow, White.


/*------------------------------------------------------------------------------
SEPIA
------------------------------------------------------------------------------*/
#define Earthyellow // Color Tone, available tones can be seen in ColorTones.PNG (Do not use spaces in the name!)
#define GreyPower 3 //(Valid Values = 1 to 9, use decimals for finetuning), defines how much of the grey color you wish to blend in
#define SepiaPower 1.2 //(Valid Values = 1 to 9, use decimals for finetuning), defines how much of the color tone you wish to blend in


/*------------------------------------------------------------------------------
VIGNETTE
------------------------------------------------------------------------------*/
// Vignette effect, process by which there is loss in clarity towards the corners and sides of the image, like a picture frame
#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
#define VignetteRadius 1.00 // lower values = stronger radial effect from center
#define VignetteAmount -0.60 // Strength of black. -2.00 = Max Black, 1.00 = Max White.

Swartz
2011-09-08, 21:02:04
I apologize for the english as well ;)

I made a quick "Emboss" shader:


sampler2D g_samSrcColor;
float4 HDRPass( float4 colorInput, float2 tex)
{
float4 Color;
//float2 uv;
Color.a = 1.0f;
Color.rgb = 0.75f;
Color -= tex2D( g_samSrcColor, tex.xy-0.001)*2.0f;
Color += tex2D( g_samSrcColor, tex.xy+0.001)*2.0f;
Color.rgb = (Color.r+Color.g+Color.b)/3.0f;

return Color;
//0.001
}


Note that it only works if the Post-Sharpening filter is also enabled, otherwise you'll just get a grey screen.

Also, if the developers of this injection mod would contact me at jketiynu@yahoo.com I'd really appreciate it. I just have one small question regarding the proper code to use in my own injector to read shader from a file and then display it.

AUTh0rity
2011-12-20, 07:40:42
Hi!

I am using the FXAA Injector in Battlefield 3 to get rid of the post nuclear catastrophic movie look (everything is bleached and looks grey).

http://imgur.com/a/HmDtg#0

http://forums.electronicarts.co.uk/battlefield-3-pc/1454675-better-sharper-custom-fxaa-injector.html

Now what I am looking for would be a shader to adjust the contrast.
Is that somehow possible?

watugonad00?
2011-12-20, 20:33:52
-falscher thread-

jelbo
2012-01-05, 15:53:31
Great to see al the customization options! Being able to blur about any DX9 game is like a dream come true. Another thing that's on my mind for ages is being able to add scanlines to any game. The MAME developers made some extremely nice filters that could maybe be ported.

BeetleatWar1977
2012-05-23, 07:55:49
so ein kleines Update:

Im File liegen aktualisierte Filter für Post und Presharpen - es ist jetzt ein Begrenzer eingebaut der diese "Überschwingeffekte" bei hohen Schärfegraden mildert

BeetleatWar1977
2012-07-15, 07:39:25
Here it comes:
The sharpen Filter i used (and written myself) for the Duke - ported for the injector

- Variant for PostSharpen DX9 - i think it should work with the DX10/11 Version aswell.

The shader uses a circular and rotated sampledistribution - and is adaptive, you could push the setting even up to 1 - without getting to much artifacts

DrFreaK666
2012-07-15, 16:49:33
Here it comes:
The sharpen Filter i used (and written myself) for the Duke - ported for the injector

- Variant for PostSharpen DX9 - i think it should work with the DX10/11 Version aswell.

The shader uses a circular and rotated sampledistribution - and is adaptive, you could push the setting even up to 1 - without getting to much artifacts

Wenn AO beim Duke PP-Effekte sind, wieso geht dies dann nicht mit diesem Injector?

BeetleatWar1977
2012-07-15, 17:32:23
Wenn AO beim Duke PP-Effekte sind, wieso geht dies dann nicht mit diesem Injector?
Da brauchst du den Z-Buffer dazu.... genau wie für DoF

Ri*g*g*er
2012-07-29, 16:58:48
Here it comes:
The sharpen Filter i used (and written myself) for the Duke - ported for the injector

- Variant for PostSharpen DX9 - i think it should work with the DX10/11 Version aswell.

The shader uses a circular and rotated sampledistribution - and is adaptive, you could push the setting even up to 1 - without getting to much artifacts

Kann man Deine beiden aktualisierten Sharpenfilter jetzt einfach gegen die im Komplettordner austauschen und trotzdem noch ganz nochmal an den Einstellungen basteln sprich sich entsprechende Werte einstellen ?
Oder wie muss ich mir das jetzt vorstellen ?

Durch viel Ausprobieren und verschiedene Einstellungen ist mir klar, das es mit zu viel Schärfe zu einer Artefaktebildung kommt die sich als Grafikfehler Linien etc. bemerkbar macht.
Mein Spiel ist dabei Battlefield 3 dies lässt sich aber durch die Milderung der Schärfewerte abschwächen.

Bisher habe ich leider im Netz keine genau Anleitung, Erklärung etc. gefunden die einem etwas mehr Input über die genauen Einstellungen gibt z.b.

/*------------------------------------------------------------------------------
PRE_SHARPEN
------------------------------------------------------------------------------*/
//For higher precision in the calculation of contour, requires slightly more processing power
bool highQualitySharpen = 1; //0 = Disable | 1 = Enable

// Set values to calculate the amount of AA produced blur to consider for the sharpening pass
#define Average 0.6 Was bewirken genau diese Einstellungen ?
#define CoefBlur 2 Was bewirken genau diese Einstellungen ?

// Set values of the sharpening amount
#define SharpenEdge 0.25 Was bewirken genau diese Einstellungen ?
#define Sharpen_val0 1.2 Was bewirken genau diese Einstellungen ?

Klar geht es da um den Schärfegrad aber was in welche Richtung (+/-) bringt nun mehr oder weniger was ?

Gibt es dafür irgendwo im Netz eine Art Dokumentation o.ä. ?

Gruss
Ri*g*g*er

BeetleatWar1977
2012-07-29, 17:30:41
Kann man Deine beiden aktualisierten Sharpenfilter jetzt einfach gegen die im Komplettordner austauschen und trotzdem noch ganz nochmal an den Einstellungen basteln sprich sich entsprechende Werte einstellen ?
Oder wie muss ich mir das jetzt vorstellen ?

Durch viel Ausprobieren und verschiedene Einstellungen ist mir klar, das es mit zu viel Schärfe zu einer Artefaktebildung kommt die sich als Grafikfehler Linien etc. bemerkbar macht.
Mein Spiel ist dabei Battlefield 3 dies lässt sich aber durch die Milderung der Schärfewerte abschwächen.

Bisher habe ich leider im Netz keine genau Anleitung, Erklärung etc. gefunden die einem etwas mehr Input über die genauen Einstellungen gibt z.b.

/*------------------------------------------------------------------------------
PRE_SHARPEN
------------------------------------------------------------------------------*/
//For higher precision in the calculation of contour, requires slightly more processing power
bool highQualitySharpen = 1; //0 = Disable | 1 = Enable

// Set values to calculate the amount of AA produced blur to consider for the sharpening pass
#define Average 0.6 Was bewirken genau diese Einstellungen ?
#define CoefBlur 2 Was bewirken genau diese Einstellungen ?

// Set values of the sharpening amount
#define SharpenEdge 0.25 Was bewirken genau diese Einstellungen ?
#define Sharpen_val0 1.2 Was bewirken genau diese Einstellungen ?

Klar geht es da um den Schärfegrad aber was in welche Richtung (+/-) bringt nun mehr oder weniger was ?

Gibt es dafür irgendwo im Netz eine Art Dokumentation o.ä. ?

Gruss
Ri*g*g*er

/*------------------------------------------------------------------------------
PRE_SHARPEN
------------------------------------------------------------------------------*/
//For higher precision in the calculation of contour, requires slightly more processing power
bool highQualitySharpen = 1; //0 = Disable | 1 = Enable 0 = 1Pass, 1= 2Pass

// Set values to calculate the amount of AA produced blur to consider for the sharpening pass
#define Average 1.20 Sampleweite für den 2ten Pass (highQualitySharpen auf 1)
#define CoefBlur 1.5 Stärke der Schärfung

// Set values of the sharpening amount
#define SharpenEdge 0.20 Schwellwert der Kantendetektion
#define Sharpen_val0 1.2 Stärke des Originalbildes


/*------------------------------------------------------------------------------
POST_SHARPEN
------------------------------------------------------------------------------*/
// Controls additional sharpening applied after previous processing. Strength should be max 0.25! das max hat sich mit der Variante vom Duke erledigt^^
float Sharpen = 0.50;

Gib dem Postfiler von hier http://www.forum-3dcenter.org/vbulletin/showpost.php?p=9386210&postcount=199 mal eine Chance ;) - da sollte das Problem mit Linien (und z.B. HUD) nicht auftreten ;)

Edit: Und ja - die Files einfach austauschen

DrFreaK666
2012-07-31, 22:30:04
Der injector will mit einem Game nicht. Pech gehabt??

BeetleatWar1977
2012-07-31, 22:34:50
Der injector will mit einem Game nicht. Pech gehabt??
Nicht unbedingt - welches Spiel?

DrFreaK666
2012-07-31, 22:37:15
Nicht unbedingt - welches Spiel?

Prototype 1. Kein Effekt

BeetleatWar1977
2012-07-31, 22:45:53
Prototype 1. Kein Effekt
was sagt das logfile? wenns nichts sagt, liegen die Files wohl im falschen ordner

DrFreaK666
2012-07-31, 23:21:06
was sagt das logfile? wenns nichts sagt, liegen die Files wohl im falschen ordner

redirecting CreateDevice
redirecting device->Reset
redirecting device->Reset

BeetleatWar1977
2012-08-01, 06:09:40
redirecting CreateDevice
redirecting device->Reset
redirecting device->Reset
passt eigentlich - AA auf aus?

DrFreaK666
2012-08-01, 21:45:50
passt eigentlich - AA auf aus?

Mir gehts nicht um fxaa, sondern um die Effekte (Sharper usw)

BeetleatWar1977
2012-08-02, 07:33:21
Mir gehts nicht um fxaa, sondern um die Effekte (Sharper usw)
- der Injector läuft aber nur ohne AA^^

DrFreaK666
2012-08-03, 00:06:38
- der Injector läuft aber nur ohne AA^^

Wirklich?? Habe ich anders in Erinnerung...
Gleich mal Testen...

Wusste ich doch, dass es daran nicht liegt ;)
Dann liegt es wohl an der Engine

captainsangria
2012-08-21, 08:20:55
Temporär geschlossen