PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Alles rund um FXAA


Seiten : [1] 2 3 4 5

Ronny145
2010-04-01, 00:11:46
Hi, I'm some dude and just wanted to see how fxaa looks on my notebook. But oh noes, I have only two old games and both use d3d9.
So instead of complaining I wrote some code and play those games with fxaa
now. It's faster than with the aa provided by the games.

Proof:
http://www.abload.de/image.php?img=screenshot483wo22.png
http://www.abload.de/image.php?img=screenshot400yp6q.png

Beta9:
[some dude]
First of all, thanks Blaire for fiding the "Arcania" bug and linking to the demo. Took me some time to fix it (started the download after your first post). There is a slight chance that GTA4 is affected again (always those *overtuned* engines).
I also improved d3d10 stability a little (may fix game crashes). I hope to be able to inject FXAA into all games which do not show "pDevice->CreateDeferredContext failed" behaviour in the logfile.

Additionally for those games which require you to put shader files into different directories - now they don't crash but just refuse to start and write more information to the logfile (e.g. in Crysis I get "try to use "D:\Games\Crytek\Crysis SP Demo" for shader files" when I misplace the shader files).

For those of you who write own shaders, if you write incorrect shadercode the logfile should tell you exactly what is wrong.

Hotkeys are now PAUSE and PRINT SCREEN.

http://hotfile.com/dl/125975700/ef4f3b1/injectFxaa_by_some_dude_9.7z.html

Beta 10:
[some dude]
In beta 10 there are some changes in d3d9 mode to fix the mentioned game (maybe others as well). No changes in d3d10 mode.
http://hotfile.com/dl/126721760/6694e76/injectFxaa_by_some_dude_10.7z.html



[some dude]
@Ronny145: Here is how sharpen can be used in d3d10 mode:
Content of shader.hlsl:

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

#include "Fxaa3_11.h"

Texture2D gScreenTexture : register( t0 );
Texture2D gLumaTexture : register( t1 );
SamplerState screenSampler : register( s0 );

//Difinitions: BUFFER_WIDTH, BUFFER_HEIGHT, BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT

struct PS_INPUT
{
float2 vTexcoord : TEXCOORD0;
};
struct VS_Output
{
float4 Pos : SV_POSITION;
float2 Tex : TEXCOORD0;
};
struct VS_Input
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
};

VS_Output VSMain( VS_Input Input )
{
VS_Output Output;
Output.Pos = Input.Pos;
Output.Tex = Input.Tex;
return Output;
}

#include "Sharpen.h"

float4 LumaShader( VS_Output Input ) : SV_TARGET
{
#ifdef USE_ADDITIONAL_SHADER
float4 c0 = main(Input.Tex);
#else
float4 c0 = gScreenTexture.SampleLevel( screenSampler, Input.Tex, 0 );
#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( VS_Output Input ) : SV_TARGET
{
FxaaTex t = { screenSampler, gLumaTexture };
float4 c0 = FxaaPixelShader(
Input.Tex, //pos
0, //fxaaConsolePosPos (?)
t, //tex
t, //fxaaConsole360TexExpBiasNegOne
t, //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 c0;
}

Content of Sharpen.h:
#define USE_ADDITIONAL_SHADER 1
//myTex2D: use it instead of tex2D to sample the original screen
#define myTex2D(s, p) gScreenTexture.SampleLevel( s, p, 0 )
//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 main( float2 tex ) {

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

// calcul image floue (filtre gaussien)
float4 c1 = myTex2D(s0, tex + float2(-dx,-dy));
float4 c2 = myTex2D(s0, tex + float2(0,-dy));
float4 c3 = myTex2D(s0, tex + float2(dx,-dy));
float4 c4 = myTex2D(s0, tex + float2(-dx,0));
float4 c5 = myTex2D(s0, tex + float2(dx,0));
float4 c6 = myTex2D(s0, tex + float2(-dx,dy));
float4 c7 = myTex2D(s0, tex + float2(0,dy));
float4 c8 = myTex2D(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 = myTex2D(s0, tex + float2(-px,-py));
c2 = myTex2D(s0, tex + float2(0,-py));
c3 = myTex2D(s0, tex + float2(px,-py));
c4 = myTex2D(s0, tex + float2(-px,0));
c5 = myTex2D(s0, tex + float2(px,0));
c6 = myTex2D(s0, tex + float2(-px,py));
c7 = myTex2D(s0, tex + float2(0,py));
c8 = myTex2D(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;
}
}



Originalstartbeitrag von Maorga:
Wie kann man mit dem nVidia Inspector den FXAA Filter aktivieren?

DrFreaK666
2011-07-05, 21:20:32
Soweit ich weiss garnicht

mapel110
2011-07-05, 21:25:23
Wie kann man mit dem nVidia Inspector den FXAA Filter aktivieren.
Funktioniert afaik nur unter Opengl. Ist aber noch buggy.
http://www.abload.de/img/fxaae7yl.jpg

DrFreaK666
2011-07-05, 21:28:13
Funktioniert afaik nur unter Opengl. Ist aber noch buggy.
http://www.abload.de/img/fxaae7yl.jpg

OpenGL?? Also so gut wie garnicht ;)

TobiWahnKenobi
2011-07-06, 10:33:29
was zum geier ist FXAA?


(..)

mfg
tobi

dargo@work
2011-07-06, 11:01:33
was zum geier ist FXAA?

http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf

Maorga
2011-07-06, 12:17:38
FXAA ist das Gegenstück zum MLAA von Ati. Ein shaderbasierter Filter der Kanten erkennen soll und glätten soll. Angeblich soll FXAA bisserl besser sein als MLAA. Im nVidia Inspector gibt es zwar schon einträge, die scheinen sich aber nicht auszuwirken.
Wollte es mal für Hydrophobia austesten und vielleicht auch noch Shogun 2.

TobiWahnKenobi
2011-07-06, 12:18:57
FXAA vs. FSAA habe ich doch neulich erst in irgendeinem spiel gelesen.. *grübel* unterschiede in der auswirkung waren aber für mich nicht ersichtlich.. war es der duke?

@dargo
danke für das pdf


(..)

mfg
tobi

BeetleatWar1977
2011-07-06, 12:47:49
FXAA vs. FSAA habe ich doch neulich erst in irgendeinem spiel gelesen.. *grübel* unterschiede in der auswirkung waren aber für mich nicht ersichtlich.. war es der duke?

@dargo
danke für das pdf


(..)

mfg
tobi

Yup - war der Duke, gibt auch eine Variante für ENB

Iruwen
2011-07-06, 13:22:07
Jo, wird z.B. beim iCEnhancer genutzt:
http://www.youtube.com/watch?v=pEHtzSz8FT0&hd=1#t=3m35s

Ri*g*g*er
2011-07-06, 15:31:01
Hi all,

bei "Brink" ist ein OpenGL Titel funktioniert das schon ohne Probleme.
Das Shaderflimmern wird "sehr gemindert".

Gruss
Ri*g*g*er

Banshee18
2011-07-06, 18:00:24
Bei Fear 3 gibts auch FXAA. Imho ist es garnicht sooo schlecht. Hoffentlich macht NV da noch was.

DaBrain
2011-07-06, 18:30:58
FXAA wurde gerade in Freespace 2 eingebaut.

Ich hatte eigentlich nicht viel erwartet, aber es ist recht brauchbar.

Sichtbare Kanten werden geglättet. Shaderflimmern wird ein Stück weit bekämpft und das Bild wirkt recht "stimmig"/"konsistent" von der globalen Schärfe her. Es scheint auch recht günstig zu sein.
Ich kann jedenfalls keinen Unterschied in meiner Framerate feststellen.

Auf der anderen Seite verliert das Bild leicht an Schärfe. Scharfe Details werden auch gleich mit weggeglättet. :(
Nicht dramatisch, aber IMHO sichtbar.
Immer noch kein Vergleich zu dem grottigen Quincunx AA ;).

Raff
2011-07-06, 19:01:20
Bei Fear 3 gibts auch FXAA. Imho ist es garnicht sooo schlecht. Hoffentlich macht NV da noch was.

IMO ist FXAA eine Weiterentwicklung von etwas, das für die Katz ist – MSAA. Was bringen uns 16-32x Samples, wenn in Bewegung der gesamte Glättungseffekt den Bach runtergeht? Was vorher flimmerte, flimmert weiter; was vorher eine nicht durchgezogene Linie war, ist immer noch ein Flickenteppich; Alphatests sehen im Stand toll aus, seuchen bei der kleinsten Bewegung aber, als sei niemand drübergeFXAAt. Immerhin ist FXAA etwas besser als MLAA.

Die einzigen Pro-Argumente für FXAA lauten:

- Läuft auch, wenn die Engine keinen Bock auf MSAA hat (deferred & Co.)
- Ist relativ günstig zu haben

Ansonsten:

[x] SSAA an die Macht

MfG,
Raff

Banshee18
2011-07-06, 20:39:56
Da widerspreche ich dir nicht. In GTA4 oder Metro würde ich mich aber über ein gut funktionierendes FXAA freuen.
Mehr Einstellungen sind mir außerdem immer willkommen.

Raff
2011-07-06, 20:47:27
Hmja. In GTA 4 bringt der iCEnhancer schon brauchbare Ergebnisse, wobei der Schärfefilter viel wegkeult. Ziemlich nervig, aber vielleicht konfigurierbar.

Nvidias FXAA funktioniert indes dort perfekt, wo es sinnlos ist: in alten Spielen. Ich habe gerade eine Runde Quake 3 Arena hinter mir. Da gibt's kein Texturflimmern (mit HQ-AF) und FXAA kann daher alles plattmachen, ohne dass Störeffekte bleiben. Nur wofür braucht man in alten Spielen hochperformantes AA?

MfG,
Raff

BeetleatWar1977
2011-07-06, 21:17:00
Ich sags mal so - FXAA ist was für deferred Renderer wo sonst nichts funzt

Raff
2011-07-06, 21:28:36
Auch dort würde irgendeine Form des Supersampling laufen. Und wenn es nur OGSS ist – man sollte als High-End-Nutzer die Wahl haben. :)

MfG,
Raff

Mr. Lolman
2011-07-06, 21:34:21
Supersampling ist immernoch die ineffizienteste Form des AA. FXAA ist flott und sieht gut aus. Und zwar so gut, dass das zeitliche Aliasing imho auch vermindert wirkt. FXAA FTW!!

Raff
2011-07-06, 21:35:47
Alles ok mit dir, Lolli? Läuft deine Göttin nicht mehr? :eek: SGSSAA FTW!!! :biggrin:

MfG,
Raff

Mr. Lolman
2011-07-06, 22:00:18
Alles ok mit dir, Lolli? Läuft deine Göttin nicht mehr? :eek: SGSSAA FTW!!! :biggrin:

MfG,
Raff
Keine Sorge. Meiner Göttin gehts bestens :D

Auf der Voodoo hatte SGSSAA noch andere Vorteile. Kein 16/22bit Dithering und bessere LOD-Transition für Lau! Voodoo5 16/22 bit SGSSAA + bilinearem Filtering war im Vergleich zu 32bit noAA + trilinearem Filtering auch relativ günstig und brachte die eben schon erwähnten Vorteile.

Heutiges SGSSAA bringt vgl. zu MSAA nix außer Texturuoversampling samt (die Möglichkeit zu) negativem LOD bei 50% - 75% höherer Rechenlast (die man sich dann irrigerweise tw. mit MultiGPU zurechtbiegt). FXAA kostet fast nix und erzeugt ein sehr homogenes Bild (im Gegensatz zu MLAA, was tw. zu weichgespült wirkt). FXAA ist zwar immernoch schlechter als MSAA, aber halt universell einsetzbar und eben - verdammt günstig! :)

Ronny145
2011-07-06, 22:04:03
MLAA ist zwar immernoch schlechter als MSAA, aber halt universell einsetzbar und eben - verdammt günstig! :)


MLAA verdammt günstig? Ich behaupte das Gegenteil.


Was ist denn aus dem SRAA geworden? Klang für mich vielversprechender.

Mr. Lolman
2011-07-06, 22:07:08
Oh, ich meinte natürlich FXAA. Hoppla. Habs ausgebessert. :redface:

boxleitnerb
2011-07-06, 22:14:20
Hast du Just Cause 2? Probier da mal MLAA, das Spiel ist eine Flimmerhölle. Würde mich interessieren, ob das was bringt.

Es reicht halt nicht jedem so ein "AA für Arme". Zurechtbiegen find ich da zu hart als Aussage - Ansprüche sind nicht bei jeden gleich.

Blaire
2011-07-06, 22:15:58
Auch dort würde irgendeine Form des Supersampling laufen. Und wenn es nur OGSS ist – man sollte als High-End-Nutzer die Wahl haben. :)


Das hat man bei NVIDIA doch, ob offiziell oder nicht ist doch sowas von egal solange es funktioniert ist doch alles in Butter und es wird niemand gezwungen es zu nutzen. Also muss auch keiner meckern, möchte man meinen. ;D

Gast
2011-07-07, 08:43:24
Was ist denn aus dem SRAA geworden? Klang für mich vielversprechender.


Das Verfahren ist eine Weiterentwicklung von SRAA.

Gast
2011-07-07, 10:39:33
Hast du Just Cause 2? Probier da mal MLAA, das Spiel ist eine Flimmerhölle. Würde mich interessieren, ob das was bringt.


Die ganzen Postfilter AA-Verfahren bringen wenig bis gar nichts gegen Flimmern, dafür braucht man echte Überabtastung, oder man müsste über mehrere Frames hinweg blurren.

Gast
2011-07-12, 16:59:52
Die ganzen Postfilter AA-Verfahren bringen wenig bis gar nichts gegen Flimmern, dafür braucht man echte Überabtastung, oder man müsste über mehrere Frames hinweg blurren.

Wäre diese ganze Problematik nicht gelöst wenn man einen genaueren Z-Buffer hätte, also sagen wir mal statt 32 bit, 64 bit?

Gibt es nicht schon Profi karten die sowas können?

Gast
2011-07-12, 17:09:34
Ach und zum FXAA ne Frage, hatte kürzlich irgendwo einen Hinweis gesehen wie man die Option FXAA zu aktivieren im Nvidia control panel freischalten kann, kann aber leider nicht mehr finden wo das war. Wisst ihr das zufällig?

Nochmal, mir ist klar wie man FXAA über den Inspector einschaltet, ich frage nach dem tweak mit dem man diese Option vorab im Nvidia Treiber Kontrollfeld angezeigt bekommt.

Gast
2011-07-12, 17:20:35
Guckst Du hier (http://extreme.pcgameshardware.de/user-news/157507-neuer-nvidiatreiber-mit-whql-275-33-a-3.html)

Gast
2011-07-12, 17:31:33
Guckst Du hier (http://extreme.pcgameshardware.de/user-news/157507-neuer-nvidiatreiber-mit-whql-275-33-a-3.html)


Super danke dir!

Noch eine andere Frage, ich habe gerade mal ein wenig wegen Z-buffer/ Z precision usw. gegoogelt. Was ist eigentlich mit dem W-Buffer "passiert" ich erinnere mich das der um das Jahr 2000-2004 mal in aller Munde war als Zukunft oder so, ist der mit DX 10 und 11 noch ein Thema?

Im Inspector findet man ihn ja auch kryptisch erwähnt aber die Settings sind wohl bisland unerforscht, also niemand scheint zu wissen wie die sich auswirken und ob sie sinn machen!?

DrFreaK666
2011-07-12, 19:19:40
FXAA wurde gerade in Freespace 2 eingebaut.

Ich hatte eigentlich nicht viel erwartet, aber es ist recht brauchbar.

Sichtbare Kanten werden geglättet. Shaderflimmern wird ein Stück weit bekämpft und das Bild wirkt recht "stimmig"/"konsistent" von der globalen Schärfe her. Es scheint auch recht günstig zu sein.
Ich kann jedenfalls keinen Unterschied in meiner Framerate feststellen.

Auf der anderen Seite verliert das Bild leicht an Schärfe. Scharfe Details werden auch gleich mit weggeglättet. :(
Nicht dramatisch, aber IMHO sichtbar.
Immer noch kein Vergleich zu dem grottigen Quincunx AA ;).

Hast du mal versucht einen Schärfe-Filter drüberzubügeln?
Wahrscheinlich reicht es mit dem LOD etwas ins negative zu gehen um etwas mehr Schärfe zu erhalten.
Wieso habt ihr FXAA der Engine hinzugefügt? Ist sie nicht mit dem "normalen" AA kompatibel?

Gast
2011-07-12, 20:42:06
Wäre diese ganze Problematik nicht gelöst wenn man einen genaueren Z-Buffer hätte, also sagen wir mal statt 32 bit, 64 bit?

Nein, mit dem Z-Buffer hat das überhaupt nichts zu tun.

Flimmern entsteht beispielsweise bei sehr dünnen Objekten (< 1 Pixel) wie Stromleitungen oder ähnliches. Post-filter-AA kann dagegen nichts wirklich ausrichten. Das Post-Filter-AA versucht aus vorhandenen Informationen über aneinander-grenzende Objekte den Übergang zu erraten.
Damit das funktioniert müssen auf beiden Seiten der Kante genügend Informationen vorhanden sein. Über das dünne Objekt sind aber kaum Informationen im Bild vorhanden die man ineinander übergehen lassen könnte.
Um das Flimmern zu beseitigen müsste man so stark blurren, dass das dünne Objekt nicht mehr sichtbar ist und vom Hintergrund "überstrahlt" wird.

Die zweite Flimmerquelle sind (für die Zielauflösung) zu hochfrequente Texturdetails, sei es durch unzureichende Texturfilter, schlecht gemachte Texturen oder Pixelshader verursacht.
Als Flimmern wird etwas wahrgenommen, wenn sich die Farben einzelner Pixel nach jedem Frame zu stark ändert.

Um das Flimmern zu verhindern müsste man so stark Blurren, dass man alle Details glattbügelt.

Gast
2011-07-12, 20:48:53
Wahrscheinlich reicht es mit dem LOD etwas ins negative zu gehen um etwas mehr Schärfe zu erhalten.


Ganz schlechte Idee.

LOD verschieben erhöht die Schärfe bei der höchsten Texturauflösung überhaupt nicht und im Bereich der kleineren MipMaps erzeugt es flimmern, was eben durch einen Blurfilter nicht verhindert wird.

-/\-CruNcher-/\-
2011-07-12, 22:36:05
Also bei Crysis 2 (1.9) ist FXAA momentan ein graus :( vor allem das Nvidia und Crytek sich anscheinend für die höchste stuffe entschieden haben als Default das Blured den ganzen Screen und Subjektiv tut das immens aua (Das Ergbeniss was man beim Anti Aliasing erzielen will ist ohne frage beindruckend im vergleich zur Geschwindigkeit :) ).

http://www.forum-3dcenter.org/vbulletin/showthread.php?p=8829901#post8829901

IMO ist FXAA eine Weiterentwicklung von etwas, das für die Katz ist – MSAA. Was bringen uns 16-32x Samples, wenn in Bewegung der gesamte Glättungseffekt den Bach runtergeht? Was vorher flimmerte, flimmert weiter; was vorher eine nicht durchgezogene Linie war, ist immer noch ein Flickenteppich; Alphatests sehen im Stand toll aus, seuchen bei der kleinsten Bewegung aber, als sei niemand drübergeFXAAt. Immerhin ist FXAA etwas besser als MLAA.

Die einzigen Pro-Argumente für FXAA lauten:

- Läuft auch, wenn die Engine keinen Bock auf MSAA hat (deferred & Co.)
- Ist relativ günstig zu haben

Ansonsten:

[x] SSAA an die Macht

MfG,
Raff

Jo Problem scheint hier überhaupt nicht zu funktionieren G92 selbst mit den Bits gesetzt fehlanzeige :(

Gast
2011-07-13, 11:38:13
[x] SSAA an die Macht


Wir brauchen kein SSAA sondern endlich Monitore mit mindestens 200ppi.

FullHD ist einfach viel zu wenig, es sollte schon mindestens 4k-Auflösung möglich sein.

boxleitnerb
2011-07-13, 11:47:03
Da das aber viel zu teuer ist und noch weit in der Zukunft liegt, geht an SSAA kein Weg vorbei.

Ich hab lieber 2,3 oder 4 Grafikkarten für 2000 Euro statt einen neuen supertollen Monitor für 20,000 Euro ;)

Gast
2011-07-14, 17:05:02
Also wenn ich mir Grafikkarten für 2000 Euro leisten könnte wäre ich bereits hochzufrieden.

In der aktuellen c't ist ein Monitor erwähnt (für Flughäfen/ Zoll gedacht) für sage und schreibe 20.000 Euro (glaube der war sogar nur 36 Zoll). Was den so besonders macht hab ich gerade nicht in Erinnerung, vielleicht wars besagte Pixeldichte.

Gast
2011-07-22, 10:32:53
Übrigens FXAA funktioniert auch bereits in DirectX Titeln, wie sich hartnäckig hielt dem wäre nicht so und es würde nur unter OpenGL funktionieren, ist mir unverständlich.

Interessanter ist aber vielleicht auch, da Timothy Lotte ja kontinuierlich an FXAA arbeitete und seine "Idee" open source und frei zugänglich ist, hier übrigens die neueste Version vom 21.07.2011 http://timothylottes.blogspot.com/2011/07/fxaa-311-released.html

und in vielen games die shader/ hls post processing Dateien zugänglich und editierbar sind man diese aktuelle Version auch selbst einfügen könnte. Denn was von Nvidia in den betas gelandet ist dürfte schon ewig alt und damit nicht auf dem Stand seiner Verbesserungen sein.

DrFreaK666
2011-07-22, 10:56:08
Übrigens FXAA funktioniert auch bereits in DirectX Titeln, wie sich hartnäckig hielt dem wäre nicht so und es würde nur unter OpenGL funktionieren, ist mir unverständlich.

Interessanter ist aber vielleicht auch, da Timothy Lotte ja kontinuierlich an FXAA arbeitete und seine "Idee" open source und frei zugänglich ist, hier übrigens die neueste Version vom 21.07.2011 http://timothylottes.blogspot.com/2011/07/fxaa-311-released.html

und in vielen games die shader/ hls post processing Dateien zugänglich und editierbar sind man diese aktuelle Version auch selbst einfügen könnte. Denn was von Nvidia in den betas gelandet ist dürfte schon ewig alt und damit nicht auf dem Stand seiner Verbesserungen sein.

Das kannst du sicherlich mit Screenshots bekräftigen...

Gast
2011-07-22, 11:37:42
Das kannst du sicherlich mit Screenshots bekräftigen...

Das kann jeder selbst nachprüfen, etwa über ein beliebiges Unreal Engine 2 oder 3 Spiel. Bin derzeit nicht zuhause kann also gerade mit Screenshots nicht dienen, zumal da es ja bisher scheinbar kaum jemandem aufgefallen war viele den Unterschied ohnehin nicht feststellen könnten.

Gast
2011-07-22, 11:39:30
Das Problem dabei drüfte generell die vermutlich frühe Implementierung der Technik sein die in den Nvidia Betas vorhanden ist, die dürfte schon sehr alt sein so fleißig wie Lottes daran gearbeitet hat.

Gast
2011-07-22, 11:40:53
Ach ja und auch Qualitativ hat sich da sehr viel getan, wäre wirklich mal interessant zu wissen wie der aktuelle stand aussieht.

Da die shader in Unreal Engines games ja meist offen liegen müsste man da doch was hinzufügen können!?

Gast
2011-07-22, 23:21:34
Timothy Lottes said...

"might be possible to quickly prototype FXAA in a GL or DX11 game which provides editable shaders. You would need to find a late-in the-frame post processing shader which samples each pixel once, then run FXAA to "sample the pixel" with FXAA_GREEN_AS_LUMA and use in-pixel-shader texture size queries to produce the required inputs to FXAA (so DX9 is likely out). This would NOT be the correct way to integrate FXAA, but might work.

As for your other questions, all I'm going to say for now is that I would not have added the green box: http://forums.steampowered.com/forums/showthread.php?p=22935488 "

Gast
2011-07-22, 23:22:40
Und nur am Rande, das von einem Gast der hier schon des öfteres Beiträge gelöscht bekam aber dennoch hier dazu beiträgt Dinge herauszufinden und nicht sein ego mit Gamma-Esotherik-Anhängern boosten muss.

Ronny145
2011-07-22, 23:30:55
Das Verfahren ist eine Weiterentwicklung von SRAA.

Könntest Du dies mit einer Quelle unterlegen? Ich wäre sehr interessiert daran.

Gast
2011-07-22, 23:33:15
Timothy Lottes said...

"might be possible to quickly prototype FXAA in a GL or DX11 game which provides editable shaders. You would need to find a late-in the-frame post processing shader which samples each pixel once, then run FXAA to "sample the pixel" with FXAA_GREEN_AS_LUMA and use in-pixel-shader texture size queries to produce the required inputs to FXAA (so DX9 is likely out). This would NOT be the correct way to integrate FXAA, but might work.

As for your other questions, all I'm going to say for now is that I would not have added the green box: http://forums.steampowered.com/forums/showthread.php?p=22935488 "

Sry wegen der vielen Post aber das ist dann halt doch der Nachteil hier nicht editieren zu können. Seine Nachricht ist für mich als shader Laie doch recht kryptisch, jetzt müsste man eben nur noch herausfinden wo und wie genau man das etwa in Batman oder Mass Effect 2 Shader einfügt. Er sagt zwar DX11 aber 10 müsste auch gehen wird aber wohl auch nicht detaillierter damit man nicht zuviel Wind darum macht das es an sich geht.

Wer kann die Details davon verstehen? Und wieso komm ich auf Laie auf so ne Idee und hier von den ach so tollen Gurus keiner?

DrFreaK666
2011-07-22, 23:44:37
Sry wegen der vielen Post aber das ist dann halt doch der Nachteil hier nicht editieren zu können. Seine Nachricht ist für mich als shader Laie doch recht kryptisch, jetzt müsste man eben nur noch herausfinden wo und wie genau man das etwa in Batman oder Mass Effect 2 Shader einfügt. Er sagt zwar DX11 aber 10 müsste auch gehen wird aber wohl auch nicht detaillierter damit man nicht zuviel Wind darum macht das es an sich geht.

Wer kann die Details davon verstehen? Und wieso komm ich auf Laie auf so ne Idee und hier von den ach so tollen Gurus keiner?

Vielleicht weil man lieber echtes AA in Mass Effect 2 oder Batman einschalten will anstatt FXAA?

Gast
2011-07-22, 23:51:38
Vielleicht weil man lieber echtes AA in Mass Effect 2 oder Batman einschalten will anstatt FXAA?

Ja Herr Schlauberger, leider ist es aber so das man dann einige Effekte verliert, Beispielsweise in Mass Effect 2, wenn man mit nem generischen Shep (kann jeder testen) nach dem aufwachen auf der Cerberus Station, die Waffe aufgenommen hat und in Deckung geht bevor die Kanister explodieren, ohne AA schlagen die flammen zufällig irgendwo auf und lodern dann dort im kleinen noch (auf den jeweiligen stellen), mit erwzungenem AA fehlen diese komplett. Auch etwa fehlt der high quality bloom.

DrFreaK666
2011-07-22, 23:54:50
Ja Herr Schlauberger, leider ist es aber so das man dann einige Effekte verliert, Beispielsweise in Mass Effect 2, wenn man mit nem generischen Shep (kann jeder testen) nach dem aufwachen auf der Cerberus Station, die Waffe aufgenommen hat und in Deckung geht bevor die Kanister explodieren, ohne AA schlagen die flammen zufällig irgendwo auf und lodern dann dort im kleinen noch (auf den jeweiligen stellen), mit erwzungenem AA fehlen diese komplett. Auch etwa fehlt der high quality bloom.

Wer braucht schon Flammen?? :biggrin:
Sorry, wusste ich nicht, da ich ME2 nicht habe

Gast
2011-07-22, 23:57:35
Wer bracuht schon Flammen?? :biggrin:
Sorry, wusste ich nicht, da ich ME2 nicht habe

Hihi, ja war auch nicht böse gemeint oder so, das mit den lodernden Flammen am Boden war nur ein Beispiel, fehlen auch von den Skills manche Effekte. Klar die meisten merken es nicht, beim rumprobieren mit den Comp. Modi freut man sich dann das die Performance besser wurde, das dem aber mitunter so ist weil Effekte fehlen,... tja ist eben oft unbemerkt.

DrFreaK666
2011-07-23, 00:03:44
Hihi, ja war auch nicht böse gemeint oder so, das mit den lodernden Flammen am Boden war nur ein Beispiel, fehlen auch von den Skills manche Effekte. Klar die meisten merken es nicht, beim rumprobieren mit den Comp. Modi freut man sich dann das die Performance besser wurde, das dem aber mitunter so ist weil Effekte fehlen,... tja ist eben oft unbemerkt.

Als SGSSAA inoffiziell war, da war natürlich jeder heiss darauf und deshalb wurde viel ausprobiert. FXAA und MLAA stoßen hier aber eher auf Gegner als auf Freunde.
Man sollte abwarten bis das feature offiziell ist, vielleicht schon ab den 280er-Treibern..??

Gast
2011-07-23, 00:04:45
Hihi, ja war auch nicht böse gemeint oder so, das mit den lodernden Flammen am Boden war nur ein Beispiel, fehlen auch von den Skills manche Effekte. Klar die meisten merken es nicht, beim rumprobieren mit den Comp. Modi freut man sich dann das die Performance besser wurde, das dem aber mitunter so ist weil Effekte fehlen,... tja ist eben oft unbemerkt.

Was ich damit sagen wollte ist, letztlich ist es wohl recht simpel den FXAA shader einzubinden, es muss nur an der richtigen Stelle passieren, für mich als Laie ist das trial and error, aber auch sehr interessant sich da durch die shader zu lesen, sind viel besser aufgebaut als manche html flickwerke. Zumal an FXAA kräftig gewerkelt wurde und die Qualität auch wesentlich verbessert wurde liese sich damit in sehr vielen spielen (zumindest in den meisten der Unreal Engine) FXAA einfügen (ohne großen aufwand wenn korrekte stelle erstmal bekannt) was hieße zwar kein "echtes" AA dafür aber wesentlich mehr/ verbesserter Effekt als wir bisher auf testscreenshots von alten Nvidia Beta fxaa Implementierungen gesehen haben und zum anderen ohne fehlende effekte!!!!

Wenn man dann eine hohe Auflösung nutzt, evtl. noch downsampled, dann kann es gut sein das man damit sehr gut hin kommt und das bei wesentlich akzeptablerer Performance als mit anderen Methoden.

Gast
2011-07-23, 00:11:08
Als SGSSAA inoffiziell war, da war natürlich jeder heiss darauf und deshalb wurde viel ausprobiert. FXAA und MLAA stoßen hier aber eher auf Gegner als auf Freunde.
Man sollte abwarten bis das feature offiziell ist, vielleicht schon ab den 280er-Treibern..??


Ist mir bekannt, aber ich weiss eben auch das es hier viele Missverständnisse gibt die vorherrschen, hat halt so den Geschmäckle eines Blur-Shaders zumal auf ersten Versionen wohl auch ein zuerst genanntes Ziel war auf Konsolen optimiert zu sein. ABER wer sich mal den Code anschaut, dem wird klar es geht hier um viel mehr und es gab diverse Inkarnationen. Mitunter ja auch noch kleine tippfehler im Code, manuell kann man das alles auf aktuellstem stand halten, in dem es verschiedene Presets für unterschiedliche Szenarien gibt, mittlerweile hat Lottes bekannt gegeben das die Qualität auf dem PC wesentlich verbessert werden konnte und das es derzeit, sogar etwas schneller auf Nvidia Karten als auf ATI Karten läuft (was zwar kein erklärtes Ziel war aber aus seinem Insiderwissen her über deren Arbeitsweise als Nvidia-Mitarbeiter resultieren dürfte, jemand der entsprechende Kenntnisse hat kann später das beliebig ausgleichen/ optimieren sofern er das selbst nicht noch tun wird).

Gast
2011-07-25, 11:02:05
Vorab, bitte an die Mods, wäre es möglich den Titel des Threads anzupassen, damit eine weiterführende Diskussion zum Thema klar erscheint, bisher scheint der Thread daher kaum beachtet!?

Nun zu den Beobachtungen:
Generell bin ich nachwievor der Meinung das wie oben beschrieben das dies möglich ist, nur wenn auch die shader noch so übersichtlich gehalten sind, ohne eine Funktion im Detail zu kennen, oder Ihre Parameter, bringt einem das wenig, zumindest Grundkenntnisse des Bereichs wären nötig.

Ohne kann man bestenfalls bestimmte selbsterklärende Begriffe verstehen, die Parameter der Funktion kennt man dann dennoch natürlich nicht automatisch.

Was ich jedoch feststellen konnte ist allerdings das viele Shader etwa in Unreal Engine Games 1:1 von Epic kommen, also der Standard des jeweiligen Standes über Große Teile ist, es ist interessant hier zu sehen wie auch der Support hier von Epic scheinbar updates einbringt bzw. der Nutzer der Engine Lizenz sich vereinzelt Updates geholt hat, diese sind in der Regel mit Kommentaren und Datum versehen.

Letztlich heisst das, wer sich die Mühe macht kann vereinzelte Shader selbst updaten und von den Vorteilen gebrauch machen, wenn das auch in manchem Fall eher subtiles, Optimierungen sein werden, für den Enthusiasten spannend.

Wie das genau geht, es gibt mehrere Möglichkeiten, ein Blick auf das UDK von Epic zeigt allerdings, man schützt mittlerweile die eigenen Shader vor allzu neugierigen Blicken, oder macht es zumindest nicht ganz offensichtlich wie man an diese herankommt und so sind neuerdings alle am PC relevanten Shader binär codiert, das heisst nicht ohne weiteres im normalen Text-Editor oder gar Erweiterten Editoren wie Notepad++ les,- und veränderbar. Ich vermute mal das man über das UDK, glaube da gibt es mittlerweile auch einen shader Editor, anders heran käme, hab es aber noch nicht versucht.

Eine andere Möglichkeit wäre Unreal Engine Titel zu vergleichen.
Etwa Batman GOTY und Mass Effect 2, Batman nutzt Shader von Epic datiert auf 2008, Mass Effect 2 Shader von 2006-2007, allerdings mit mancherorts eingefügten Einzelupdates aus 2009. Dies könnte man nutzen, also beides kombinieren, habs ausprobiert es geht. Was nicht geht ist was komplett auf den jeweiligen Titel angepasst ist, in Mass Effect 2 etwa deutlich mit Kommentaren und "BIO" -irgendwas gekennzeichnet.

Aus dem Kommentar von Timothy Lottes schließe ich (er scheint nicht auf den korrekten weg einzugehen da der ausführlicher Beschrieben werden müsste) das der korrekte Weg wäre einen FXAA Shader einzeln zu haben und denn letztlich an korrekter Stelle in einem anderen post process shader der ziemlich am Ende der Abfolge kommt als Funktion mit entsprechend passendem preset aufzurufen/ zu callen.

Quick und dirty (wohl der beschriebene nicht korrekte aber mögliche Weg) wäre wohl den entsprechenden Teil des FXAA shaders selbst in einen vorhanden Shader einzubasteln.

Beides ist mir leider in Ermangelung der erforderlichen Kenntnisse nicht möglich. Seltsamerweise, obwohl es so viele Modder gibt, scheint bisher wenig darüber bekannt, Shader weitesgehend ignoriert, obwohl man hier gerade viel optimieren/ tweaken, updaten und verändern könnte.

Mass Effect 2 zum Beispiel bekam ja für den PS3 release ein Engine update, hier wurden also u.a. modernere Shader Versionen aus eigenentwicklungen und offiziellen Epic Updates eingebunden. Bisher wurde der PC Version dazu nichts angedacht von offizieller Seite, es ist zu Vermuten das man sich dies für eine irgendwann erscheinende Sammlung oder besondere Edition aufhebt, falls überhaupt, obwohl es an sich keine große Sache ist wird es also dem ehrlichen Käufer und Fan derzeit nicht offiziell zugänglich gemacht. Warum also hier keine Mod-Szene am werkeln ist, ist mir etwas schleierhaft. Denn selbst für Mass Effect 2 haben fähige Leute an Mods gearbeitet (texturersatzt-mods über texmod in runtime), warum also werden Shader so vernachlässigt?

Dann habe ich mich noch etwas weiter umgesehen, Duke Nukem Forever nutzt ja FXAA, wenn auch, das ist zu Erwähnen die ewig Alte Inkarnation der Version 1. Ich habe einfach mal versucht den frei zugänglichen FXAA Shader komplett durch den neuen zu ersetzen (man muss nur den Dateinamen leicht abändern) und siehe da es geht, die Qualität ist recht gut allerdings zumindest auf meiner GTS 250 auch mit deutlichem Performance hit. Ist zu vermuten das die Grundeinstellung, ja von mir nicht abgewandelt, nicht ganz optimal ist, aber funktionieren tut es.

Ich hoffe jemand fähiges mit Kentnissen aus dem Bereich liest das oder hört davon und wir bekommen etwas aufmerksamkeit für das potential der editierbaren Shader, es würde sich für uns alle, als Gamer aber auch als Tweaker lohnen.

Gast
2011-07-25, 11:05:03
ein Blick auf das UDK von Epic zeigt allerdings, man schützt mittlerweile die eigenen Shader vor allzu neugierigen Blicken, oder macht es zumindest nicht ganz offensichtlich wie man an diese herankommt und so sind neuerdings alle am PC relevanten Shader binär codiert, das heisst nicht ohne weiteres im normalen Text-Editor oder gar Erweiterten Editoren wie Notepad++ les,- und veränderbar. Ich vermute mal das man über das UDK, glaube da gibt es mittlerweile auch einen shader Editor, anders heran käme, hab es aber noch nicht versucht.

Kleiner semi edit/ Nachtrag, hatte ich vergessen zu erwähnen und zwar mit für PC relevante Shader war gemeint das dort nur noch ES2 Shader offen einsehbar sind (für mobilanwendungen gedacht).

Gast
2011-07-25, 11:13:02
Ich hoffe jemand fähiges mit Kentnissen aus dem Bereich liest das oder hört davon und wir bekommen etwas aufmerksamkeit für das potential der editierbaren Shader, es würde sich für uns alle, als Gamer aber auch als Tweaker lohnen.

Erneut ein kleiner Nachtrag mit einem Beispiel, ich erinnere mich an eine Szene in Mass Effect 2, irgendwo auf der Citadel, glaube es war da wo es die kleine Side-quest gab mit dem des Diebstahls verdächtigten Quarian, war ein VI in dessen Hintergrund irgendetwas geschrieben stand, nur leider war hier den Entwicklern etwas entgangen was einen aus der ansich sehr dichten Athmo bringt, eine kleinigkeit aber für Fans ebens durchaus eine ärgerliche Sache und zwar ist das VI ja halbtransparent und hier hatte sich offenbar ein Bug eingeschlichen insofern alsdas hier die ebenfalls halbtransparente aber eigentlich hinter dem VI stehende Schrift, vor dem VI erscheint.

Hier wäre denkbar das falls über Shader implementiert (was ich nicht wirklich weiss) dies behebbar wäre. Das nur als denkansatz.l

Gast
2011-07-26, 08:21:19
Hier schaut wohl nie ein Mod rein?
Könnte ein reg das vielleicht an einen Mod weiterleiten? thx

DrFreaK666
2011-07-26, 09:35:44
Wieso registrierst du dich nicht einfach?
Als reg wird man leider eher ernst genommen als als Gast.

Und die Sache mit dem aktuellen FXAA @Duke finde ich durchaus interessant.
Screenshots-Vergleiche mit FPS-Anzeige würde dem Thema vielleicht etwas mehr Würze geben als ein ewig langer Text ;)

Und wenn das stimmt, was du sagst (FXAA@Duke) dann könntest ja die Datei hochladen und hier anbieten. Wenn das verboten sein sollte dann wenigstens eine Anleitung schreiben.

BeetleatWar1977 hat ja selbst etwas am Duke gemoddet.
Auch wenn er soweit ich weiss ein FXAA-Gegner ist, könnte ihn das interessieren.

Also: Melde dich an, poste Vergleichs-Screenshots und schreibe eventuell BeetleatWar1977 an.

Wenn du Recht haben solltest und es beim Duke funktioniert, dann ist es möglich, dass es das Interesse anderer auf sich zieht und den Stein ins Rollen bringt :smile:

Gast
2011-07-26, 09:51:13
Wieso registrierst du dich nicht einfach?
Als reg wird man leider eher ernst genommen als als Gast.

Und die Sache mit dem aktuellen FXAA @Duke finde ich durchaus interessant.
Screenshots-Vergleiche mit FPS-Anzeige würde dem Thema vielleicht etwas mehr Würze geben als ein ewig langer Text ;)

Und wenn das stimmt, was du sagst (FXAA@Duke) dann könntest ja die Datei hochladen und hier anbieten. Wenn das verboten sein sollte dann wenigstens eine Anleitung schreiben.

BeetleatWar1977 hat ja selbst etwas am Duke gemoddet.
Auch wenn er soweit ich weiss ein FXAA-Gegner ist, könnte ihn das interessieren.

Also: Melde dich an, poste Vergleichs-Screenshots und schreibe eventuell BeetleatWar1977 an.

Wenn du Recht haben solltest und es beim Duke funktioniert, dann ist es möglich, dass es das Interesse anderer auf sich zieht und den Stein ins Rollen bringt :smile:

Hallo, ja vermutlich hast du recht, leider wird man hier als Gast schon ab und an leicht ignoriert, zumal auch ungünstig benannte topics eben auch an manchem Mod vorbeigehen zu scheinen.

Evtl habe ich hier sogar irgendwo schon einen account muss mal nachsehen.

Das mit dem Duke, also du musst garnichts besonders machen, du musst nur das was timothy lottes von Nvidia auf seiner Blog Seite zum download anbietet nehmen (da ist nichts illegales bei Nvidia bzw. Lottes bieten das frei für jeden an) und copy und paste (komplett oder Dateinamen abändern) du fügst also entweder die aktualisierte FXAA Variante ein oder Ersetzt die alte komplett durch die neue Shader Datei, gehupft wie gesprungen.

DrFreaK666
2011-07-26, 10:04:04
Hallo, ja vermutlich hast du recht, leider wird man hier als Gast schon ab und an leicht ignoriert, zumal auch ungünstig benannte topics eben auch an manchem Mod vorbeigehen zu scheinen.

Evtl habe ich hier sogar irgendwo schon einen account muss mal nachsehen.

Das mit dem Duke, also du musst garnichts besonders machen, du musst nur das was timothy lottes von Nvidia auf seiner Blog Seite zum download anbietet nehmen (da ist nichts illegales bei Nvidia bzw. Lottes bieten das frei für jeden an) und copy und paste (komplett oder Dateinamen abändern) du fügst also entweder die aktualisierte FXAA Variante ein oder Ersetzt die alte komplett durch die neue Shader Datei, gehupft wie gesprungen.

Das Problem ist auch, dass hier jeder Gast gleich heisst ^^
So weiss man nicht mit wem man es gerade zu tun hat

Also: anmelden/einloggen -> vielleicht einen neuen Thread im Technologie-Forum starten (siehe meinen MLAA-Thread ;) http://www.forum-3dcenter.org/vbulletin/showthread.php?t=494250&highlight=mlaa) -> interessanten Titel suchen und hoffen, dass der Thread gedeiht

Viel Glück :smile:

Gast
2011-07-26, 10:08:20
ps. habe gerade mal kurz nachgesehen was BeetleatWar1977 wie von dir erwähnt am Duke gemacht hat. Kurz in die shader Datei von ihm reingeschaut. Also wenn er sich damit auskennt wäre er natürlich der richtige Mann, bei Interesse am Shader Modding generell und eben auch den Kenntnissen dazu, wenn er denn mag. Also nicht nur was FXAA angeht.

BeetleatWar1977
2011-07-26, 20:27:17
ps. habe gerade mal kurz nachgesehen was BeetleatWar1977 wie von dir erwähnt am Duke gemacht hat. Kurz in die shader Datei von ihm reingeschaut. Also wenn er sich damit auskennt wäre er natürlich der richtige Mann, bei Interesse am Shader Modding generell und eben auch den Kenntnissen dazu, wenn er denn mag. Also nicht nur was FXAA angeht.
Ich bin Amateur - aber ein begabter ;D

Wenn ihr was bestimmtes wollt - sagt es einfach ;)

DrFreaK666
2011-07-27, 06:47:31
Ich bin Amateur - aber ein begabter ;D

Wenn ihr was bestimmtes wollt - sagt es einfach ;)

Schau mal bitte nach ob es wirklich möglich ist das "neue" FXAA in den Duke zu implementieren

THX

BeetleatWar1977
2011-07-27, 07:19:58
Schau mal bitte nach ob es wirklich möglich ist das "neue" FXAA in den Duke zu implementieren

THX
Was war die letzte? Die vom 13.7.?

DrFreaK666
2011-07-27, 07:33:09
Es gibt ne Version vom 21.7
http://timothylottes.blogspot.com/2011/07/fxaa-311-released.html

BeetleatWar1977
2011-07-27, 07:36:32
Es gibt ne Version vom 21.7
http://timothylottes.blogspot.com/2011/07/fxaa-311-released.html
Gesaugt - ich weiß nicht ob ichs vor der Arbeit noch schaffe - ansonsten schau ich heute abend rein.

Gast
2011-07-27, 08:06:10
Schau mal bitte nach ob es wirklich möglich ist das "neue" FXAA in den Duke zu implementieren

THX


Mensch FreaK, hab ich dir doch lang und breit erklärt das ist ganz easy, siehe oben.

@BeetleatWar1977 bitte schau mal ob du anhand der Antwort von Lottes (sie vorherige Thread seite) den FXAA Shader in Mass Effect 2 einbinden kannst.

DrFreaK666
2011-07-27, 08:06:57
Mensch FreaK, hab ich dir doch lang und breit erklärt das ist ganz easy, siehe oben.

@BeetleatWar1977 bitte schau mal ob du anhand der Antwort von Lottes (sie vorherige Thread seite) den FXAA Shader in Mass Effect 2 einbinden kannst.

Ich will halt Vergleichsscreenshots. Schreiben kann man viel :biggrin:

Gast
2011-07-27, 08:12:41
Ich will halt Vergleichsscreenshots. Schreiben kann man viel :biggrin:

Du brauchst doch nur eine Datei ersetzen dann kannste dir selbst nen screenshot machen, menschens kinner.

BeetleatWar1977
2011-07-27, 08:24:30
Du brauchst doch nur eine Datei ersetzen dann kannste dir selbst nen screenshot machen, menschens kinner.
Ganz so einfach ist es nicht - bei der aktuellen Version werden mehr Parameter benutzt als bei der vom Duke, ich muss ein paar Anpassungen vornehmen. Wird also erst heute abend was.

DrFreaK666
2011-07-27, 08:56:48
Ganz so einfach ist es nicht - bei der aktuellen Version werden mehr Parameter benutzt als bei der vom Duke, ich muss ein paar Anpassungen vornehmen. Wird also erst heute abend was.

Kein Problem :smile:

BeetleatWar1977
2011-07-27, 09:19:25
Kein Problem :smile:
Auf den letzten Drücker - um halb muss ich los :biggrin:

Ich habe es erstmal so gedreht, das er die Settings übersetzt.

Gast
2011-07-27, 10:13:08
Auf den letzten Drücker - um halb muss ich los :biggrin:

Ich habe es erstmal so gedreht, das er die Settings übersetzt.

Schauste dir das später mal für Mass Effect 2 an? Also entweder den shader einzuflicken oder korrekt zu callen!? thx

Gast
2011-07-27, 10:19:59
Ganz so einfach ist es nicht - bei der aktuellen Version werden mehr Parameter benutzt als bei der vom Duke, ich muss ein paar Anpassungen vornehmen. Wird also erst heute abend was.

Doch genau so einfach ist es, es geht probier es aus. Klar gibts da mehr parameter, macht auch sinn die sich anzusehen aber es geht wenn man alleine die Datei von timothy lottes nimmt, umbenennt und mit der vom Duke ersetzt.

BeetleatWar1977
2011-07-27, 10:28:33
Doch genau so einfach ist es, es geht probier es aus. Klar gibts da mehr parameter, macht auch sinn die sich anzusehen aber es geht wenn man alleine die Datei von timothy lottes nimmt, umbenennt und mit der vom Duke ersetzt.
hatte ich - ging nicht.

Gab erstmal einen Compilererror :undeclared identifier FxaaPixelShader oder so ähnlich.

Dann erstmal Setting setzen für PC, dann gibts die Presets 1-5 nicht mehr, die DNF nutzt - die musste ich auf 11-15 umleiten, und noch dem Programm sagen, das es die PS Version 3 nutzen soll.


Gruß Beetle@Work

Gast
2011-07-27, 10:43:27
hatte ich - ging nicht.

Gab erstmal einen Compilererror :undeclared identifier FxaaPixelShader oder so ähnlich.

Dann erstmal Setting setzen für PC, dann gibts die Presets 1-5 nicht mehr, die DNF nutzt - die musste ich auf 11-15 umleiten, und noch dem Programm sagen, das es die PS Version 3 nutzen soll.


Gruß Beetle@Work

Ich hab beides ausprobiert, subjektiv ist mit deinem editierten shader die FXAA performance bei selber Bildquali leicht besser (ich vermute das liegt an der anpassung der presets wohingegen es ohne ein jenachdem vielleicht nicht günstiges default preset nutzt), Bildquali ist aber mit orginal FXAA von Lottes und deinem Edit die selbe. Eine Fehlermeldung bekomme ich hier nicht. Naja auch nicht so wichtig, vielleicht aknnste ja später ein paar der edits etwas erläutern, dann lernt man hier auch mal was.

BeetleatWar1977
2011-07-28, 08:58:24
Ich habs nochmal kurz überarbeitet, in der ersten Zeile läßt sich jetzt das Preset auswählen:

// Choose the quality preset.
// This needs to be compiled into the shader as it effects code.
// Best option to include multiple presets is to
// in each shader define the preset, then include this file.
//
// OPTIONS
// -----------------------------------------------------------------------
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
// 39 - no dither, very expensive
//
// NOTES
// -----------------------------------------------------------------------
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
// 13 = about same speed as FXAA 3.9 and better than 12
// 23 = closest to FXAA 3.9 visually and performance wise
// _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style
//

Gast
2011-07-28, 09:57:01
Ich habs nochmal kurz überarbeitet, in der ersten Zeile läßt sich jetzt das Preset auswählen:

// Choose the quality preset.
// This needs to be compiled into the shader as it effects code.
// Best option to include multiple presets is to
// in each shader define the preset, then include this file.
//
// OPTIONS
// -----------------------------------------------------------------------
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
// 39 - no dither, very expensive
//
// NOTES
// -----------------------------------------------------------------------
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
// 13 = about same speed as FXAA 3.9 and better than 12
// 23 = closest to FXAA 3.9 visually and performance wise
// _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style
//

Klasse, thx!

Wie schauts aus kannst du dir die Mass Effect 2 Shader mal anschaun? Hat eigentlich das letzte Epic Game offene shader, wenn ja könnte man da evtl. was an optimierungen für andere UE Titel nutzen!?

BeetleatWar1977
2011-07-28, 19:44:47
Klasse, thx!

Wie schauts aus kannst du dir die Mass Effect 2 Shader mal anschaun? Hat eigentlich das letzte Epic Game offene shader, wenn ja könnte man da evtl. was an optimierungen für andere UE Titel nutzen!?
ME2 und Shift schaue ich mir am Wochenende mal an - was meinst du mit das letzte Epic Game? Bulletstorm?

Gast
2011-07-29, 05:43:09
ME2 und Shift schaue ich mir am Wochenende mal an - was meinst du mit das letzte Epic Game? Bulletstorm?

Oh klasse! Super, thx schonmal! Hoffe du bekommst das hin *daumendrück

Yap Bultestorm, mir war der Name gerade entfallen, kein besonders tolles Spiel aber ich glaube wohl die neueste Unreal Engine am Markt derzeit.

Gast
2011-07-29, 09:57:18
Oh klasse! Super, thx schonmal! Hoffe du bekommst das hin *daumendrück

Yap Bultestorm, mir war der Name gerade entfallen, kein besonders tolles Spiel aber ich glaube wohl die neueste Unreal Engine am Markt derzeit.

Noch ne Frage zu dem Thema, die aktuellen Shader im UDK sind ja leider binär codiert, (nur die für mobile Geräte gedachten ES2 Shader sind offern) kommt man da anderweitig dran?

Gast
2011-07-29, 10:18:16
Sind denn die Mods hier alle im Urlaub oder schaut man dem uninteressanten Titel wegen hier nicht rein, ein anpassen kann ja so schwierig nicht sein.

DrFreaK666
2011-07-29, 11:51:51
Anmelden und Mod anschreiben hilft ^^

Gast
2011-07-29, 14:13:49
Anmelden und Mod anschreiben hilft ^^


Arrrrgh ;D

Crux
2011-07-29, 14:18:42
Anmelden und Mod anschreiben hilft ^^

Nu, zufrieden!? :rolleyes:

Maorga
2011-07-29, 14:32:36
neee :D mach dein eigenen Thread auf :D

Crux
2011-07-29, 14:36:06
neee :D mach dein eigenen Thread auf :D

heeeey, is doch nur ne freundliche Übernahme im Sinne der Sache :tongue: :redface:

Raff
2011-07-29, 15:58:38
Ich habs nochmal kurz überarbeitet, in der ersten Zeile läßt sich jetzt das Preset auswählen:

// Choose the quality preset.
// This needs to be compiled into the shader as it effects code.
// Best option to include multiple presets is to
// in each shader define the preset, then include this file.
//
// OPTIONS
// -----------------------------------------------------------------------
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
// 39 - no dither, very expensive
//
// NOTES
// -----------------------------------------------------------------------
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
// 13 = about same speed as FXAA 3.9 and better than 12
// 23 = closest to FXAA 3.9 visually and performance wise
// _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style
//

Liest sich alles geil, aber ich sehe NULL Unterschied. ;( Ihr etwa?

MfG,
Raff

Ronny145
2011-07-29, 16:02:00
Könnte man FXAA in jedem Spiel zum Laufen bekommen? Wäre interessant wie das in Arcania aussieht im Vergleich mit MLAA, weil da kein AA greift.

Tesseract
2011-07-29, 17:31:13
Sind denn die Mods hier alle im Urlaub oder schaut man dem uninteressanten Titel wegen hier nicht rein, ein anpassen kann ja so schwierig nicht sein.

auf was anpassen? wenn ihr in richtung shaderreplacement weiterdiskutieren wollt kann ich den thread aufsplitten oder ihr macht einen neuen auf, aber bisher war der übergang eher fließend.
und ja, ich bin momentan mehr oder weniger auf semi-urlaub. :D

Crux
2011-07-29, 19:29:17
Könnte man FXAA in jedem Spiel zum Laufen bekommen? Wäre interessant wie das in Arcania aussieht im Vergleich mit MLAA, weil da kein AA greift.

Jein, letztlich müsste man vermutlich im Rahmen der Möglichkeiten des Shaders Anpassungen vornehmen, vermutlich wird es Nvidia daher auf preset Basis irgendwann einführen, soll heißen wie mit SAO alle paar Treiber ein Satz neuer presets für gerade beliebtes Spielematerial.

Vielversprechender ist es vermutlich das selbst zu machen (eben auch da man beliebig oft nachjustieren/ anpassen/ feilen/ aktualisieren kann), zumal Nvidia ja nicht zu potte kommt was die treiberseitige-integration angeht.

Da geht es prinziepiell erstmal da wo Shader offen zugänglich sind (hab ich etwas ausführlicher als Gast auf Seite 3 oder 4 des Threads erklärt). Ansonsten u.U. über externe bzw. zwischengeschaltete Mittel wie enbseries oder ähnlichem.

Kurz gesagt bei vielen Unreal Engine games zum Beipiel ist es wohl erstmal recht günstig machbar, zumal (was viele nicht bemerken zu scheinen) mit bisher erzwungenen AA Methoden manche Effekte verschwinden (vermutlich erwünschte Auswirkungen der Compatibility Bits, auch die ja verschiedene "presets").

Crux
2011-07-29, 19:34:37
auf was anpassen? wenn ihr in richtung shaderreplacement weiterdiskutieren wollt kann ich den thread aufsplitten oder ihr macht einen neuen auf, aber bisher war der übergang eher fließend.
und ja, ich bin momentan mehr oder weniger auf semi-urlaub. :D

Hi, danke für deine Antwort, naja aufsplitten mag ich ja nicht was grade etwas an fahrt gewinnt, glaube das dienst der Sache auch wieder nicht. Würde nur darum bitten den Titel vielleicht anzupassen so das ersichtlich wird das die Eingangsfrage nicht unbedingt den Horizont limitiert und der Thread auch Beachtung findet von Foristen die anhand des Titels und der simplen (nach erstem lesen als schnell gelöst betrachteter) Startfrage bisher keinen Sinn darin sahen sich hier näher umzuschaun.

Dann mal schön weitermachen mit dem semi-urlaub! ;)

EDIT: haha (Tesseract vermute ich?) passt, thx! :D

BeetleatWar1977
2011-07-29, 21:47:49
Liest sich alles geil, aber ich sehe NULL Unterschied. ;( Ihr etwa?

MfG,
Raff
Die Presets sind vorgegeben - nicht meine ;)

Ronny145
2011-07-29, 21:48:01
Ich habs nochmal kurz überarbeitet, in der ersten Zeile läßt sich jetzt das Preset auswählen:

// Choose the quality preset.
// This needs to be compiled into the shader as it effects code.
// Best option to include multiple presets is to
// in each shader define the preset, then include this file.
//
// OPTIONS
// -----------------------------------------------------------------------
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
// 39 - no dither, very expensive
//
// NOTES
// -----------------------------------------------------------------------
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
// 13 = about same speed as FXAA 3.9 and better than 12
// 23 = closest to FXAA 3.9 visually and performance wise
// _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style
//


Also einfach die FXAA.fx ersetzen, das war's?

Crux
2011-07-29, 22:03:55
Also einfach die FXAA.fx ersetzen, das war's?

zum Beispiel, er hat allerdings auch was an den DOF Sachen geändert, also einfach alle default shader mit seinen ersetzen.

Ronny145
2011-07-29, 22:15:47
zum Beispiel, er hat allerdings auch was an den DOF Sachen geändert, also einfach alle default shader mit seinen ersetzen.


Ich brauche nur FXAA. Die FXAA.fx reicht dafür?

BeetleatWar1977
2011-07-29, 22:23:21
Ich brauche nur FXAA. Die FXAA.fx reicht dafür?
sollte

Crux
2011-07-29, 22:24:34
Ich brauche nur FXAA. Die FXAA.fx reicht dafür?

Also es ist nicht so das dein Rechner explodiert (auch wenn ich dafür keine Garantie übernehme, nicht das wir uns im Amiland vor Gericht sehen) wenn es nicht ginge. Backup der Datei machen (etwa einfach ein paar buchstaben hinzufügen oder ne kopie sichern) und ausprobiert :P

Crux
2011-07-29, 22:25:24
sollte

immer diese Berührungsängste =)

Ronny145
2011-07-29, 22:35:24
Die Vergleiche sollen nicht mit anderen Effekten verfälscht werden.

Kein AA
http://www.abload.de/img/noaaqcqw.png

Ingame AA
http://www.abload.de/img/ingameaaqcha.png

Ingame FXAA
http://www.abload.de/img/ingamefxaakdnn.png

Treiber MLAA
http://www.abload.de/img/treibermlaa6eiv.png

Custom FXAA
http://www.abload.de/img/customfxaayeot.png

Was ist denn das für ein furchtbares Ingame AA? Blurfilter?

Crux
2011-07-29, 22:47:35
Custom FXAA
http://www.abload.de/img/customfxaayeot.png

Was ist denn das für ein furchtbares Ingame AA? Blurfilter?

Da ist eben der dither zu stark eingestellt.

Without FXAA's Pixel and Sub-Pixel Contrast Reduction, visually aliasing still remains. With FXAA, aliasing is much reduced and consistent across image features. No post-process AA filter is going to fix everything, there is always a compromise between sharpness and lack of aliasing, but I feel as if FXAA does a good job and has a great quality/cost ratio.

Certainly some developers and users will have different preferences on the aliasing vs softness trade-off. For this FXAA 3.9 Quality algorithm has a tuning knob: FXAA_QUALITY__SUBPIX. The "No Contrast Reduction" images were produced by zeroing this tuning knob.

Die subpixel Contrast Reduction würd ich einfach mal ganz niedrig testen und dann auch mal ganz ausschalten zum Vergleich. Die perfekte Lösung gibbets hier nicht aber FXAA ist dennoch eine sehr gute und allemal besser als MLAA wenn man denn überkritisch sein mag.

Ronny145
2011-07-29, 22:54:52
Ich meinte das Ingame AA nicht das Custom FXAA. Ingame AA wird den Namen nicht gerecht, darunter verstehe ich "echtes" AA was hier offensichtlich nicht der Fall ist.

Crux
2011-07-29, 22:59:49
Ich meinte das Ingame AA nicht das Custom FXAA. Ingame AA wird den Namen nicht gerecht, darunter verstehe ich "echtes" AA was hier offensichtlich nicht der Fall ist.

;D haha ok das ging aber nicht klar aus dem Post hervor, sry :)
JA in dem Fall hast du recht das ist wirklich mehr als mau.

derguru
2011-07-29, 23:00:05
interessant ist eigentlich nur das mlaa besser performt aber dafür schlechter glättet,wahrscheinlich auch erst mit dem previewtreiber.

Crux
2011-07-29, 23:04:00
interessant ist eigentlich nur das mlaa besser performt aber dafür schlechter glättet,wahrscheinlich auch erst mit dem previewtreiber.

Kann man so nicht vergleichen, ist keine statische Szene, Hintergrund Dusche/ bad/ wasserdampf/ licht,... zumal bei dem Qualitätsunterschied, da wird mit MLAA nicht nru schlechter geglättet.

Ronny145
2011-07-29, 23:04:48
;D haha ok das ging aber nicht klar aus dem Post hervor, sry :)
JA in dem Fall hast du recht das ist wirklich mehr als mau.


Es heißt exakt "Ingame AA" im Spiel. FXAA gefällt mir besser als MLAA, weil es weniger blurrt.


interessant ist eigentlich nur das mlaa besser performt aber dafür schlechter glättet,wahrscheinlich auch erst mit dem previewtreiber.

Je nach Winkel. Einige Stellen glätten mit MLAA besser.

Kann man so nicht vergleichen, ist keine statische Szene, Hintergrund Dusche/ bad/ wasserdampf/ licht,... zumal bei dem Qualitätsunterschied, da wird mit MLAA nicht nru schlechter geglättet.

FPS schwanken zwar 2-3 fps, aber das ändert nichts daran. MLAA performt besser (mit 11.8 Preview).

Crux
2011-07-29, 23:08:01
Es heißt exakt "Ingame AA" im Spiel.

Hast recht hatte ich übersehen in deinem Post, mein Fehler :(


FPS schwanken zwar 2-3 fps, aber das ändert nichts daran. MLAA performt besser (mit 11.8 Preview).


Wegen der Performance, wenn man am subpixel nob dreht wird die Performance des FXAA logischerweise auch besser.

Ronny145
2011-07-29, 23:09:36
Performance ist ja nun nicht das Problem. FXAA sieht im Gesamten besser aus, dann darf es auch mehr kosten.

Crux
2011-07-29, 23:14:30
Performance ist ja nun nicht das Problem. FXAA sieht im Gesamten besser aus, dann darf es auch mehr kosten.

Eben sehe ich auch so, nur damit nicht FXAA Vorurteile hier weiter einzementiert werden (allgemein im Forum) da lässt sich sehr viel anpassen, ich bin der Meinung das selbst dieser geringe Performance Unterschied noch gut ausgleichbar ist wenn man den Shader entsprechend anpasst und das ohne sich der geringeren Qualität des MLAA anzunähern. Nur das ist eben auch mit der Grund warum ich vermute das Nvidia hier vermutlich wenn man sich denn mal dazu begibt, mit presets arbeiten wird, der "average joe" soll ja nicht durch ne "Textdatei" wühlen müssen, da kann auch viel zu viel schiefgehen (bedienbarkeit) von daher legen die wahrscheinlich einfach profile an. Die ähnlich wie AA bits auch nicht immer die beste Lösung sein müssen. Wird ja eher unwahrscheinlich sein das hier deren Leute sich tagelang mit dem tweaken der Einstellungen beschäftigen wie wir es (oder eben Timothy Lottes) tun würden, es muss ja irgendwo praktikabel bleiben (und die feinen details bemerken viele eh nicht). Soll heißen wird sich weiterhin lohnen wenn man da selbst ein Auge drauf hat.

BeetleatWar1977
2011-07-29, 23:18:13
Ich meinte das Ingame AA nicht das Custom FXAA. Ingame AA wird den Namen nicht gerecht, darunter verstehe ich "echtes" AA was hier offensichtlich nicht der Fall ist.

Nein ist es auch nicht - läuft auch nur als Shaderbasierter Effekt:

FEMU_OP_DeferredFSAA
{
int TexIndex = ARG(0);
half Alpha = EdgeDetector(In, TexIndex, Sampler[ARG(2)], Sampler[ARG(1)], true, true, Consts[ARG(4)], Consts[ARG(5)]);

if (ARG(6) == 1)
return float4(Alpha,Alpha,Alpha,0);

float2 Offset = In.Tex[TexIndex+0] * (1-Alpha);

//return tex2D(Sampler[ARG(3)], In.Tex[TexIndex+0]); // For testing

half4 s0 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+1] * Alpha);
half4 s1 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+2] * Alpha);
half4 s2 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+3] * Alpha);
half4 s3 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+4] * Alpha);

return float4((s0 + s1 + s2 + s3) / 4.0f);

Berechnet wird der Durchschnitt von 4 Samplepositionen :uup:

Crux
2011-07-29, 23:21:15
Nein ist es auch nicht - läuft auch nur als Shaderbasierter Effekt:

FEMU_OP_DeferredFSAA
{
int TexIndex = ARG(0);
half Alpha = EdgeDetector(In, TexIndex, Sampler[ARG(2)], Sampler[ARG(1)], true, true, Consts[ARG(4)], Consts[ARG(5)]);

if (ARG(6) == 1)
return float4(Alpha,Alpha,Alpha,0);

float2 Offset = In.Tex[TexIndex+0] * (1-Alpha);

//return tex2D(Sampler[ARG(3)], In.Tex[TexIndex+0]); // For testing

half4 s0 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+1] * Alpha);
half4 s1 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+2] * Alpha);
half4 s2 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+3] * Alpha);
half4 s3 = tex2D(Sampler[ARG(3)], Offset + In.Tex[TexIndex+4] * Alpha);

return float4((s0 + s1 + s2 + s3) / 4.0f);

Berechnet wird der Durchschnitt von 4 Samplepositionen :uup:

Aha da haben wir den Schuldigen ;D

Raff
2011-07-29, 23:22:11
Was ist denn das für ein furchtbares Ingame AA? Blurfilter?

Wenn du die Einstellung "FSAA" meinst: ja. Nur. Total sinnlos. Eine Glättung auf "Treppenbasis" ist da nur mit viel Fantasie erkennbar.

MfG,
Raff

Ronny145
2011-07-29, 23:23:26
Wenn du die Einstellung "FSAA" meinst: ja. Nur. Total sinnlos.

MfG,
Raff


In der Demo heißt es "Ingame AA".

Crux
2011-07-29, 23:26:10
In der Demo heißt es "Ingame AA".

:freak: ROFLMAO geil Ronny :D

Crux
2011-07-31, 21:45:56
mmh,... BeetleatWar1977 MIA? :confused: :frown:

BeetleatWar1977
2011-07-31, 22:23:46
mmh,... BeetleatWar1977 MIA? :confused: :frown:
Noch bei der Arbeit - aber bisher keinen Erfolg

Gast
2011-07-31, 22:25:13
Hi, I'm some dude and just wanted to see how fxaa looks on my notebook. But oh noes, I have only two old games and both use d3d9.
So instead of complaining I wrote some code and play those games with fxaa
now. It's faster than with the aa provided by the games.

Proof:
http://www.abload.de/image.php?img=screenshot483wo22.png
http://www.abload.de/image.php?img=screenshot400yp6q.png

Maybe you guys want to see if my code works in other games as well, here is the link:
http://hotfile.com/dl/125526354/ca75942/injectFxaa_by_some_dude.7z.html

Post your experience.
Read the readme for more info. If it doesn't work for you, maybe I can fix it later. The logfile may be helpful.

Blaire
2011-07-31, 23:05:01
Interesting Thank you! I have only a short "Gothic4: Arcania" tested, but it gets an Error-Message.
http://www.abload.de/img/arcaniaok54.jpg

Gast
2011-07-31, 23:20:48
@Blaire What does the log.log file say?
All my old games worked so far {Kings Bounty Armored Princess, Heroes of Might and Magic V - Tribes of the East, Disciples III}.

Blaire
2011-07-31, 23:38:02
The Log file is empty. So far, I haven't tested other Games.

Crux
2011-07-31, 23:56:40
Noch bei der Arbeit - aber bisher keinen Erfolg

Hey, gönn dir auch ne Pause! ;)
Aber klasse das de dran bleibst, evtl. helfen dir ja die Erkenntnisse von "some dude" weiter.

Hab selbst auch noch ein wenig experimentiert allerdings steig ich da leider kaum durch, "some dudes" arbeit schau ich mir morgen erst genauer an. Hast du eigentlich nen programmiertechnischen Hintergrund oder sowas? Wenn nicht aber auch ansonsten Respekt!

- - - - - - - -

@some dude
thx for providing your work on fxaa injection, basically we were (well it's really all User BeetleatWar1977, props to him) trying to figure out how to make it work with games based on an UE3 Engine for starters (partly because of the freely accessible shaders, I brought up the topic because I had noticed some time ago that really most compatibility AA bit modes remove/ disable some ingame effects/ shaders so if FXAA would be useable that wouldn't be an issue anymore and maybe combined with higher res downsampling be almost as "perfect" as it could get).

While I lack the background to do much with it (shader code/ing), it's good some ppl do know a thing or two about it but it also seems to need ppl asking the right questions and/ or getting some attention of those who can actually figure this out, really took me by surprise this potential seemed largely undiscovered/ gone unnoticed, not just on the topic of FXAA but shaders tweaking in general, with so many enthusiast and talented game modders/ devs around. That's kinda my part so far, pushing for it and asking questions for some really smart ppl to figure it out ;)

a few pages back I posted what Timothy Lottes from Nvidia answered to a quick question about FXAA injection, while he kept it short he described a quick and dirty implementation. Not sure if it might be of any use to you as you and BeetleatWar1977 might have already surpassed this from the looks of it but it'd be cool if you'd stay around!

EDIT: Timothy Lottes said...

"might be possible to quickly prototype FXAA in a GL or DX11 game which provides editable shaders. You would need to find a late-in the-frame post processing shader which samples each pixel once, then run FXAA to "sample the pixel" with FXAA_GREEN_AS_LUMA and use in-pixel-shader texture size queries to produce the required inputs to FXAA (so DX9 is likely out). This would NOT be the correct way to integrate FXAA, but might work.

As for your other questions, all I'm going to say for now is that I would not have added the green box: http://forums.steampowered.com/forums/showthread.php?p=22935488 "

DrFreaK666
2011-08-01, 00:06:00
it works with Mass Effect 1. So it should work with the second part too @crux ;)
But it doens´t work on all edges

no FXAA
http://www.abload.de/thumb/0z8z2.jpg (http://www.abload.de/image.php?img=0z8z2.jpg)

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

well, and it works with AA, too

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

4xMSAA+FXAA
http://www.abload.de/thumb/4xmsaafxaa67n9.jpg (http://www.abload.de/image.php?img=4xmsaafxaa67n9.jpg)

Crux
2011-08-01, 00:15:38
it works with Mass Effect 1. So it should work with the second part too @crux ;)
But it doens´t work on all edges

no FXAA
http://www.abload.de/thumb/0z8z2.jpg (http://www.abload.de/image.php?img=0z8z2.jpg)

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

Awesome to hear, as I mentioned before, I tried out Nvidias FXAA on a driver level on ME2 with the .33 driver (not enabled through Nvidia Inspector but through the registry entry, might be a slight difference because Inspector shows two FXAA related settings and I have no idea which combination of those two would actually make it work, but that one registry entry definatley did make it work) BUT with the latest Nvidia driver this driver lvl FXAA doesn't seem to work anymore, at least not that way in ME2, but I also remember Lottes say something along modified iterations/ presets might not work in some scenarios or even might be counterproductive. So who know what nvidia is testing there or has changed and thus it doesn't has to mean much.

Gonna install ME1 tomorrow to give it a try, only have ME2 installed at the moment.

Gast
2011-08-01, 00:17:20
Das macht eh nur Sinn bei Games ohne AA, Mass Effect&Co haben AA Bits.

Crux
2011-08-01, 00:20:33
Das macht eh nur Sinn bei Games ohne AA, Mass Effect&Co haben AA Bits.

bitte genau lesen, AA bits scheinen in fast allen Fällen effekte zu entfernen!! Von daher macht das eben durchaus Sinn.

Gast
2011-08-01, 00:22:48
bitte genau lesen, AA bits scheinen in fast allen Fällen effekte zu entfernen!! Von daher macht das eben durchaus Sinn.

Halt ich für ein Gerücht, gibt es dazu auch Belege?

Crux
2011-08-01, 00:23:00
well, and it works with AA, too

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

4xMSAA+FXAA
http://www.abload.de/thumb/4xmsaafxaa67n9.jpg (http://www.abload.de/image.php?img=4xmsaafxaa67n9.jpg)

Of course it works, but not everywhere and also as mentioned real AA through AA bits at least in some cases removes effects/ disables effect shaders, not sure if that is always intentional (it makes sence to me tho this could be by design for "compatibility" and some missing stuff is apparently too subtile for most to notice anyway).

Crux
2011-08-01, 00:24:29
Halt ich für ein Gerücht, gibt es dazu auch Belege?

Hab ich ein paar Seiten vorher als Gast an einem Beispiel anhand von ME2 genau beschrieben (für jeden nachprüfbar). Und wenn man mal darüber nachdenkt könnte es schon sinn machen das die kombatibiltät-bits eben genau das machen. Mitunter ja auch mit deutlich besserer Performance.

DrFreaK666
2011-08-01, 00:25:21
Of course it works, but not everywhere and also as mentioned real AA through AA bits removes effects/ disables effect shaders, not sure if that is always intentional but most ppl don't seem to notice.

Ja schon klar (wegen den fehlenden Effekten), aber in der readme von dem Tool steht "beta version! directx 9, x86 only! incompatible with any other form of antialiasing!"
Deshalb wollte ich erwähnen, dass es sehr wohl mit MSAA läuft.
Soll ja noch andere Games ausser Mass Effect geben ;)

Obs mit ME2 geht musst jedoch selbst testen

Crux
2011-08-01, 00:31:31
Ja schon klar (wegen den fehlenden Effekten), aber in der readme von dem Tool steht "beta version! directx 9, x86 only! incompatible with any other form of antialiasing!"
Deshalb wollte ich erwähnen, dass es sehr wohl mit MSAA läuft.
Soll ja noch andere Games ausser Mass Effect geben ;)

Obs mit ME2 geht musst jedoch selbst testen

Ah ok, ja hab mir seine Arbeit noch nicht angeschaut, weil ich mir dachte sonst wird das heute nix mehr mit normalem Schlaf xD aber dem scheinen wir uns ja bereits ohnehin anzunähern :freak:

Also ich hab die posting von Lottes studiert, an sich geht das durchaus, ABEr wieder ein aber und zwar kommts eben auch auf die Einstellungen an, gibt ja verschiedene Möglichkeiten das zum laufen zu bringen, der ganze green luma lookup kram und so. Wenn man also ein tool schreibt wie dann wohl hier der fall und für eine bestimmte situation konstruiert, es kann sein das "some dude" das durchaus bewusst so beschreibt, vielleicht weis er dann von einer Situation in der es nicht komplett korrekt läuft oder evtl. für Ärger sorgt, kann ich nicht beurteilen aber da er sich auszukennen scheint wird er seine Gründe haben. Als Entwickler denke ich sagt man sowas aber vielleicht durchaus auch mal wenn eine Entwicklung noch nicht komplett hochoptimiert ist um ein unzureichendes erforschtes anwendungszsenario erstmal auszuklammern. Vielleicht kommt der ja in ME1 auch nicht zum tragen, durchaus möglich.

Man From Atlantis
2011-08-01, 00:33:11
Mass Effect 2
NoAA
http://www.abload.de/thumb/masseffect22011-08-010iqx3.png (http://www.abload.de/image.php?img=masseffect22011-08-010iqx3.png)

FXAA
http://www.abload.de/thumb/masseffect22011-08-010mp6u.png (http://www.abload.de/image.php?img=masseffect22011-08-010mp6u.png)

DrFreaK666
2011-08-01, 00:34:23
Das problem an dem Tool ist, dass es auf das ganze Bild wirkt (also auch auf das HUD (ähnlich AMD´s MLAA)).
Aber immerhin gehts schonmal unter DX9 und nicht nur OpenGL :smile:

Gast
2011-08-01, 00:36:47
Hab ich ein paar Seiten vorher als Gast an einem Beispiel anhand von ME2 genau beschrieben (für jeden nachprüfbar). Und wenn man mal darüber nachdenkt könnte es schon sinn machen das die kombatibiltät-bits eben genau das machen. Mitunter ja auch mit deutlich besserer Performance.

Nein macht keinen Sinn, die Kombatibilitätsbits deaktivieren keine Effekte, sonst wären die auch nicht im Treiber integriert. Das wäre längst aufgeflogen.

Crux
2011-08-01, 00:39:56
Das problem an dem Tool ist, dass es auf das ganze Bild wirkt (also auch auf das HUD (ähnlich AMD´s MLAA)).
Aber immerhin gehts schonmal unter DX9 und nicht nur OpenGL :smile:

Könnte sein das "some dude" das aus kombatibilitätsgründen heraus gemacht hat also um es "auf jeden fall" tendenziell zum laufen zu bringen. So wie ich Timothy Lottes nämlich verstanden habe kommt es um etwa ein Hud/ menüs auszuklammern darauf an das der Shader im postprocessing so ziemlich an letzter Stelle auf jeden pixel eingebracht wird aber eben noch vor bzw. getrennt von dem was für Menüs zuständig ist.

So aber jetzt bin ich mal weg für die Nacht ^^

Logging you out Shepherd.

Crux
2011-08-01, 00:43:11
Nein macht keinen Sinn, die Kombatibilitätsbits deaktivieren keine Effekte, sonst wären die auch nicht im Treiber integriert. Das wäre längst aufgeflogen.

Du musst mir ja nicht glauben und kannst es selbst an meinem Beispiel nachprüfen.

Jetzt aber,.. :wave:

Crux
2011-08-01, 00:45:36
Mass Effect 2
NoAA
http://www.abload.de/thumb/masseffect22011-08-010iqx3.png (http://www.abload.de/image.php?img=masseffect22011-08-010iqx3.png)

FXAA
http://www.abload.de/thumb/masseffect22011-08-010mp6u.png (http://www.abload.de/image.php?img=masseffect22011-08-010mp6u.png)

:eek: haha klasse, sieht ja schonmal vielversprechend aus,... aber jetzt wirklich der Thread wird ja zur echten wach-bleib-falle :biggrin:

Man From Atlantis
2011-08-01, 00:48:37
Metro 2033 @Dx9
NoAA
http://www.abload.de/thumb/metro20332011-08-0101-b1sp.png (http://www.abload.de/image.php?img=metro20332011-08-0101-b1sp.png)

FXAA
http://www.abload.de/thumb/metro20332011-08-0101-z4xa.png (http://www.abload.de/image.php?img=metro20332011-08-0101-z4xa.png)

DrFreaK666
2011-08-01, 00:51:00
Interesting Thank you! I have only a short "Gothic4: Arcania" tested, but it gets an Error-Message.
http://www.abload.de/img/arcaniaok54.jpg

I have the same error-message ;(

Metro 2033 @Dx9
NoAA
http://www.abload.de/thumb/metro20332011-08-0101-b1sp.png (http://www.abload.de/image.php?img=metro20332011-08-0101-b1sp.png)

FXAA
http://www.abload.de/thumb/metro20332011-08-0101-z4xa.png (http://www.abload.de/image.php?img=metro20332011-08-0101-z4xa.png)

FXAA @ Metro doesn´t look good. It´s too blurry

Gast
2011-08-01, 00:53:02
Du musst mir ja nicht glauben und kannst es selbst an meinem Beispiel nachprüfen.


Ein Beispiel...soso...

Crux
2011-08-01, 00:55:39
FXAA @ Metro doesn´t look good. It´s too blurry

arrrgh kann mich nicht losreissen,... yep that's a settings thing and can be optimized, siehe subpixel Contrast Reduction nob usw.,...
tho as Lottes also mentioned Without FXAA's Pixel and Sub-Pixel Contrast Reduction, visually aliasing still remains. With FXAA, aliasing is much reduced and consistent across image features. No post-process AA filter is going to fix everything, there is always a compromise between sharpness and lack of aliasing, but I feel as if FXAA does a good job and has a great quality/cost ratio.

Certainly some developers and users will have different preferences on the aliasing vs softness trade-off. For this FXAA 3.9 Quality algorithm has a tuning knob: FXAA_QUALITY__SUBPIX. The "No Contrast Reduction" images were produced by zeroing this tuning knob.

Man From Atlantis
2011-08-01, 00:59:16
Mafia II
NoAA
http://www.abload.de/thumb/jericho2011-08-0101-55l27a.png (http://www.abload.de/image.php?img=jericho2011-08-0101-55l27a.png)

FXAA
http://www.abload.de/thumb/jericho2011-08-0101-54x2tp.png (http://www.abload.de/image.php?img=jericho2011-08-0101-54x2tp.png)

Mass Effects look good so far.. dont like metro and mafia2 though

DrFreaK666
2011-08-01, 01:00:04
@some dude

FXAA doesn´t work with Duke Nukem Forever.
I wanted to compare his FXAA with yours, but there´s no effect

Sacred 2 crashes

Ronny145
2011-08-01, 01:06:26
GTA4 mit ENB Mod und FXAA III.8.

NoAA
http://www.abload.de/img/noaaa5bi.png
http://www.abload.de/img/noaa9ude.png

MLAA
http://www.abload.de/img/mlaae79f.png
http://www.abload.de/img/mlaatuod.png

FXAA III.8
http://www.abload.de/img/1_0_16_0m7fc.png
http://www.abload.de/img/1_0_16_0qubr.png

DrFreaK666
2011-08-01, 01:13:55
GTA4 mit ENB Mod und FXAA III.8.

NoAA
http://www.abload.de/img/noaaa5bi.png
http://www.abload.de/img/noaa9ude.png

MLAA
http://www.abload.de/img/mlaae79f.png
http://www.abload.de/img/mlaatuod.png

FXAA III.8
http://www.abload.de/img/1_0_16_0m7fc.png
http://www.abload.de/img/1_0_16_0qubr.png

Es ist das FXAA vom Tool des Gastes oder das FXAA per effect.txt?

Gast
2011-08-01, 01:13:56
Some dude has news for you:
http://hotfile.com/dl/125536139/f1f817d/injectFxaa_by_some_dude_2.7z.html

Minor changes fixed {CivilizationV}, maybe more. Let's see if it fixes other games.

Man From Atlantis
2011-08-01, 01:16:00
Dirt 2
NoAA
http://www.abload.de/thumb/dirt2_game2011-08-0102i754.png (http://www.abload.de/image.php?img=dirt2_game2011-08-0102i754.png)

FXAA
http://www.abload.de/thumb/dirt2_game2011-08-0102w77b.png (http://www.abload.de/image.php?img=dirt2_game2011-08-0102w77b.png)

Ronny145
2011-08-01, 01:21:12
Es ist das FXAA vom Tool des Gastes oder das FXAA per effect.txt?


FXAA mit effect.txt. Die Mod vom Gast wird nicht funktionieren mit der ENB Mod.

Blaire
2011-08-01, 01:21:27
Some dude has news for you:
http://hotfile.com/dl/125536139/f1f817d/injectFxaa_by_some_dude_2.7z.html

Minor changes fixed {CivilizationV}, maybe more. Let's see if it fixes other games.


Gothic: Arcania works with this :), but unfortunately some Blurry.

Man From Atlantis
2011-08-01, 01:25:19
Dirt 3
NoAA
http://www.abload.de/thumb/dirt3_game2011-08-010267lz.png (http://www.abload.de/image.php?img=dirt3_game2011-08-010267lz.png)

FXAA
http://www.abload.de/thumb/dirt3_game2011-08-0102u723.png (http://www.abload.de/image.php?img=dirt3_game2011-08-0102u723.png)

Gast
2011-08-01, 01:37:06
[some dude]
@Man From Atlantis: You seem to have every game ever created, thanks for the great feedback.
@Blaire: Nice, so even more games are compatible after the fix.

I have to admit I'm more of a reverse engineer than a modder, that's why I know only the basics about shader programming. Maybe my shader.fx code can be optimized.
I think, for a good modder it should be possible to examine the render pipeline and apply FXAA before hud, but it would have to be done for each game separetely.

DrFreaK666
2011-08-01, 01:39:03
Gothic: Arcania works with this :), but unfortunately some Blurry.

Kannst du es mal irgendwo anders hochladen??
Hotfile behauptet: "Du bist gerade am Downloaden..
Free User können nur eine Datei gleichzeitig laden.."
Auch ein Neustart brachte keine Veränderung

Danke schonmal

@some dude
Would it be possible to sharp the game and then use FXAA? Perhaps it´s then less blurry

Blaire
2011-08-01, 01:42:20
Hier: http://www.file-upload.net/download-3628548/injectFxaa_by_some_dude_2.7z.html

@Some dude: Thanks also for your Effort!

Ronny145
2011-08-01, 01:43:22
[some dude]
@Blaire: Nice, so even more games are compatible after the fix.


Screenshots are corrupted with delete button.

Man From Atlantis
2011-08-01, 01:54:35
@Some dude, much appreciated.. bfbc2, crysis and mini ninjas (:D) doesnt seem to work though

Gast
2011-08-01, 02:23:04
@Ronny145: This shader.fx could fix the screenshot corruption:
http://hotfile.com/dl/125540123/8888f27/shader.fx.html
You have to try it out.
@Man From Atlantis: Consider that only d3d9 games work right now.
If a game doesn't work more info (created logfile) about it could help me fix it.

DrFreaK666
2011-08-01, 02:25:51
Hier: http://www.file-upload.net/download-3628548/injectFxaa_by_some_dude_2.7z.html

@Some dude: Thanks also for your Effort!

Danke

Sacred 2 works now :smile:

no FXAA
http://www.abload.de/thumb/0iknc.jpg (http://www.abload.de/image.php?img=0iknc.jpg)

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


Arcania-Screenshots

no FXAA
http://www.abload.de/thumb/0n7go.jpg (http://www.abload.de/image.php?img=0n7go.jpg)

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

Ronny145
2011-08-01, 02:54:18
@Ronny145: This shader.fx could fix the screenshot corruption:
http://hotfile.com/dl/125540123/8888f27/shader.fx.html
You have to try it out.


Confirmed, it works finally.



Arcania-Screenshots


0.75, //fxaaQualitySubpix

Für Arcania würde ich empfehlen den Wert auf 0,50 in der shader.fx abzusenken. Es blurrt damit weniger.

DrFreaK666
2011-08-01, 03:14:58
...
0.75, //fxaaQualitySubpix

Für Arcania würde ich empfehlen den Wert auf 0,50 in der shader.fx abzusenken. Es blurrt damit weniger.

THX, aber Arcania habe ich nur installiert um es zu testen. Meiner Meinung nach flimmert es in Bewegung auch nicht weniger als mit MLAA

edison
2011-08-01, 03:51:25
the hook (hotkey?) does not work with company of heroes tov, the log.log file is empty .

Crux
2011-08-01, 07:33:50
kleiner Quicky am morgen vertreibt kummer und Sorgen :redface:

ME2

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

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

FXAA - default sub pixel blur/dither/ contrast reduction - a bit too high in general it seems (but might be more ok-ish in ME2 because it slightly corrects/ reduces the extreme dark spots, some ppl didn't like anyway) but as we know tweakable, gonna test more on that later

explanation again for folks just tuning in and skipping through the thread: Without FXAA's Pixel and Sub-Pixel Contrast Reduction, visually aliasing still remains. With FXAA, aliasing is much reduced and consistent across image features. No post-process AA filter is going to fix everything, there is always a compromise between sharpness and lack of aliasing, but I feel as if FXAA does a good job and has a great quality/cost ratio.

Certainly some developers and users will have different preferences on the aliasing vs softness trade-off. For this FXAA 3.9 Quality algorithm has a tuning knob: FXAA_QUALITY__SUBPIX. The "No Contrast Reduction" images were produced by zeroing this tuning knob.

Mount and Blade Warband cRPG mod

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

http://www.abload.de/thumb/fxaahook_default_sub_crw9x.png (http://www.abload.de/image.php?img=fxaahook_default_sub_crw9x.png)
FXAA - default sub pixel blur/dither/ contrast reduction

Quality same as mentioned above.

OC_Burner
2011-08-01, 08:12:57
In Kombi mit Downsampling genau richtig. Der Unschärfeeffekt tritt deutlich weniger hervor.

Arcania:

1280x720 NoAA
http://www.abload.de/image.php?img=01_arcania_noaa_1280x78d33.png

1280x720 injectFXAA
http://www.abload.de/image.php?img=02_arcania_injectfxaa_gfd1.png

2560x1440@1280x720 NoAA (Downsampling)
http://www.abload.de/image.php?img=03_arcania_noaa_downsa4e80.png

2560x1440@1280x720 injectFXAA (Downsampling)
http://www.abload.de/image.php?img=04_arcania_injectfxaa_bek3.png

dargo@work
2011-08-01, 08:49:38
In Kombi mit Downsampling genau richtig. Der Unschärfeeffekt tritt deutlich weniger hervor.

Arcania:

1280x720 NoAA
http://www.abload.de/image.php?img=01_arcania_noaa_1280x78d33.png

1280x720 injectFXAA
http://www.abload.de/image.php?img=02_arcania_injectfxaa_gfd1.png

2560x1440@1280x720 NoAA (Downsampling)
http://www.abload.de/image.php?img=03_arcania_noaa_downsa4e80.png

2560x1440@1280x720 injectFXAA (Downsampling)
http://www.abload.de/image.php?img=04_arcania_injectfxaa_bek3.png
In der Tat. Die minimale Unschärfe zwischen Bild 3 und 4 fällt kaum auf. Damit könnte ich mich sogar anfreunden. ^^ Du hast allerdings 4x OGSSAA benutzt. Wie sieht das mit 1,5x1,5 SSAA über DS aus? Und vorallem mit deutlich besserer, schärferer Grafik? Könntest du einen Vergleich mit Crysis 1 anstellen?

dargo@work
2011-08-01, 09:15:56
Crysis 2 geht auch, am besten in Full-HD. Sprich 1920x1080 und 2880x1620@1920x1080. Optimal wären Maldos Texturen. Mich würde interessieren inwiefern die hoch aufgelösten Texturen mit FXAA wieder "vernichtet" werden.

Gast
2011-08-01, 15:29:55
[some dude]
I made some minor changes/fixes. Should be more compatible now. Also the shader.fx parameters are slightly changed for a sharper result.
Here is beta 3:
http://hotfile.com/dl/125590302/e5f69ee/injectFxaa_by_some_dude_3.7z.html

Ronny145
2011-08-01, 15:42:08
[some dude]
I made some minor changes/fixes. Should be more compatible now. Also the shader.fx parameters are slightly changed for a sharper result.
Here is beta 3:
http://hotfile.com/dl/125590302/e5f69ee/injectFxaa_by_some_dude_3.7z.html


Even with the same fxaaQualitySubpix value the output looks slightly sharper compared to previous version.

dildo4u
2011-08-01, 15:46:00
Funzt der Hack mit einem Steam GTA4 nicht?(Neuster Patch)

Ronny145
2011-08-01, 17:12:32
Funzt der Hack mit einem Steam GTA4 nicht?(Neuster Patch)

Funktioniert nicht. ENB Mod extra gelöscht. Es gibt auch gar keine Fehlermeldung.

@[some dude]: GTA4 doesn't work, there is no effect. It's not enabled it seems. No fps difference, same aliasing level and no error message.

(GTA4 with Steam)

Gast
2011-08-01, 17:22:18
@Ronny145: Are you sure GTA IV uses DirectX 9? If the log in the beta 3 contains nothing, then DirectX 9 isn't used by the game.

Ronny145
2011-08-01, 17:25:47
@Ronny145: Are you sure GTA IV uses DirectX 9? If the log in the beta 3 contains nothing, then DirectX 9 isn't used by the game.

As far as I know GTA4 is a DX9 game. I'm pretty sure. The log wasn't working for Arcania as well, so I'm not sure if this a good indicator here.

Gast
2011-08-01, 17:39:43
log from GTA 4 gives me this: (FXAA doesn't work)
redirecting CreateDevice
redirecting CreateDevice
redirecting device->Reset

Ronny145
2011-08-01, 17:44:13
Oh I was wrong. Same error messages for me in the log file with GTA4.

Ronny145
2011-08-01, 18:15:30
NoAA
http://www.abload.de/img/noaaycx6.png

MLAA
http://www.abload.de/img/mlaa3dh4.png

FXAA_inject_3
http://www.abload.de/img/fxaa8flo.png


In Bewegung hilft FXAA etwas mehr als MLAA in Arcania. Bei der Vegetation ist natürlich kein Kraut gewachsen, aber ich merke es an anderen Stellen. Zum Beispiel flimmert der Rücken des Helden sichtbar weniger wenn ich in der Position wie im screenshot stehen bleibe. /MLAA verstärkt das Flimmern der Rückentextur im Vergleich zu ohne AA. Das bleibt mit FXAA aus.

Blaire
2011-08-01, 18:53:51
FXAA ist nen Zacken schärfer bei Arcania, sieht man recht deutlich.

Ronny145
2011-08-01, 18:56:19
FXAA ist nen Zacken schärfer bei Arcania, sieht man recht deutlich.


Ja das liegt an Version 3. Lässt sich aber wie gesagt bei Bedarf manuell nachregulieren.

OC_Burner
2011-08-01, 19:15:28
In der Tat. Die minimale Unschärfe zwischen Bild 3 und 4 fällt kaum auf. Damit könnte ich mich sogar anfreunden. ^^ Du hast allerdings 4x OGSSAA benutzt. Wie sieht das mit 1,5x1,5 SSAA über DS aus? Und vorallem mit deutlich besserer, schärferer Grafik? Könntest du einen Vergleich mit Crysis 1 anstellen?Crysis 2 geht auch, am besten in Full-HD. Sprich 1920x1080 und 2880x1620@1920x1080. Optimal wären Maldos Texturen. Mich würde interessieren inwiefern die hoch aufgelösten Texturen mit FXAA wieder "vernichtet" werden.

Crysis 1 und 2 wollen mit injectFXAA nicht starten. Daher gibts jetzt nur 1,5DS Vergleiche mit Witcher2 und Arcania.

Witcher2

1920x1080 NoAA
http://www.abload.de/image.php?img=01_witcher2_noaa_1920xgc5a.png

1920x1080 injectFXAA
http://www.abload.de/image.php?img=02_witcher2_injectfxaa6cj8.png

2880x1620@1920x1080 NoAA (Downsampling)
http://www.abload.de/image.php?img=03_witcher2_noaa_downshf7q.png

2880x1620@1920x1080 injectFXAA (Downsampling)
http://www.abload.de/image.php?img=04_witcher2_injectfxaa0cav.png


ArcaniA

1920x1080 NoAA
http://www.abload.de/image.php?img=05_arcania_noaa_1920x12db2.png

1920x1080 injectFXAA
http://www.abload.de/image.php?img=06_arcania_injectfxaa_0c7k.png

2880x1620@1920x1080 NoAA (Downsampling)
http://www.abload.de/image.php?img=07_arcania_noaa_downsanf5r.png

2880x1620@1920x1080 injectFXAA (Downsampling)
http://www.abload.de/image.php?img=08_arcania_injectfxaa_vek9.png

dargo
2011-08-01, 19:30:34
Vielen Dank @OC_Burner. Ich muss sagen mit 1,5x1,5 SSAA und FXAA bin ich sehr zufrieden. Zumindest was deine beiden Vergleiche angeht. :) Im Vergleich zu 2x2 SSAA spart man sicherlich enorm Leistung. Und die Kantenglättung allgemein sieht mit 1,5x1,5 + FXAA auch noch besser aus.

Crux
2011-08-01, 19:32:38
Good news everyone!

Some more comparison screenshots (of the game Mount and Blade Warband, with cRPG mod) in 1920x1080 resolution of beta3 (only AA disabled and FXAAhook). :wink:

http://www.abload.de/gallery.php?key=84RiiTWU

http://www.abload.de/thumb/screenshot91078jsm.png (http://www.abload.de/image.php?img=screenshot91078jsm.png) http://www.abload.de/thumb/screenshot933758xi.png (http://www.abload.de/image.php?img=screenshot933758xi.png) http://www.abload.de/thumb/screenshot108257873.png (http://www.abload.de/image.php?img=screenshot108257873.png) http://www.abload.de/thumb/screenshot11045cjly.png (http://www.abload.de/image.php?img=screenshot11045cjly.png) http://www.abload.de/thumb/screenshot128133kzo.png (http://www.abload.de/image.php?img=screenshot128133kzo.png) http://www.abload.de/thumb/screenshot13350yjqq.png (http://www.abload.de/image.php?img=screenshot13350yjqq.png) http://www.abload.de/thumb/screenshot143681kvu.png (http://www.abload.de/image.php?img=screenshot143681kvu.png) http://www.abload.de/thumb/screenshot14668yk8z.png (http://www.abload.de/image.php?img=screenshot14668yk8z.png) http://www.abload.de/thumb/screenshot16315v8jh.png (http://www.abload.de/image.php?img=screenshot16315v8jh.png) http://www.abload.de/thumb/screenshot16679ok65.png (http://www.abload.de/image.php?img=screenshot16679ok65.png)

Really loving it, the trade off between smoothness and sharpness seems really good now.

199354
2011-08-01, 19:45:26
I'd really like to use this with Crysis 2 and/or GTA 4 - is there any chance of this?

Crysis 2 just crashes on startup with the FXAA tool, whereas with GTA4 it doesn't actually work.

Crux
2011-08-01, 20:05:58
ME2 in 1920x1080 resolution

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

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

BeetleatWar1977
2011-08-01, 20:19:06
Hey, gönn dir auch ne Pause! ;)
Aber klasse das de dran bleibst, evtl. helfen dir ja die Erkenntnisse von "some dude" weiter.

Hab selbst auch noch ein wenig experimentiert allerdings steig ich da leider kaum durch, "some dudes" arbeit schau ich mir morgen erst genauer an. Hast du eigentlich nen programmiertechnischen Hintergrund oder sowas? Wenn nicht aber auch ansonsten Respekt!


Programmiertechnischer Hintergrund? Keinen (*hust*) - Learning bei doing


Melde gehorsamst - Shift funzt - muss nur noch ein paar Bugs ausbügeln:
hab irgendwie saumäßige Ditherartefakte:

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

Crux
2011-08-01, 20:31:27
Programmiertechnischer Hintergrund? Keinen (*hust*) - Learning bei doing


Melde gehorsamst - Shift funzt - muss nur noch ein paar Bugs ausbügeln:
hab irgendwie saumäßige Ditherartefakte:

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

Haha klasse, gerade dann super und schonmal ne Etappe weiter! ;)

Gast
2011-08-01, 23:53:29
Hi,

Thanks for your efforts. I tried it in Rise of Flight where it would be enormously useful as its a WW1 flightsim and those planes have lots of wires. Unfortunately it crashes when I try it. Log files are empty. Not sure if this helps:

Problem signature:
Problem Event Name: APPCRASH
Application Name: rof.exe
Application Version: 0.0.0.0
Application Timestamp: 4e03296c
Fault Module Name: d3d9.dll
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 4e36a6a0
Exception Code: c0000005
Exception Offset: 0000142c
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt


Also, a quick question; you say 'x86 only'. Do you mean x86 as opposed to X86-64, so only on 32 bit windows? Or only for 32 bit apps? Or the obvious that it wont work on ARM or PowerPC :D.

Crux
2011-08-02, 00:08:31
Also, a quick question; you say 'x86 only'. Do you mean x86 as opposed to X86-64, so only on 32 bit windows? Or only for 32 bit apps? Or the obvious that it wont work on ARM or PowerPC :D.

The hook is a 32 bit library afaik (which runs without any problems inside a 64 Bit host/ OS like eg. Windows 7 64 Bit), so if you'd have a game with alternative/ optional 64 bit files you'd have to use the 32 bit client if you'd want it to work, most games still are 32 bit only and just some few have additional 64 bit client stuff on board right out of the box or later added through some patch so this shouldn't be much of an issue I guess.

More of an "issue" if you will could be that this is so far aimed at DX9 games, haven't tried DX10/11 Games yet, this would be awesome in Bioshock 1.

In any case it's awesome to finally be able to use FXAA in DX9 Games I'm looking forward to see what else might come out of that, thx again "some dude"! :)

Ronny145
2011-08-02, 00:28:04
Call of Juarez - Bound in Blood

NoAA
http://www.abload.de/img/cojbibgame_noaaq86x.png

8xMSAA
http://www.abload.de/img/cojbibgame_8xmsaaxjyx.png

8xSGSSAA (greift nicht überall in dem Spiel)
http://www.abload.de/img/cojbibgame_8xsgssaaz8n6.png

MLAA
http://www.abload.de/img/cojbibgame_mlaahj59.png

FXAA_inject_Beta3
http://www.abload.de/img/cojbibgame_fxaa98ym.png

Crux
2011-08-02, 00:43:03
Problem signature:
Problem Event Name: APPCRASH
Application Name: rof.exe
Application Version: 0.0.0.0
Application Timestamp: 4e03296c
Fault Module Name: d3d9.dll
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 4e36a6a0
Exception Code: c0000005
Exception Offset: 0000142c
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789



That seems to be Microsofts crash report, could you post what the shader inject/ hook log has in it?

edison
2011-08-02, 06:43:13
the log.log file of beta3 with Company of Heroes TOV:

redirecting CreateDevice


it seems the hotkey(insert) does not work in COH ("insert" is used to open map).

Crux
2011-08-02, 11:11:30
the log.log file of beta3 with Company of Heroes TOV:



it seems the hotkey(insert) does not work in COH ("insert" is used to open map).

Have you tried to align that key ingame to something else and then using the key for the hook again?

Gast
2011-08-02, 11:22:26
[some dude]
With my current resources (3 d3d9 games and sdk examples) I cannot figure out how to establish a better compatibility.
However if you know a free game or game demo (max 2GB) which uses directx 9 and doesn't accept my plugin, feel free to tell me. Maybe fixing it will fix other games as well.

Crux
2011-08-02, 11:33:40
[some dude]
With my current resources (3 d3d9 games and sdk examples) I cannot figure out how to establish a better compatibility.
However if you know a free game or game demo (max 2GB) which uses directx 9 and doesn't accept my plugin, feel free to tell me. Maybe fixing it will fix other games as well.

There are a few on Steam, one off the top of my head is Mount and Blade Warband. Might come up with some more later as I'm currently not at home, so can't do any real looking into it at the moment.

edit: oh and there also still is this offer;

http://steampowered.com/nvidia/#
http://steampowered.com/ati_offer1a/

basically you can get some free steam/ source games if you have an ATI or a Nvidia card.

Crux
2011-08-02, 11:53:09
Oh and also there is the completely free Alien Swarm (Source Engine) http://store.steampowered.com/app/630/

Gast
2011-08-02, 11:56:36
[some dude]
Please let me know only of those free games which
-do not work with my tool
-are small in size
-really use directx 9
-are not resource heavy
With my small bandwidth I cannot just download and test random games.

Ronny145
2011-08-02, 11:58:50
Do you have AMD or Nvidia? In case there is a tech demo which doesn't work.

Gast
2011-08-02, 12:42:29
[some dude]
@Ronny145: Nvidia

Ronny145
2011-08-02, 13:51:59
In Dirt 2 I would prefer Beta 2 to be honest. The car looks smoother (yellow roof texture, rear spoiler).

Beta3 (Subpix 0.50)
http://www.abload.de/img/dirt2_gamebeta3furw.png

Beta2 (Subpix 0.50)
http://www.abload.de/img/dirt2_gamebeta2_0508uqb.png

Beta 2 (Subpix 0.35)
http://www.abload.de/img/dirt2_gamebeta2_035iuu9.png

I think it's better with an additional FXAA_GREEN_AS_LUMA string and Subpix 0.50. Slightly more blurred in Arcania, but it's worth it in the other games I tried. Some edges are smoother.

dargo
2011-08-02, 16:13:08
Ich finde dieses FXAA grandios. :up:

Need for Speed - Hot Pursuit.

1920x1080 noAA
http://s7.directupload.net/images/110802/tt7se3el.jpg

1920x1080 injectFXAA
http://s1.directupload.net/images/110802/bjn8fi3g.jpg

2880x1620@1920x1080 noAA
http://s7.directupload.net/images/110802/cvfn62y8.jpg

2880x1620@1920x1080 injektFXAA
http://s7.directupload.net/images/110802/unoen23f.jpg

Der Bildschärfeverlust ist imho minimal. Mir gefällts sehr gut. Falls es jemanden einen Tick zu unscharf sein sollte einfach am TFT die Schärfe eine Stufe höher stellen.

1,5x1,5 SSAA + FXAA ist mein neues Lieblingssetting. =)

Crux
2011-08-02, 18:30:22
After some more testing I found some issues in Mount and Blade Warband; for once there are little "+" marks in the multiplayer menu (that's no biggy tho) the other one is ingame on some maps "jitters" occur which really makes it hard to play with after a while (kinda felt like a headache booster) another warband player reported this as well.

Maybe this helps to get around a download as it is Warband's postfx shader. Also because of the hook solution, do you think this could be likely to be false detected by anti cheat software? Say like punkbuster or Valves VAC
(and as such be bannable)?

////////////////////////////////////////////////////////////////////////////////////
//POST EFFECT SHADERS........

#include "fx_configuration.h"

//#define ENABLE_EDITOR
//#define USE_CHARACTER_SHADOW_MERGE

float4 output_gamma = float4(2.2f, 2.2f, 2.2f, 2.2f); //str_todo: vectorize
float4 output_gamma_inv = float4(1.0f / 2.2f, 1.0f / 2.2f, 1.0f / 2.2f, 1.0f / 2.2f);

static const float3 LUMINANCE_WEIGHTS = float3(0.299f, 0.587f, 0.114f);
static const float min_exposure = 0.15f;
static const float max_exposure = 3.0f;

#pragma warning(disable: 3571) //pow(f,e) warning!

#define ERROR_OUT(c) c = float4(texCoord.x * 10 - floor(texCoord.x * 10) > 0.5, texCoord.y * 10 - floor(texCoord.y * 10) > 0.5, 0, 1)

// use postFX_sampler4 for point sampling
#if defined(USE_FX_STATE_MANAGER) && !defined(USE_DEVICE_TEXTURE_ASSIGN) //else we can use direct device access with sampler indexes...
texture postFX_texture0, postFX_texture1, postFX_texture2, postFX_texture3, postFX_texture4;

//non-srgb samplers
sampler postFX_sampler0 : register(s0) = sampler_state { Texture = postFX_texture0; }; //linear clamp
sampler postFX_sampler1 : register(s1) = sampler_state { Texture = postFX_texture1; }; //linear clamp
sampler postFX_sampler2 : register(s2) = sampler_state { Texture = postFX_texture2; }; //linear clamp
sampler postFX_sampler3 : register(s3) = sampler_state { Texture = postFX_texture3; }; //linear clamp
sampler postFX_sampler4 : register(s4) = sampler_state { Texture = postFX_texture4; }; //linear clamp

#else

#ifdef USE_REGISTERED_SAMPLERS
sampler postFX_sampler0 : register(s0); //linear clamp
sampler postFX_sampler1 : register(s1); //linear clamp
sampler postFX_sampler2 : register(s2); //linear clamp
sampler postFX_sampler3 : register(s3); //linear clamp
sampler postFX_sampler4 : register(s4); //linear clamp
#else
sampler postFX_sampler0 : register(s0) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler1 : register(s1) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler2 : register(s2) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler3 : register(s3) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler4 : register(s4) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
#endif

#endif

static const float BlurPixelWeight[8] = { 0.256, 0.240, 0.144, 0.135, 0.120, 0.065, 0.030, 0.010 };
//static const float BlurPixelWeight[8] = { 0.35537, 0.34185, 0.23821, 0.125861, 0.0813562, 0.04862, 0.025, 0.012552 };
//static const float BlurPixelWeight[8] = { 0.5537, 0.4185, 0.3821, 0.25861, 0.13562, 0.0862, 0.05, 0.02552 };
//static const float BlurPixelWeight[8] = { 0.2537, 0.2185, 0.1821, 0.15861, 0.082, 0.062, 0.03, 0.01552 };

bool showing_ranged_data = false;

float4 g_HalfPixel_ViewportSizeInv;
float g_HDR_frameTime;

float g_DOF_Focus = -0.005;
float g_DOF_Range = 5.19876;

#ifndef PS_2_X
#define PS_2_X ps_2_b
#endif

#ifdef ENABLE_EDITOR
//
//postFX0- x:blurStr, y:exposure, z:range, w:temp
//postFX1- brightness
//postFX2- constrast
//postFX3- saturation

float4 postfx_editor_vector[4];

#undef postfxTonemapOp
#undef postfxParams1
#undef postfxParams2
#undef postfxParams3

#define postfxTonemapOp ( int(postfx_editor_vector[0].x) )
#define postfxParams1 float4(postfx_editor_vector[1].x, postfx_editor_vector[1].y, postfx_editor_vector[1].z, postfx_editor_vector[1].w)
#define postfxParams2 float4(postfx_editor_vector[2].x, postfx_editor_vector[2].y, postfx_editor_vector[2].z, postfx_editor_vector[2].w)
#define postfxParams3 float4(postfx_editor_vector[3].x, postfx_editor_vector[3].y, postfx_editor_vector[3].z, postfx_editor_vector[3].w)

#define RELATIVE_PS_TARGET PS_2_X //we need more instruction_count to edit things dynamically
#else
//COMPILE_TIME_POSTFX_CONSTANTS
// constants are defined from application to reduce inst. #
//--#define postfxTonemapOp ((int)0)
//--#define postfxParams1 (float4(16.0f, 1.0f, 1.0f, 1.0f))
//--#define postfxParams2 (float4( 1.0f, 1.0f, 1.0f, 1.0f))

#define RELATIVE_PS_TARGET ps_2_0
#endif

#define HDRRange (postfxParams1.x)
#define HDRExposureScaler (postfxParams1.y)
#define LuminanceAverageScaler (postfxParams1.z)
#define LuminanceMaxScaler (postfxParams1.w)

#define BrightpassTreshold (postfxParams2.x)
#define BrightpassPostPower (postfxParams2.y)
#define BlurStrenght (postfxParams2.z)
#define BlurAmount (postfxParams2.w)


#define HDRRangeInv (1.0f / HDRRange)

float CalculateWignette(float2 tc) {
tc = tc - 0.5; // [-1/2, 1/2]
return pow(1-dot(tc,tc), 4);
}
float4 radial(sampler2D tex, float2 texcoord, int samples, float startScale = 1.0, float scaleMul = 0.9){
float4 c = 0;
float scale = startScale;
for(int i=0; i<samples; i++) {
float2 uv = ((texcoord-0.5)*scale)+0.5;
float4 s = tex2D(tex, uv);
c += s;
scale *= scaleMul;
}
c /= samples;
return c;
}
float vignette(float2 pos, float inner, float outer){
//float r = length(pos); //orj
float r = dot(pos,pos);
r = 1.0 - smoothstep(inner, outer, r);
return r;
}

float3 tonemapping(const float3 scene_color, const float2 luminanceAvgMax, const int tonemapOp) {

float lum_avg = luminanceAvgMax.x * LuminanceAverageScaler;
float lum_max = luminanceAvgMax.y * LuminanceMaxScaler;

static const float MiddleValue = 0.85f;
//float exposure = 1.4427 / (0.5 + lum_avg);
float exposure = MiddleValue / (0.00001 + lum_avg);
exposure = clamp(exposure*HDRExposureScaler, min_exposure, max_exposure);

float3 scene_color_exposed = scene_color * exposure;

float3 final_color;
{
if( tonemapOp==0 )
{
final_color = scene_color_exposed;
}
else if( tonemapOp==1 )
{
final_color.rgb = 1.0 - exp2(-scene_color_exposed);
}
else if( tonemapOp==2 )
{
final_color = scene_color_exposed / (scene_color_exposed+1);
}
else //if( tonemapOp==3 )
{
float Lp = (exposure / lum_avg) * max(scene_color_exposed.r, max(scene_color_exposed.g, scene_color_exposed.b));
float LmSqr = lum_max; //(lum_max * lum_max) * (lum_max * lum_max);
float toneScalar = ( Lp * ( 1.0f + ( Lp / ( LmSqr ) ) ) ) / ( 1.0f + Lp );

final_color = scene_color_exposed * toneScalar;
}
}

return final_color;
}

/////////////////////////////////////////////////////////////////////////////////////
struct VS_OUT_POSTFX
{
float4 Pos: POSITION;
float2 Tex: TEXCOORD0;
};
VS_OUT_POSTFX vs_main_postFX(float4 pos: POSITION){
VS_OUT_POSTFX Out;

Out.Pos = pos;
Out.Tex = (float2(pos.x, -pos.y) * 0.5f + 0.5f) + g_HalfPixel_ViewportSizeInv.xy;

return Out;
}
VertexShader vs_main_postFX_compiled = compile vs_2_0 vs_main_postFX();

/////////////////////////////////////////////////////////////////////////////////////
float4 ps_main_postFX_Show(float2 texCoord: TEXCOORD0) : COLOR {

float4 color = tex2D(postFX_sampler0, texCoord);

if(showing_ranged_data)
{
color.rgb *= HDRRange;
color.rgb = pow(color.rgb, output_gamma_inv);
}
return color;
}
technique postFX_Show
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_Show();
}
}

/////////////////////////////////////////////////////////////////////////////////////
#ifdef USE_CHARACTER_SHADOW_MERGE


float4 ps_main_postFX_Shadowmap(float2 texCoord: TEXCOORD0) : COLOR {

float original_shadowmap = tex2D(postFX_sampler0, texCoord).r;

float character_shadow = tex2D(postFX_sampler1, texCoord).r;

return min(original_shadowmap, character_shadow);
}
technique shadowmap_updater
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_Shadowmap();
}
}
#endif
/////////////////////////////////////////////////////////////////////////////////////
float4 color_value;

float4 ps_main_postFX_TrueColor(float2 texCoord: TEXCOORD0) : COLOR
{
const bool use_vignette = true;

float4 ret = color_value;
if(use_vignette)
{
ret.a = saturate(ret.a + ret.a * (1.0f - vignette(float2(texCoord.x*2-1, texCoord.y*2-1)*0.5f, 0.015f, 1.25f)) ); //remove blur from center
}
return ret;
}
technique postFX_TrueColor
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_TrueColor();
}
}

/////////////////////////////////////////////////////////////////////////////////////

float4 ps_main_brightPass(uniform const bool with_luminance, float2 inTex: TEXCOORD0 ) : COLOR0 {

float3 color = tex2D( postFX_sampler0, inTex );

//get real-range
color *= HDRRange;

//bright pass
if(with_luminance) //use luminance information to calculate exposure factor to be applied on blur rt
{
float2 lum_avgmax = tex2D( postFX_sampler4, float2(0.5f, 0.5f) ).rg;
//color.rgb = tonemapping(color.rgb, lum_avgmax,0);//get exposed color

static const float MiddleValue = 0.85f;
//float exposure = 1.4427 / (0.5 + lum_avg);
float exposure_factor = MiddleValue / (0.00001 + lum_avgmax.x);
float exposure = 0.85 + exposure_factor * 0.15;
exposure = clamp(exposure*HDRExposureScaler, min_exposure, max_exposure);

color.rgb = color.rgb * exposure;

color.rgb = max(0.0f, color.rgb - BrightpassTreshold);
/*color.rgb = pow(color.rgb, BrightpassPostPower);
*/
float intensity = dot(color.rgb, float3(.5f, .5f, .5f));
float bloom_intensity = pow(intensity, BrightpassPostPower);
color.rgb = color.rgb * ( bloom_intensity/intensity );
}
else
{
color.rgb = max(0.0f, color.rgb - BrightpassTreshold);
color.rgb = pow(color.rgb, BrightpassPostPower);
}

//we use interger format, turn back to normalized range
color *= HDRRangeInv;

return float4(color,1);
}
technique postFX_brightPass
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_brightPass(false);
}
}
technique postFX_brightPass_WithLuminance
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_brightPass(true);
}
}

/////////////////////////////////////////////////////////////////////////////////////

float4 ps_main_blurX( float2 inTex: TEXCOORD0 ) : COLOR0 {

float2 BlurOffsetX = float2(g_HalfPixel_ViewportSizeInv.z,0);
float4 color = 0;

for( int i = 0; i < 8; i++ )
{
color += tex2D( postFX_sampler0, inTex + ( BlurOffsetX * i ) ) * BlurPixelWeight[i];
color += tex2D( postFX_sampler0, inTex - ( BlurOffsetX * i ) ) * BlurPixelWeight[i];
}

return color;
}
float4 ps_main_blurY( float2 inTex: TEXCOORD0 ) : COLOR0 {
float4 color = 0;//tex2D( postFX_sampler0, inTex ) ;

float2 BlurOffsetY = float2(0, g_HalfPixel_ViewportSizeInv.w);

for( int i = 0; i < 8; i++ )
{
color += tex2D( postFX_sampler0, inTex + ( BlurOffsetY * i ) ) * BlurPixelWeight[i];
color += tex2D( postFX_sampler0, inTex - ( BlurOffsetY * i ) ) * BlurPixelWeight[i];
}

return color;
}
technique postFX_blurX
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_blurX();
}
}
technique postFX_blurY
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_blurY();
}
}

/////////////////////////////////////////////////////////////////////////////////////
//initial luminance calculation step
float4 ps_main_postFX_Average(float2 texCoord: TEXCOORD0) : COLOR {

static const float Offsets[4] = {-1.5f, -0.5f, 0.5f, 1.5f};

float _max = 0;
float _log_sum = 0;

for (int x = 0; x < 4; x++)
{
for (int y = 0; y < 4; y++)
{
float2 vOffset = float2(Offsets[x], Offsets[y]) * float2(g_HalfPixel_ViewportSizeInv.y, g_HalfPixel_ViewportSizeInv.w);
float3 color_here = tex2D(postFX_sampler0, texCoord + vOffset).rgb;
float lum_here = dot(color_here * HDRRange, LUMINANCE_WEIGHTS);

_log_sum += /*log*/(lum_here/*+ 0.0000001f*/);
_max = max(_max, lum_here);
}
}

return float4(_log_sum / 16, _max, 0, 1);
}
technique postFX_Average
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile PS_2_X ps_main_postFX_Average();
}
}

float4 ps_main_postFX_AverageAvgMax(float2 texCoord: TEXCOORD0, uniform const bool smooth) : COLOR {

static const float Offsets[4] = {-1.5f, -0.5f, 0.5f, 1.5f};

float _max = 0;
float _sum = 0;

//downsample and find avg-max luminance
for (int x = 0; x < 4; x++)
{
for (int y = 0; y < 4; y++)
{
float2 vOffset = float2(Offsets[x], Offsets[y]) * float2(g_HalfPixel_ViewportSizeInv.y, g_HalfPixel_ViewportSizeInv.w);
float2 lumAvgMax_here = tex2D(postFX_sampler0, texCoord + vOffset).rg;

_sum += lumAvgMax_here.r * lumAvgMax_here.r;
_max = max(_max, lumAvgMax_here.g);
}
}
float _avg = _sum / 16;

float4 new_ret = float4(sqrt(_avg), _max, 0, 1);

if(smooth)
{
//last step, finish average luminance calculation
new_ret.r = /*exp*/(new_ret.r);

float2 prev_avgmax = tex2D(postFX_sampler4, float2(0.5f, 0.5f)).rg;

//new_ret.xy = lerp(prev_avgmax, new_ret, /*1.0f); //*/g_HDR_frameTime );/***/
new_ret.x = lerp(prev_avgmax.x, new_ret.x, g_HDR_frameTime );
new_ret.y = max(0.1f, lerp(prev_avgmax.y, new_ret.y, g_HDR_frameTime ) );
}

return new_ret;
}
technique postFX_AverageAvgMax
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile PS_2_X ps_main_postFX_AverageAvgMax(false);
}
}
technique postFX_AverageAvgMax_Smooth
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile PS_2_X ps_main_postFX_AverageAvgMax(true);
}
}

/////////////////////////////////////////////////////////////////////////////////////
struct VsOut_Convert_FP2I
{
float4 Pos: POSITION;
float2 texCoord0: TEXCOORD0;
float2 texCoord1: TEXCOORD1;
float2 texCoord2: TEXCOORD2;
float2 texCoord3: TEXCOORD3;
};
VsOut_Convert_FP2I vs_main_postFX_Convert_FP2I(float4 pos: POSITION){
VsOut_Convert_FP2I Out;

Out.Pos = pos;

// Texture coordinates
float2 texCoord = (float2(pos.x, -pos.y) * 0.5f + 0.5f) + g_HalfPixel_ViewportSizeInv.xy;

Out.texCoord0 = texCoord + float2(-1.0, 1.0) * g_HalfPixel_ViewportSizeInv.xy;
Out.texCoord1 = texCoord + float2( 1.0, 1.0) * g_HalfPixel_ViewportSizeInv.xy;
Out.texCoord2 = texCoord + float2( 1.0, -1.0) * g_HalfPixel_ViewportSizeInv.xy;
Out.texCoord3 = texCoord + float2(-1.0, -1.0) * g_HalfPixel_ViewportSizeInv.xy;

return Out;
}
float4 ps_main_postFX_Convert_FP2I(float2 texCoord0: TEXCOORD0, float2 texCoord1: TEXCOORD1, float2 texCoord2: TEXCOORD2, float2 texCoord3: TEXCOORD3) : COLOR0 {

float3 rt;

#define gamma_corrected_input
#ifdef gamma_corrected_input
rt = tex2D(postFX_sampler4, texCoord0).rgb;
rt += tex2D(postFX_sampler4, texCoord1).rgb;
rt += tex2D(postFX_sampler4, texCoord2).rgb;
rt += tex2D(postFX_sampler4, texCoord3).rgb;
#else

rt = pow(tex2D(postFX_sampler4, texCoord0).rgb, output_gamma);
rt += pow(tex2D(postFX_sampler4, texCoord1).rgb, output_gamma);
rt += pow(tex2D(postFX_sampler4, texCoord2).rgb, output_gamma);
rt += pow(tex2D(postFX_sampler4, texCoord3).rgb, output_gamma);
#endif
rt *= 0.25;
//rt = BrightPass(rt);
rt *= HDRRangeInv;

return float4(rt.rgb,1);
}
technique postFX_Convert_FP2I
{
pass P0
{
VertexShader = compile vs_2_0 vs_main_postFX_Convert_FP2I();
PixelShader = compile ps_2_0 ps_main_postFX_Convert_FP2I();
}
}

/////////////////////////////////////////////////////////////////////////////////////
float4 ps_main_postFX_DofBlur(uniform const bool using_hdr, uniform const bool using_depth, float2 texCoord: TEXCOORD0) : COLOR {

float3 sample_start = tex2D(postFX_sampler0, texCoord).rgb;
float depth_start;
if(using_depth)
{
depth_start = tex2D(postFX_sampler1, texCoord).rgb;
}

static const int SAMPLE_COUNT = 8;
static const float2 offsets[SAMPLE_COUNT] = {
-1, -1,
0, -1,
1, -1,
-1, 0,
1, 0,
-1, 1,
0, 1,
1, 1,
};

float sampleDist = g_HalfPixel_ViewportSizeInv.x * 3.14f;
float3 sample = sample_start;

for (int i = 0; i < SAMPLE_COUNT; i++) {

float2 sample_pos = texCoord + sampleDist * offsets[i];

// !using_hdr -> non-lineer gamma!
float3 sample_here;
if(using_depth) {
float depth_here = tex2D(postFX_sampler1, sample_pos).r;
if(depth_here < depth_start)
{
sample_here = sample_start;
}
else {
sample_here = tex2D(postFX_sampler0, sample_pos).rgb;
}
}
else {
sample_here = tex2D(postFX_sampler0, sample_pos).rgb;
}

sample += sample_here;
}

sample /= SAMPLE_COUNT+1;

//sample.rgb = pow(sample, input_gamma);
//sample.rgb = pow(sample.rgb, output_gamma_inv);


//return pow(tex2D(postFX_sampler0, texCoord), input_gamma);
return float4(sample.rgb, 1);
}
technique postFX_DofBlurHDR
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(true, false);
}
}
technique postFX_DofBlurLDR
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(false, false);
}
}
technique postFX_DofBlurHDR_Depth
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(true, true);
}
}
technique postFX_DofBlurLDR_Depth
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(false, true);
}
}

/////////////////////////////////////////////////////////////////////////////////////

float4 FinalScenePassPS(uniform const bool use_dof, uniform const int use_hdr, uniform const bool use_auto_exp, float2 texCoord: TEXCOORD0) : COLOR {

// Sample the scene
float4 scene = tex2D(postFX_sampler0, texCoord);
scene.rgb = pow(scene.rgb, output_gamma);


#ifndef ENABLE_EDITOR //we disable dof in editor mode so that we can fit in ps 2.0
if(use_dof) {
float pixelDepth = tex2D(postFX_sampler4, texCoord).r;

float focus_factor01 = abs(g_DOF_Focus - pixelDepth);

// static const bool use_depthRT_focus = false;
// if(use_depthRT_focus) {
// focus_factor01 = tex2D(postFX_samplerX, texCoord).r;
// }

float lerp_factor = min(saturate(g_DOF_Range * focus_factor01), 0.62);
//float lerp_factor = saturate(5 * focus_factor01);


static const bool use_wignette = true;
if(use_wignette) {
lerp_factor *= 1 - vignette(float2(texCoord.x*2-1, texCoord.y-0.6), 0.015, 0.5); //remove blur from center
}

float4 dofColor = tex2D(postFX_sampler3, texCoord);
if(use_hdr) {
dofColor *= HDRRange;
}
dofColor.rgb = pow(dofColor.rgb, output_gamma);

scene = lerp(scene, dofColor, lerp_factor);
}
#endif

float4 color, blur;

if(use_hdr > 0) {
blur = tex2D(postFX_sampler1, texCoord);
blur.rgb = pow(blur.rgb, BlurStrenght);

blur.rgb *= HDRRange;

float2 luminanceAvgMax;
if(use_auto_exp) {
luminanceAvgMax = tex2D(postFX_sampler2, float2(0.5f, 0.5f)).rg;
}
else {
luminanceAvgMax = float2(0.5, 10.2);
}

// tonemap..
color = scene;

color += blur * BlurAmount;
color.rgb = tonemapping(color.rgb, luminanceAvgMax, postfxTonemapOp);
}
else {
color = scene;
}

//gamma correction
color.rgb = pow(color.rgb, output_gamma_inv);


////////////////////
//--float2 luminanceAvgMax = tex2D(postFX_sampler2, float2(0.5f, 0.5f)).rg;
//--return tex2D(postFX_sampler2, texCoord).y * 100;

return color;
}

//postFX_final_[dof]_[hdr_quality]_[auto_exposure]
technique postFX_final_0_0_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( false, 0, false); } }
technique postFX_final_0_1_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( false, 1, false); } }
technique postFX_final_0_2_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( false, 2, false); } }
technique postFX_final_0_1_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( false, 1, true); } }
technique postFX_final_0_2_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( false, 2, true); } }
technique postFX_final_1_0_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( true, 0, false); } }
technique postFX_final_1_1_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( true, 1, false); } }
technique postFX_final_1_2_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( true, 2, false); } }
technique postFX_final_1_1_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( true, 1, true); } }
technique postFX_final_1_2_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( true, 2, true); } }


//Recycle Bin:

EDIT: another warband file u would probably need "fx_configuration.h";


#define USE_NEW_TREE_SYSTEM

#define FLORA_DETAIL_FADE_MUL (3.0f / 4.0f)

//#define USE_DEVICE_TEXTURE_ASSIGN
#define USE_FX_STATE_MANAGER
//#define USE_SHADER_CONSTANT_MANAGER

//#define USE_LIGHTING_PASS
#ifdef USE_LIGHTING_PASS
#define USE_SEQUENTIAL_LIGHTING_CALLS
#define MAX_LIGHTS_PER_PASS 4
#endif

inline float get_wave_height(const float pos[2], const float coef, const float freq1, const float freq2, const float time)
{
return coef * sin( (pos[0]+pos[1]) * freq1 + time) * cos( (pos[0]-pos[1]) * freq2 + (time+4));;
}


//#define USE_SHARED_DIFFUSE_MAP
#define USE_REGISTERED_SAMPLERS


#ifdef USE_REGISTERED_SAMPLERS

//STR: order is important for performance! (after fx_MeshTextureSampler_Register, all sampler assigned to "diffuse_texture")
#define fx_ReflectionTextureSampler_Register 0
#define fx_EnvTextureSampler_Register 1
#define fx_Diffuse2Sampler_Register 2
#define fx_NormalTextureSampler_Register 3
#define fx_SpecularTextureSampler_Register 4
#define fx_DepthTextureSampler_Register 5
#define fx_CubicTextureSampler_Register 6
#define fx_ShadowmapTextureSampler_Register 7
#define fx_ScreenTextureSampler_Register 8
#define fx_MeshTextureSampler_Register 9
#define fx_ClampedTextureSampler_Register 10
#define fx_FontTextureSampler_Register 11
#define fx_CharacterShadowTextureSampler_Register 12
#define fx_MeshTextureSamplerNoFilter_Register 13
#define fx_DiffuseTextureSamplerNoWrap_Register 14
#define fx_GrassTextureSampler_Register 15


// s# like versions for fx files
#define fx_ReflectionTextureSampler_RegisterS s0
#define fx_EnvTextureSampler_RegisterS s1
#define fx_Diffuse2Sampler_RegisterS s2
#define fx_NormalTextureSampler_RegisterS s3
#define fx_SpecularTextureSampler_RegisterS s4
#define fx_DepthTextureSampler_RegisterS s5
#define fx_CubicTextureSampler_RegisterS s6
#define fx_ShadowmapTextureSampler_RegisterS s7
#define fx_ScreenTextureSampler_RegisterS s8
#define fx_MeshTextureSampler_RegisterS s9
#define fx_ClampedTextureSampler_RegisterS s10
#define fx_FontTextureSampler_RegisterS s11
#define fx_CharacterShadowTextureSampler_RegisterS s12
#define fx_MeshTextureSamplerNoFilter_RegisterS s13
#define fx_DiffuseTextureSamplerNoWrap_RegisterS s14
#define fx_GrassTextureSampler_RegisterS s15

#endif

Anyway if you could elaborate on how for those anti cheat situations or in general to manually implement/ call the FXAA shader without a dll hook/ injection where shaders are freely accessible/ editable it would be much appreciated!

edit: also 2 guys from the guru3d forums are insisting the hook causes "gamma" issues in Unreal Engine Games (but at the same time state they don't like the engine in general), haven't had that so far so not sure what to make of it, one of em later wants to post some screenshots. So we'll see I guess.

Ronny145
2011-08-02, 18:55:33
[some dude]
Please let me know only of those free games which
-do not work with my tool
-are small in size
-really use directx 9
-are not resource heavy
With my small bandwidth I cannot just download and test random games.

James Bond: Quantum of Solace doesn't work, not activated. PC Demo is here: http://www.gamershell.com/download_33818.shtml

Directx9.0c according to game Readme. The same with Call of Duty 4 Modern Warfare (same engine and game designer afaik).

Log file:

redirecting CreateDevice

edison
2011-08-02, 20:29:33
Have you tried to align that key ingame to something else and then using the key for the hook again?

AFAIK, the game(COH) does not allow user to set hotkeys .;(

Gast
2011-08-02, 21:18:41
[some dude]
@Ronny145: Thank you very much. This is exacly the kind of support I wanted to get.
Care for some results?
http://hotfile.com/dl/125708973/1b83285/injectFxaa_by_some_dude_4.7z.html
Works with {James Bond: Quantum of Solace} and maybe more games now.

Ronny145
2011-08-02, 22:17:01
[some dude]
@Ronny145: Thank you very much. This is exacly the kind of support I wanted to get.
Care for some results?
http://hotfile.com/dl/125708973/1b83285/injectFxaa_by_some_dude_4.7z.html
Works with {James Bond: Quantum of Solace} and maybe more games now.


Confirmed to work with Quantum of Solace and Modern Warfare now. FXAA seems to be enabled with GTA4 now...with some issues. When I start the menu screen gives a black screen. Bigger issue is the lighting.

NoAA
http://www.abload.de/img/gtaivnoaadodz.png

FXAA_Beta4
http://www.abload.de/img/gtaivbeta4tq4u.png

[Some chick]
2011-08-03, 01:51:29
Hi [Some Dude] You should really set up your own website so we can keep informed better on any updates you do to your anti aliasing program. You really deserve more recognition than what your getting at the moment. Thanks for reading and removing the jagged edges from my favourite games.

Jerry Lynn
2011-08-03, 02:35:24
Very good work! Looking forward to any compatibility improvements, I wish it would work with Valve games (tried it with Portal 1 & 2 and TF2). Keep it up!

QUERSCHLÄGER
2011-08-03, 05:30:16
Bin sehr interessiert für HP2010, wo ne Seite zuvor ja Bilder als funktionierend gepostet wurden.

Könnte mir jemand in drei Sätzen beschreiben, wie es letztendlich zu aktivieren ist? Oder kurz auf die Beitrags-Nr. verweisen, in der das A und O drinsteht? Danke.

dargo@work
2011-08-03, 06:47:26
Bin sehr interessiert für HP2010, wo ne Seite zuvor ja Bilder als funktionierend gepostet wurden.

Könnte mir jemand in drei Sätzen beschreiben, wie es letztendlich zu aktivieren ist? Oder kurz auf die Beitrags-Nr. verweisen, in der das A und O drinsteht? Danke.
Downloaden und ins Installationsverzeichnis entpacken (da wo die Exe liegt):
http://www.forum-3dcenter.org/vbulletin/showpost.php?p=8863043&postcount=165

Mit der Einfügen-Taste kannst du dann Ingame zwischen injectFXAA und noAA umschalten.

Gast
2011-08-03, 08:47:44
Hey thx for efforts, but what about this bug report? You don't like her Support? But i has Same Bug :(


After some more testing I found some issues in Mount and Blade Warband; for once there are little "+" marks in the multiplayer menu (that's no biggy tho) the other one is ingame on some maps "jitters" occur which really makes it hard to play with after a while (kinda felt like a headache booster) another warband player reported this as well.

Maybe this helps to get around a download as it is Warband's postfx shader. Also because of the hook solution, do you think this could be likely to be false detected by anti cheat software? Say like punkbuster or Valves VAC
(and as such be bannable)?

////////////////////////////////////////////////////////////////////////////////////
//POST EFFECT SHADERS........

#include "fx_configuration.h"

//#define ENABLE_EDITOR
//#define USE_CHARACTER_SHADOW_MERGE

float4 output_gamma = float4(2.2f, 2.2f, 2.2f, 2.2f); //str_todo: vectorize
float4 output_gamma_inv = float4(1.0f / 2.2f, 1.0f / 2.2f, 1.0f / 2.2f, 1.0f / 2.2f);

static const float3 LUMINANCE_WEIGHTS = float3(0.299f, 0.587f, 0.114f);
static const float min_exposure = 0.15f;
static const float max_exposure = 3.0f;

#pragma warning(disable: 3571) //pow(f,e) warning!

#define ERROR_OUT(c) c = float4(texCoord.x * 10 - floor(texCoord.x * 10) > 0.5, texCoord.y * 10 - floor(texCoord.y * 10) > 0.5, 0, 1)

// use postFX_sampler4 for point sampling
#if defined(USE_FX_STATE_MANAGER) && !defined(USE_DEVICE_TEXTURE_ASSIGN) //else we can use direct device access with sampler indexes...
texture postFX_texture0, postFX_texture1, postFX_texture2, postFX_texture3, postFX_texture4;

//non-srgb samplers
sampler postFX_sampler0 : register(s0) = sampler_state { Texture = postFX_texture0; }; //linear clamp
sampler postFX_sampler1 : register(s1) = sampler_state { Texture = postFX_texture1; }; //linear clamp
sampler postFX_sampler2 : register(s2) = sampler_state { Texture = postFX_texture2; }; //linear clamp
sampler postFX_sampler3 : register(s3) = sampler_state { Texture = postFX_texture3; }; //linear clamp
sampler postFX_sampler4 : register(s4) = sampler_state { Texture = postFX_texture4; }; //linear clamp

#else

#ifdef USE_REGISTERED_SAMPLERS
sampler postFX_sampler0 : register(s0); //linear clamp
sampler postFX_sampler1 : register(s1); //linear clamp
sampler postFX_sampler2 : register(s2); //linear clamp
sampler postFX_sampler3 : register(s3); //linear clamp
sampler postFX_sampler4 : register(s4); //linear clamp
#else
sampler postFX_sampler0 : register(s0) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler1 : register(s1) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler2 : register(s2) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler3 : register(s3) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
sampler postFX_sampler4 : register(s4) = sampler_state{ AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; }; //linear clamp
#endif

#endif

static const float BlurPixelWeight[8] = { 0.256, 0.240, 0.144, 0.135, 0.120, 0.065, 0.030, 0.010 };
//static const float BlurPixelWeight[8] = { 0.35537, 0.34185, 0.23821, 0.125861, 0.0813562, 0.04862, 0.025, 0.012552 };
//static const float BlurPixelWeight[8] = { 0.5537, 0.4185, 0.3821, 0.25861, 0.13562, 0.0862, 0.05, 0.02552 };
//static const float BlurPixelWeight[8] = { 0.2537, 0.2185, 0.1821, 0.15861, 0.082, 0.062, 0.03, 0.01552 };

bool showing_ranged_data = false;

float4 g_HalfPixel_ViewportSizeInv;
float g_HDR_frameTime;

float g_DOF_Focus = -0.005;
float g_DOF_Range = 5.19876;

#ifndef PS_2_X
#define PS_2_X ps_2_b
#endif

#ifdef ENABLE_EDITOR
//
//postFX0- x:blurStr, y:exposure, z:range, w:temp
//postFX1- brightness
//postFX2- constrast
//postFX3- saturation

float4 postfx_editor_vector[4];

#undef postfxTonemapOp
#undef postfxParams1
#undef postfxParams2
#undef postfxParams3

#define postfxTonemapOp ( int(postfx_editor_vector[0].x) )
#define postfxParams1 float4(postfx_editor_vector[1].x, postfx_editor_vector[1].y, postfx_editor_vector[1].z, postfx_editor_vector[1].w)
#define postfxParams2 float4(postfx_editor_vector[2].x, postfx_editor_vector[2].y, postfx_editor_vector[2].z, postfx_editor_vector[2].w)
#define postfxParams3 float4(postfx_editor_vector[3].x, postfx_editor_vector[3].y, postfx_editor_vector[3].z, postfx_editor_vector[3].w)

#define RELATIVE_PS_TARGET PS_2_X //we need more instruction_count to edit things dynamically
#else
//COMPILE_TIME_POSTFX_CONSTANTS
// constants are defined from application to reduce inst. #
//--#define postfxTonemapOp ((int)0)
//--#define postfxParams1 (float4(16.0f, 1.0f, 1.0f, 1.0f))
//--#define postfxParams2 (float4( 1.0f, 1.0f, 1.0f, 1.0f))

#define RELATIVE_PS_TARGET ps_2_0
#endif

#define HDRRange (postfxParams1.x)
#define HDRExposureScaler (postfxParams1.y)
#define LuminanceAverageScaler (postfxParams1.z)
#define LuminanceMaxScaler (postfxParams1.w)

#define BrightpassTreshold (postfxParams2.x)
#define BrightpassPostPower (postfxParams2.y)
#define BlurStrenght (postfxParams2.z)
#define BlurAmount (postfxParams2.w)


#define HDRRangeInv (1.0f / HDRRange)

float CalculateWignette(float2 tc) {
tc = tc - 0.5; // [-1/2, 1/2]
return pow(1-dot(tc,tc), 4);
}
float4 radial(sampler2D tex, float2 texcoord, int samples, float startScale = 1.0, float scaleMul = 0.9){
float4 c = 0;
float scale = startScale;
for(int i=0; i<samples; i++) {
float2 uv = ((texcoord-0.5)*scale)+0.5;
float4 s = tex2D(tex, uv);
c += s;
scale *= scaleMul;
}
c /= samples;
return c;
}
float vignette(float2 pos, float inner, float outer){
//float r = length(pos); //orj
float r = dot(pos,pos);
r = 1.0 - smoothstep(inner, outer, r);
return r;
}

float3 tonemapping(const float3 scene_color, const float2 luminanceAvgMax, const int tonemapOp) {

float lum_avg = luminanceAvgMax.x * LuminanceAverageScaler;
float lum_max = luminanceAvgMax.y * LuminanceMaxScaler;

static const float MiddleValue = 0.85f;
//float exposure = 1.4427 / (0.5 + lum_avg);
float exposure = MiddleValue / (0.00001 + lum_avg);
exposure = clamp(exposure*HDRExposureScaler, min_exposure, max_exposure);

float3 scene_color_exposed = scene_color * exposure;

float3 final_color;
{
if( tonemapOp==0 )
{
final_color = scene_color_exposed;
}
else if( tonemapOp==1 )
{
final_color.rgb = 1.0 - exp2(-scene_color_exposed);
}
else if( tonemapOp==2 )
{
final_color = scene_color_exposed / (scene_color_exposed+1);
}
else //if( tonemapOp==3 )
{
float Lp = (exposure / lum_avg) * max(scene_color_exposed.r, max(scene_color_exposed.g, scene_color_exposed.b));
float LmSqr = lum_max; //(lum_max * lum_max) * (lum_max * lum_max);
float toneScalar = ( Lp * ( 1.0f + ( Lp / ( LmSqr ) ) ) ) / ( 1.0f + Lp );

final_color = scene_color_exposed * toneScalar;
}
}

return final_color;
}

/////////////////////////////////////////////////////////////////////////////////////
struct VS_OUT_POSTFX
{
float4 Pos: POSITION;
float2 Tex: TEXCOORD0;
};
VS_OUT_POSTFX vs_main_postFX(float4 pos: POSITION){
VS_OUT_POSTFX Out;

Out.Pos = pos;
Out.Tex = (float2(pos.x, -pos.y) * 0.5f + 0.5f) + g_HalfPixel_ViewportSizeInv.xy;

return Out;
}
VertexShader vs_main_postFX_compiled = compile vs_2_0 vs_main_postFX();

/////////////////////////////////////////////////////////////////////////////////////
float4 ps_main_postFX_Show(float2 texCoord: TEXCOORD0) : COLOR {

float4 color = tex2D(postFX_sampler0, texCoord);

if(showing_ranged_data)
{
color.rgb *= HDRRange;
color.rgb = pow(color.rgb, output_gamma_inv);
}
return color;
}
technique postFX_Show
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_Show();
}
}

/////////////////////////////////////////////////////////////////////////////////////
#ifdef USE_CHARACTER_SHADOW_MERGE


float4 ps_main_postFX_Shadowmap(float2 texCoord: TEXCOORD0) : COLOR {

float original_shadowmap = tex2D(postFX_sampler0, texCoord).r;

float character_shadow = tex2D(postFX_sampler1, texCoord).r;

return min(original_shadowmap, character_shadow);
}
technique shadowmap_updater
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_Shadowmap();
}
}
#endif
/////////////////////////////////////////////////////////////////////////////////////
float4 color_value;

float4 ps_main_postFX_TrueColor(float2 texCoord: TEXCOORD0) : COLOR
{
const bool use_vignette = true;

float4 ret = color_value;
if(use_vignette)
{
ret.a = saturate(ret.a + ret.a * (1.0f - vignette(float2(texCoord.x*2-1, texCoord.y*2-1)*0.5f, 0.015f, 1.25f)) ); //remove blur from center
}
return ret;
}
technique postFX_TrueColor
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_TrueColor();
}
}

/////////////////////////////////////////////////////////////////////////////////////

float4 ps_main_brightPass(uniform const bool with_luminance, float2 inTex: TEXCOORD0 ) : COLOR0 {

float3 color = tex2D( postFX_sampler0, inTex );

//get real-range
color *= HDRRange;

//bright pass
if(with_luminance) //use luminance information to calculate exposure factor to be applied on blur rt
{
float2 lum_avgmax = tex2D( postFX_sampler4, float2(0.5f, 0.5f) ).rg;
//color.rgb = tonemapping(color.rgb, lum_avgmax,0);//get exposed color

static const float MiddleValue = 0.85f;
//float exposure = 1.4427 / (0.5 + lum_avg);
float exposure_factor = MiddleValue / (0.00001 + lum_avgmax.x);
float exposure = 0.85 + exposure_factor * 0.15;
exposure = clamp(exposure*HDRExposureScaler, min_exposure, max_exposure);

color.rgb = color.rgb * exposure;

color.rgb = max(0.0f, color.rgb - BrightpassTreshold);
/*color.rgb = pow(color.rgb, BrightpassPostPower);
*/
float intensity = dot(color.rgb, float3(.5f, .5f, .5f));
float bloom_intensity = pow(intensity, BrightpassPostPower);
color.rgb = color.rgb * ( bloom_intensity/intensity );
}
else
{
color.rgb = max(0.0f, color.rgb - BrightpassTreshold);
color.rgb = pow(color.rgb, BrightpassPostPower);
}

//we use interger format, turn back to normalized range
color *= HDRRangeInv;

return float4(color,1);
}
technique postFX_brightPass
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_brightPass(false);
}
}
technique postFX_brightPass_WithLuminance
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_brightPass(true);
}
}

/////////////////////////////////////////////////////////////////////////////////////

float4 ps_main_blurX( float2 inTex: TEXCOORD0 ) : COLOR0 {

float2 BlurOffsetX = float2(g_HalfPixel_ViewportSizeInv.z,0);
float4 color = 0;

for( int i = 0; i < 8; i++ )
{
color += tex2D( postFX_sampler0, inTex + ( BlurOffsetX * i ) ) * BlurPixelWeight[i];
color += tex2D( postFX_sampler0, inTex - ( BlurOffsetX * i ) ) * BlurPixelWeight[i];
}

return color;
}
float4 ps_main_blurY( float2 inTex: TEXCOORD0 ) : COLOR0 {
float4 color = 0;//tex2D( postFX_sampler0, inTex ) ;

float2 BlurOffsetY = float2(0, g_HalfPixel_ViewportSizeInv.w);

for( int i = 0; i < 8; i++ )
{
color += tex2D( postFX_sampler0, inTex + ( BlurOffsetY * i ) ) * BlurPixelWeight[i];
color += tex2D( postFX_sampler0, inTex - ( BlurOffsetY * i ) ) * BlurPixelWeight[i];
}

return color;
}
technique postFX_blurX
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_blurX();
}
}
technique postFX_blurY
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_blurY();
}
}

/////////////////////////////////////////////////////////////////////////////////////
//initial luminance calculation step
float4 ps_main_postFX_Average(float2 texCoord: TEXCOORD0) : COLOR {

static const float Offsets[4] = {-1.5f, -0.5f, 0.5f, 1.5f};

float _max = 0;
float _log_sum = 0;

for (int x = 0; x < 4; x++)
{
for (int y = 0; y < 4; y++)
{
float2 vOffset = float2(Offsets[x], Offsets[y]) * float2(g_HalfPixel_ViewportSizeInv.y, g_HalfPixel_ViewportSizeInv.w);
float3 color_here = tex2D(postFX_sampler0, texCoord + vOffset).rgb;
float lum_here = dot(color_here * HDRRange, LUMINANCE_WEIGHTS);

_log_sum += /*log*/(lum_here/*+ 0.0000001f*/);
_max = max(_max, lum_here);
}
}

return float4(_log_sum / 16, _max, 0, 1);
}
technique postFX_Average
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile PS_2_X ps_main_postFX_Average();
}
}

float4 ps_main_postFX_AverageAvgMax(float2 texCoord: TEXCOORD0, uniform const bool smooth) : COLOR {

static const float Offsets[4] = {-1.5f, -0.5f, 0.5f, 1.5f};

float _max = 0;
float _sum = 0;

//downsample and find avg-max luminance
for (int x = 0; x < 4; x++)
{
for (int y = 0; y < 4; y++)
{
float2 vOffset = float2(Offsets[x], Offsets[y]) * float2(g_HalfPixel_ViewportSizeInv.y, g_HalfPixel_ViewportSizeInv.w);
float2 lumAvgMax_here = tex2D(postFX_sampler0, texCoord + vOffset).rg;

_sum += lumAvgMax_here.r * lumAvgMax_here.r;
_max = max(_max, lumAvgMax_here.g);
}
}
float _avg = _sum / 16;

float4 new_ret = float4(sqrt(_avg), _max, 0, 1);

if(smooth)
{
//last step, finish average luminance calculation
new_ret.r = /*exp*/(new_ret.r);

float2 prev_avgmax = tex2D(postFX_sampler4, float2(0.5f, 0.5f)).rg;

//new_ret.xy = lerp(prev_avgmax, new_ret, /*1.0f); //*/g_HDR_frameTime );/***/
new_ret.x = lerp(prev_avgmax.x, new_ret.x, g_HDR_frameTime );
new_ret.y = max(0.1f, lerp(prev_avgmax.y, new_ret.y, g_HDR_frameTime ) );
}

return new_ret;
}
technique postFX_AverageAvgMax
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile PS_2_X ps_main_postFX_AverageAvgMax(false);
}
}
technique postFX_AverageAvgMax_Smooth
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile PS_2_X ps_main_postFX_AverageAvgMax(true);
}
}

/////////////////////////////////////////////////////////////////////////////////////
struct VsOut_Convert_FP2I
{
float4 Pos: POSITION;
float2 texCoord0: TEXCOORD0;
float2 texCoord1: TEXCOORD1;
float2 texCoord2: TEXCOORD2;
float2 texCoord3: TEXCOORD3;
};
VsOut_Convert_FP2I vs_main_postFX_Convert_FP2I(float4 pos: POSITION){
VsOut_Convert_FP2I Out;

Out.Pos = pos;

// Texture coordinates
float2 texCoord = (float2(pos.x, -pos.y) * 0.5f + 0.5f) + g_HalfPixel_ViewportSizeInv.xy;

Out.texCoord0 = texCoord + float2(-1.0, 1.0) * g_HalfPixel_ViewportSizeInv.xy;
Out.texCoord1 = texCoord + float2( 1.0, 1.0) * g_HalfPixel_ViewportSizeInv.xy;
Out.texCoord2 = texCoord + float2( 1.0, -1.0) * g_HalfPixel_ViewportSizeInv.xy;
Out.texCoord3 = texCoord + float2(-1.0, -1.0) * g_HalfPixel_ViewportSizeInv.xy;

return Out;
}
float4 ps_main_postFX_Convert_FP2I(float2 texCoord0: TEXCOORD0, float2 texCoord1: TEXCOORD1, float2 texCoord2: TEXCOORD2, float2 texCoord3: TEXCOORD3) : COLOR0 {

float3 rt;

#define gamma_corrected_input
#ifdef gamma_corrected_input
rt = tex2D(postFX_sampler4, texCoord0).rgb;
rt += tex2D(postFX_sampler4, texCoord1).rgb;
rt += tex2D(postFX_sampler4, texCoord2).rgb;
rt += tex2D(postFX_sampler4, texCoord3).rgb;
#else

rt = pow(tex2D(postFX_sampler4, texCoord0).rgb, output_gamma);
rt += pow(tex2D(postFX_sampler4, texCoord1).rgb, output_gamma);
rt += pow(tex2D(postFX_sampler4, texCoord2).rgb, output_gamma);
rt += pow(tex2D(postFX_sampler4, texCoord3).rgb, output_gamma);
#endif
rt *= 0.25;
//rt = BrightPass(rt);
rt *= HDRRangeInv;

return float4(rt.rgb,1);
}
technique postFX_Convert_FP2I
{
pass P0
{
VertexShader = compile vs_2_0 vs_main_postFX_Convert_FP2I();
PixelShader = compile ps_2_0 ps_main_postFX_Convert_FP2I();
}
}

/////////////////////////////////////////////////////////////////////////////////////
float4 ps_main_postFX_DofBlur(uniform const bool using_hdr, uniform const bool using_depth, float2 texCoord: TEXCOORD0) : COLOR {

float3 sample_start = tex2D(postFX_sampler0, texCoord).rgb;
float depth_start;
if(using_depth)
{
depth_start = tex2D(postFX_sampler1, texCoord).rgb;
}

static const int SAMPLE_COUNT = 8;
static const float2 offsets[SAMPLE_COUNT] = {
-1, -1,
0, -1,
1, -1,
-1, 0,
1, 0,
-1, 1,
0, 1,
1, 1,
};

float sampleDist = g_HalfPixel_ViewportSizeInv.x * 3.14f;
float3 sample = sample_start;

for (int i = 0; i < SAMPLE_COUNT; i++) {

float2 sample_pos = texCoord + sampleDist * offsets[i];

// !using_hdr -> non-lineer gamma!
float3 sample_here;
if(using_depth) {
float depth_here = tex2D(postFX_sampler1, sample_pos).r;
if(depth_here < depth_start)
{
sample_here = sample_start;
}
else {
sample_here = tex2D(postFX_sampler0, sample_pos).rgb;
}
}
else {
sample_here = tex2D(postFX_sampler0, sample_pos).rgb;
}

sample += sample_here;
}

sample /= SAMPLE_COUNT+1;

//sample.rgb = pow(sample, input_gamma);
//sample.rgb = pow(sample.rgb, output_gamma_inv);


//return pow(tex2D(postFX_sampler0, texCoord), input_gamma);
return float4(sample.rgb, 1);
}
technique postFX_DofBlurHDR
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(true, false);
}
}
technique postFX_DofBlurLDR
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(false, false);
}
}
technique postFX_DofBlurHDR_Depth
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(true, true);
}
}
technique postFX_DofBlurLDR_Depth
{
pass P0
{
VertexShader = vs_main_postFX_compiled;
PixelShader = compile ps_2_0 ps_main_postFX_DofBlur(false, true);
}
}

/////////////////////////////////////////////////////////////////////////////////////

float4 FinalScenePassPS(uniform const bool use_dof, uniform const int use_hdr, uniform const bool use_auto_exp, float2 texCoord: TEXCOORD0) : COLOR {

// Sample the scene
float4 scene = tex2D(postFX_sampler0, texCoord);
scene.rgb = pow(scene.rgb, output_gamma);


#ifndef ENABLE_EDITOR //we disable dof in editor mode so that we can fit in ps 2.0
if(use_dof) {
float pixelDepth = tex2D(postFX_sampler4, texCoord).r;

float focus_factor01 = abs(g_DOF_Focus - pixelDepth);

// static const bool use_depthRT_focus = false;
// if(use_depthRT_focus) {
// focus_factor01 = tex2D(postFX_samplerX, texCoord).r;
// }

float lerp_factor = min(saturate(g_DOF_Range * focus_factor01), 0.62);
//float lerp_factor = saturate(5 * focus_factor01);


static const bool use_wignette = true;
if(use_wignette) {
lerp_factor *= 1 - vignette(float2(texCoord.x*2-1, texCoord.y-0.6), 0.015, 0.5); //remove blur from center
}

float4 dofColor = tex2D(postFX_sampler3, texCoord);
if(use_hdr) {
dofColor *= HDRRange;
}
dofColor.rgb = pow(dofColor.rgb, output_gamma);

scene = lerp(scene, dofColor, lerp_factor);
}
#endif

float4 color, blur;

if(use_hdr > 0) {
blur = tex2D(postFX_sampler1, texCoord);
blur.rgb = pow(blur.rgb, BlurStrenght);

blur.rgb *= HDRRange;

float2 luminanceAvgMax;
if(use_auto_exp) {
luminanceAvgMax = tex2D(postFX_sampler2, float2(0.5f, 0.5f)).rg;
}
else {
luminanceAvgMax = float2(0.5, 10.2);
}

// tonemap..
color = scene;

color += blur * BlurAmount;
color.rgb = tonemapping(color.rgb, luminanceAvgMax, postfxTonemapOp);
}
else {
color = scene;
}

//gamma correction
color.rgb = pow(color.rgb, output_gamma_inv);


////////////////////
//--float2 luminanceAvgMax = tex2D(postFX_sampler2, float2(0.5f, 0.5f)).rg;
//--return tex2D(postFX_sampler2, texCoord).y * 100;

return color;
}

//postFX_final_[dof]_[hdr_quality]_[auto_exposure]
technique postFX_final_0_0_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( false, 0, false); } }
technique postFX_final_0_1_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( false, 1, false); } }
technique postFX_final_0_2_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( false, 2, false); } }
technique postFX_final_0_1_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( false, 1, true); } }
technique postFX_final_0_2_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( false, 2, true); } }
technique postFX_final_1_0_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( true, 0, false); } }
technique postFX_final_1_1_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile ps_2_0 FinalScenePassPS( true, 1, false); } }
technique postFX_final_1_2_0{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( true, 2, false); } }
technique postFX_final_1_1_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( true, 1, true); } }
technique postFX_final_1_2_1{ pass P0 { VertexShader = vs_main_postFX_compiled; PixelShader = compile PS_2_X FinalScenePassPS( true, 2, true); } }


//Recycle Bin:

EDIT: another warband file u would probably need "fx_configuration.h";


#define USE_NEW_TREE_SYSTEM

#define FLORA_DETAIL_FADE_MUL (3.0f / 4.0f)

//#define USE_DEVICE_TEXTURE_ASSIGN
#define USE_FX_STATE_MANAGER
//#define USE_SHADER_CONSTANT_MANAGER

//#define USE_LIGHTING_PASS
#ifdef USE_LIGHTING_PASS
#define USE_SEQUENTIAL_LIGHTING_CALLS
#define MAX_LIGHTS_PER_PASS 4
#endif

inline float get_wave_height(const float pos[2], const float coef, const float freq1, const float freq2, const float time)
{
return coef * sin( (pos[0]+pos[1]) * freq1 + time) * cos( (pos[0]-pos[1]) * freq2 + (time+4));;
}


//#define USE_SHARED_DIFFUSE_MAP
#define USE_REGISTERED_SAMPLERS


#ifdef USE_REGISTERED_SAMPLERS

//STR: order is important for performance! (after fx_MeshTextureSampler_Register, all sampler assigned to "diffuse_texture")
#define fx_ReflectionTextureSampler_Register 0
#define fx_EnvTextureSampler_Register 1
#define fx_Diffuse2Sampler_Register 2
#define fx_NormalTextureSampler_Register 3
#define fx_SpecularTextureSampler_Register 4
#define fx_DepthTextureSampler_Register 5
#define fx_CubicTextureSampler_Register 6
#define fx_ShadowmapTextureSampler_Register 7
#define fx_ScreenTextureSampler_Register 8
#define fx_MeshTextureSampler_Register 9
#define fx_ClampedTextureSampler_Register 10
#define fx_FontTextureSampler_Register 11
#define fx_CharacterShadowTextureSampler_Register 12
#define fx_MeshTextureSamplerNoFilter_Register 13
#define fx_DiffuseTextureSamplerNoWrap_Register 14
#define fx_GrassTextureSampler_Register 15


// s# like versions for fx files
#define fx_ReflectionTextureSampler_RegisterS s0
#define fx_EnvTextureSampler_RegisterS s1
#define fx_Diffuse2Sampler_RegisterS s2
#define fx_NormalTextureSampler_RegisterS s3
#define fx_SpecularTextureSampler_RegisterS s4
#define fx_DepthTextureSampler_RegisterS s5
#define fx_CubicTextureSampler_RegisterS s6
#define fx_ShadowmapTextureSampler_RegisterS s7
#define fx_ScreenTextureSampler_RegisterS s8
#define fx_MeshTextureSampler_RegisterS s9
#define fx_ClampedTextureSampler_RegisterS s10
#define fx_FontTextureSampler_RegisterS s11
#define fx_CharacterShadowTextureSampler_RegisterS s12
#define fx_MeshTextureSamplerNoFilter_RegisterS s13
#define fx_DiffuseTextureSamplerNoWrap_RegisterS s14
#define fx_GrassTextureSampler_RegisterS s15

#endif

Anyway if you could elaborate on how for those anti cheat situations or in general to manually implement/ call the FXAA shader without a dll hook/ injection where shaders are freely accessible/ editable it would be much appreciated!

edit: also 2 guys from the guru3d forums are insisting the hook causes "gamma" issues in Unreal Engine Games (but at the same time state they don't like the engine in general), haven't had that so far so not sure what to make of it, one of em later wants to post some screenshots. So we'll see I guess.

QUERSCHLÄGER
2011-08-03, 12:19:23
Downloaden und ins Installationsverzeichnis entpacken.

Guck ich mir an, danke. Letztendlich war DS immer noch besser anzusehen wie erzwungenes AA, daher gebe ich dem hier mal ne Chance.

Gast
2011-08-03, 12:59:17
Just for the information some dude. I've tried Half Life 2 which doesn't work and I read in different forums other Source Engine games doesn't work as well such as Portal 2.

And some other games have some lighting issues. Found it here:

http://forums.steamgames.com/forums/showpost.php?p=24070015&postcount=12


Maybe there is some game you can try out.

QUERSCHLÄGER
2011-08-03, 13:06:11
Ne, leider nicht.

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

Hat wohl was mit dem x86 aus der readme zu tun?! Schade.

dargo@work
2011-08-03, 13:16:58
Mit x86 hat das nichts zu tun. Ich spiele es unter Win7 x64. Probiere eventuell die aktuellste DX-Version zu installieren.

Crux
2011-08-03, 13:21:53
About HL2/ Source engine games, maybe he was a bit too quick with dismissing my feedback/ suggestions/ questions. With that ati/ nvidia steam promo links you can get HL2 deathmatch and portal 1 first slice (basically a few lvl demo of portal 1) or maybe even smaller in download size Half-Life 2: Lost Coast (tho I don't know it's exact file size), all for free and thus at least some start with said engine.

Another bug report: someone is having gamma issues, he posted his screenshots over there:
http://forums.steampowered.com/forums/showpost.php?p=24070015&postcount=12

denjudge
2011-08-03, 13:30:17
The Witcher 2 funktioniert, soweit ich das nach 5 Min. Anspielzeit sagen kann. Das Bild wird leicht dunkler, Fehler sind mir bis jetzt keine aufgefallen.

Gast
2011-08-03, 13:33:52
Great work! Just a question: does this work at all with D3DOverrider (forced triple buffering)? It seems the program overrode D3DOverrider in the games I tried.

Also it seems the gamma settings are wrong in Mirror's Edge.

Gast
2011-08-03, 13:35:11
[some dude]
Good news: I successfully injected FXAA shaders into some d3d10 applications (Unigine Heaven 2.5 DX10 and BioShock 1 Demo).
Proof:

http://www.abload.de/thumb/screenshot17258noaaurpl.png (http://www.abload.de/image.php?img=screenshot17258noaaurpl.png) http://www.abload.de/thumb/screenshot17407fxaappe7.png (http://www.abload.de/image.php?img=screenshot17407fxaappe7.png)
Maybe the method works on more games. Share your experience.
http://hotfile.com/dl/125764390/1cef915/injectFxaa_by_some_dude_5.7z.html

There are also minor changes to the d3d9 method which fix some blackscreens.

Crux
2011-08-03, 14:11:33
[some dude]
Good news: I successfully injected FXAA shaders into some d3d10 applications (Unigine Heaven 2.5 DX10 and BioShock 1 Demo).
Proof:

http://www.abload.de/thumb/screenshot17258noaaurpl.png (http://www.abload.de/image.php?img=screenshot17258noaaurpl.png) http://www.abload.de/thumb/screenshot17407fxaappe7.png (http://www.abload.de/image.php?img=screenshot17407fxaappe7.png)
Maybe the method works on more games. Share your experience.
http://hotfile.com/dl/125764390/1cef915/injectFxaa_by_some_dude_5.7z.html

There are also minor changes to the d3d9 method which fix some blackscreens.

Oh wow that's awesome :eek: freaking out right now but I'm not at home so I can't try it yet :frown:

Always hoped some day I might be able to play Bioshock 1 with some form of working AA in it's intro/ dive scene (whale/ cables under water and such). Thx a bunch!

QUERSCHLÄGER
2011-08-03, 14:31:35
Webinstaller DX hat sich in der Tat 8mb geholt und Spiel läuft jetzt, hat vermutlich wirklich daran gelegen.

Leider ist das Ergebnis etwas ernüchternd bzw. vielleicht auch meine Vorstellungen davon zu hoch, denn gerade Planken usw. sehen gerade in Kurven immer noch sehr sehr mager aus. Muß ich dann wohl eher als Addon zu DS sehen, fxaa alleine macht leider bei dem Spiel kein ruhiges Bild. :)

Gast
2011-08-03, 14:39:14
[some dude]
About Portal 1:
It's tricky, but it can be done with the current release.

First of all, you need to distribute the files from the d3d9 directory in a special way. How? I can't tell you. But basically the d3d9.dll belongs to all the other *.dll files the game loads. DO NOT OVERWRITE ANY EXISTING/SYSTEM FILES.
The shader files are supposed to go to the game executable.
Additionally, Portal seems to refuse any alpha data, so you need to put the line
#define FXAA_GREEN_AS_LUMA 1
at the beginning of shader.fx.

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

Do not use "#define FXAA_GREEN_AS_LUMA 1" for other games since it has lower quality.

Crux
2011-08-03, 14:42:18
[some dude]
About Portal 1:
It's tricky, but it can be done with the current release.

First of all, you need to distribute the files from the d3d9 directory in a special way. How? I can't tell you. But basically the d3d9.dll belongs to all the other *.dll files the game loads. DO NOT OVERWRITE ANY EXISTING/SYSTEM FILES.
The shader files are supposed to go to the game executable.
Additionally, Portal seems to refuse any alpha data, so you need to put the line
#define FXAA_GREEN_AS_LUMA 1
at the beginning of shader.fx.

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

Do not use "#define FXAA_GREEN_AS_LUMA 1" for other games since it has lower quality.

Thx for the info!

A small update from Timothy Lottes on FXAA in general, not sure if it helps any on your work "some dude", probably it's just meant for some general understanding but anyway:

http://timothylottes.blogspot.com/2011/08/note-fxaa-does-not-use-blending.html

Crux
2011-08-03, 14:47:00
Oh and btw, Timothy Lottes called your work awesome!!

Phaid
2011-08-03, 15:27:20
Hello, first of all, thank you SO much for making this wonderful app, Dead Space 2 looks fantastic with FXAA enabled.

Unfortunately, your workaround does not work in Settlers 7 - could you please have a look at it if you have the time? I don't know if it's possible to enable proper AA in this game at all (it uses some in-game, custom, horrid looking AA which can fortunately be disabled, but that means omnipresent jaggies everywhere).
There's a demo version:
http://www.gamershell.com/download_57100.shtml

dargo
2011-08-03, 16:22:22
Webinstaller DX hat sich in der Tat 8mb geholt und Spiel läuft jetzt, hat vermutlich wirklich daran gelegen.

Leider ist das Ergebnis etwas ernüchternd bzw. vielleicht auch meine Vorstellungen davon zu hoch, denn gerade Planken usw. sehen gerade in Kurven immer noch sehr sehr mager aus. Muß ich dann wohl eher als Addon zu DS sehen, fxaa alleine macht leider bei dem Spiel kein ruhiges Bild. :)
Du hast wahrscheinlich zu viel vom FXAA erwartet. FXAA schwächelt immer noch beim Shaderaliasing bei bestimmten Winkeln. Außerdem sehe ich Schwächen in weiter Ferne. Meine Erfahrungen basieren vorerst nur auf Hot Pursuit 2010. Bei Objekten in der Nähe (zb. mein Fahrzeug) leistet FXAA wiederum sehr gute Arbeit. In Bewegung ist das Bild trotz 2880x1620@1920x1080 samt injektFXAA nicht absolut flimmerfrei, und zwar nur in der Ferne. Das habe ich aber auch gar nicht erwartet, das wäre ein absolutes Wunder wenns so billig funktioniert hätte. :D Ich sehe dieses injektFXAA durchaus als eine nette Ergänzung für DS. Als vollständigen Ersatz sehe ich FXAA selbst nicht zu MSAA.

Gast
2011-08-03, 17:07:38
Could you take a look at the Halo demo
It's one of the few games that never worked with AA

Log:
redirecting CreateDevice
redirecting device->Reset
Scrrenshot taken 5503, Multisampling 0
redirecting device->Reset

http://www.gamershell.com/download_3784.shtml

Ronny145
2011-08-03, 17:40:49
Crysis 32Bit SP Demo appcrash/not loading with FXAA. Download: http://www.4players.de/4players.php/download_info/PC-CDROM/Download/46497.html

Crux
2011-08-03, 19:34:46
Bioshock 2 and Lost Planet DX10 are confirmed to be working.

these bugs are still standing tho in beta 5

[...]here are links to the images. These are the only ones I've been able to test and find issues with so far. Dead Space 2 seems to work fine.

Borderlandsmain menu: FXAA off
http://imageshack.us/photo/my-images/155/borderlands1anormal.jpg/
Borderlands main menu: FXAA on
http://imageshack.us/photo/my-images/21/borderlands1bdark.jpg/

Borderlands in game: FXAA off
http://imageshack.us/photo/my-images/714/borderlands2anormal.jpg/
Borderlands in game: FXAA on
http://imageshack.us/photo/my-images/17/borderlands2bdark.jpg/

Transformers: War for Cybertron. The only image I could reliably reproduce was in the brightness setting menu. During the game itself the gamma/brightness seems consistent while playing, the problem arises when a prerendered movie plays, or I go to a menu or pause. Each time the brightness seems to move up or down a step or more on its own when FXAA is enabled.

Transformers: FXAA off
http://imageshack.us/photo/my-images/220/transformers1anomal.jpg/
Transformers: FXAA on
http://imageshack.us/photo/my-images/838/transformers1bdark.png/

The Last Remnant: Same story as Transformers here. Only 1 menu/window reliably shows the problem, but brightness varies randomly.

The Last Remnant: FXAA off
http://imageshack.us/photo/my-images/535/lastremnant1anomal.png/
The Last Remnant: FXAA off
http://imageshack.us/photo/my-images/10/lastremnant1bdark.png/

Hunted: The Demon's Forge: Same issue as Borderlands off is fine, on is mega dark. Although on the second screenshot of the main menu in the game, the screen does not go dark until the mouse has moved and the cursor appears on the screen. Don't know if that helps at all. Other than that, it is completely dark in all menus and in game.

Hunted: The Demon's Forge 1 FXAA off
http://imageshack.us/photo/my-images/12/hunted1anormal.jpg/
Hunted: The Demon's Forge 1 FXAA on
http://imageshack.us/photo/my-images/143/hunted1bdark.png/

Hunted: The Demon's Forge 2 FXAA off
http://imageshack.us/photo/my-images/708/hunted2anormal.jpg
Hunted: The Demon's Forge 2 FXAA on
http://imageshack.us/photo/my-images/853/hunted2bdark.png/

Hunted: The Demon's Forge 3 FXAA off
http://imageshack.us/photo/my-images/847/hunted3anormal.jpg/
Hunted: The Demon's Forge 3 FXAA on
http://imageshack.us/photo/my-images/7/hunted3bdark.png/

Crux
2011-08-03, 19:38:47
The-Last-Remnant-Demo (german) ~ 1 GB
http://www.chip.de/downloads/The-Last-Remnant-Demo_35240434.html

http://www.gamershell.com/download_40086.shtml (english)

Ronny145
2011-08-03, 21:52:39
Hey wer verschiebt den Thread hierhin? Jetzt kann some dude nicht mehr antworten. Danke schön :down:

Crux
2011-08-03, 22:00:10
Jo das ist generell doof da auch Leute international als Gast geschrieben haben, wie auch etwa "some dude" daher fail und essentiell killt das den Thread und vermutlich auch den Ansporn das anderweitig am laufen zu halten der Gast hat nicht umsonst hier gepostet, hat keine Geltungssucht und keine Webseite.

Wenn es auch thematisch, nicht ausschließlich im Nvidia Forum liegen muss, wenn dieses Unterforum hier nur regs zugänglich ist, kann man den Thread vermutlich auch gleich zumachen.

Ronny145
2011-08-03, 22:02:38
Tja so kann man auch ein Thread unnötigerweise kaputt moderieren. So macht der Thread kaum noch Sinn.

Crux
2011-08-03, 22:04:05
Tja so kann man auch ein Thread unnötigerweise kaputt moderieren. So macht der Thread kaum noch Sinn.

Yap gut bürgerlicher Deutscher organisier-zwang-epic-fail. Sind wir nicht alle ein wenig Schildbürger,... :freak: :uclap:

To our international guests just droppin in, unfortunatley the thread, due to some cleverly moderating, has been moved to a different sub-section of the forum, one that so far doesn't allow for guest/ unregistered posts, effectively locking out every international guest from posting, while it doesn't make sence, especially because the hook/ injection dev was posting in here as an international guest as well, that's the situation right now. We hope someone will revert this, but just so that you know what's going on. Update: Situation has been resolved thx to Mod Barracuda! :massa:

@Ronny und andere Member; da ich noch nicht lange hier im Forum angemeldet bin, Frage welcher Mod wäre hier besonders aktiv bzw. zuständig und ist evtl. um die späteren Abendstunden noch online, um möglicherweise diesen Bödsinn zu korrigieren, das kann ja so nicht bleiben, der Thread ist nicht umsonst in kurzer Zeit auf 10.000 views gekommen, nicht zuletzt ja auch wegen der Werbung auf diesen Seiten für den Forenbetreiber sicherlich nicht schlecht, zumal der Behinderung des FXAA hook/ injects für uns Enthusiasten/ Gamer und eben den Entwickler der hier als Gast auftrat den auszuschließen, nicht sehr clever,... Ich bitte Euch Euren entsprechenden Moderator zu kontaktieren.

Edit: ich habe eben mal barracuda angeschrieben weiss aber nicht ob er zuständig wäre.

EditX: thx@ Barracuda für die schnelle und unbürokratische Rettung :)

Gast
2011-08-04, 00:01:04
[some dude]
About Crysis:
After it took forever to download and install Crysis Demo on my very limited machine it took only a few moment to figure out the reason for the crash.
Actually it is working with the current beta (5). However you have to put the *.dll files ("dxgi.dll" worked fine in my case) into the "Bin32" folder and the the shader files into the main directory.

Some useful hints for the current beta:
1) If the "log.log" file is not created then you use the wrong "*.dll" or you put it into the wrong directory.
2) If the "log.log" is created but the game crashes or FXAA is disabled, then you probably put the "*.dll" into the correct directory. Look where the "log.log" is created. Usually the shader files go into that particular directory. (This was the case with Crysis and partially Portal 1).
3) Try to put the files into different directories before saying it doesn't work.

Ronny145
2011-08-04, 00:10:54
[some dude]
About Crysis:
After it took forever to download and install Crysis Demo on my very limited machine it took only a few moment to figure out the reason for the crash.
Actually it is working with the current beta (5). However you have to put the *.dll files ("dxgi.dll" worked fine in my case) into the "Bin32" folder and the the shader files into the main directory.



Ok it can be so easy sometimes. Nice to hear it's already running with it.


Läuft auch mit Intels IGP HD3000.

NoAA
http://www.abload.de/img/farcrynoaabjov.png

inject_FXAA Beta5
http://www.abload.de/img/farcryfxaabeta5jjyn.png

Jerry Lynn
2011-08-04, 01:39:59
log.log for Portal 2:

redirecting CreateDevice
device->GetBackBuffer failed
redirecting CreateDevice
Scrrenshot taken 2398, Multisampling 0

Gast
2011-08-04, 01:57:55
hey, i cant get it to work with torchlight, all it does for me is a line that consists of triangles of varying sizes, showing no AA.
Log says: redirecting CreateDevice
Scrrenshot taken 88, Multisampling 0

Crux
2011-08-04, 02:45:56
Oh happy day! :heart:

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

Gast
2011-08-04, 03:59:08
Just tried Bioshock 2. FXAA is applied, but the game stutters like hell, even if on fraps, the framerate never changes.
Here's what was in the log:
redirecting CreateDXGIFactory
redirecting CreateDXGIFactory
redirecting CreateDXGIFactory
redirecting IDXGIFactory->CreateSwapChain
redirecting IDXGISwapChain->ResizeBuffers

Crux
2011-08-04, 10:08:15
ok I just copypasta this here:


Ok if he wants to save 800 megs worth of downloading he can use the Last Remnant Benchmark tool. This 270ish MB download demonstrates the issue completely, no need for additional dialogues. You can toggle it on and off the whole time the benchmark is running.

http://www.fileplanet.com/196372/190000/fileinfo/The-Last-Remnant---Benchmark-Utility

FINAL EDIT Tested on two computers, my main gaming pc using tri sli gtx 280s, and my old gaming pc which is sli 8800 gtx. Both have the problem using the hook. So if he downloads this demo or the benchmark, he should be able to see the problem. To see it in the demo though, you have to press alt + f4 to get the quit game dialogue box to show up. That is the easiest way to reproduce the issue. But I highly recommend downloading the benchmark rather than the demo for testing.

|_HeLL_|
2011-08-04, 10:38:22
Someone has already ported the FXAA shader to be used in ENBseries. It works in GTA4. That's right, you can have FXAA in GTA4, which has zero support for MSAA.

Screenshots:
http://i272.photobucket.com/albums/jj177/Nerdyg33kzor/GTA4%20Pics/GTAIV2011-07-1706-04-26-34.jpg
http://i272.photobucket.com/albums/jj177/Nerdyg33kzor/GTA4%20Pics/GTAIV2011-07-1622-52-21-86.jpg


This code snippet can be pasted into ENBseries' effect.txt to add the shader effect.
/*============================================================================
FXAA3 QUALITY - PC
NVIDIA FXAA III.8 by TIMOTHY LOTTES
============================================================================*/

#define FXAA_LINEAR 0
#define FXAA_QUALITY__EDGE_THRESHOLD (1.0/16.0)
#define FXAA_QUALITY__EDGE_THRESHOLD_MIN (1.0/16.0)
#define FXAA_QUALITY__SUBPIX_CAP (3.0/4.0)
#define FXAA_QUALITY__SUBPIX_TRIM (1.0/4.0)
#define FXAA_QUALITY__SUBPIX_TRIM_SCALE (1.0/(1.0 - FXAA_QUALITY__SUBPIX_TRIM))
#define FXAA_SEARCH_STEPS 8
#define FXAA_SEARCH_THRESHOLD (1.0/4.0)

float4 FxaaPixelShader(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{

#define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
#define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))

float2 pos = IN.txcoord.xy;

float2 rcpFrame = float2(1/ScreenSize, ScreenScaleY/ScreenSize);
float4 rcpFrameOpt = float4(2/ScreenSize, 2*ScreenScaleY/ScreenSize, 0.5/ScreenSize, 0.5*ScreenScaleY/ScreenSize);

float lumaN = dot(FxaaTexOff(SamplerColor, pos.xy, float2(0, -1), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));
float lumaW = dot(FxaaTexOff(SamplerColor, pos.xy, float2(-1, 0), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));


float4 rgbyM;
rgbyM.xyz = FxaaTexTop(SamplerColor, pos.xy).xyz;
rgbyM.w = dot(rgbyM.xyz, float3(0.299, 0.587, 0.114));
float lumaE = dot(FxaaTexOff(SamplerColor, pos.xy, float2( 1, 0), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));
float lumaS = dot(FxaaTexOff(SamplerColor, pos.xy, float2( 0, 1), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));
float lumaM = rgbyM.w;


float rangeMin = min(lumaM, min(min(lumaN, lumaW), min(lumaS, lumaE)));
float rangeMax = max(lumaM, max(max(lumaN, lumaW), max(lumaS, lumaE)));
float range = rangeMax - rangeMin;

if(range < max(FXAA_QUALITY__EDGE_THRESHOLD_MIN, rangeMax * FXAA_QUALITY__EDGE_THRESHOLD)) return rgbyM;


float lumaNW = dot(FxaaTexOff(SamplerColor, pos.xy, float2(-1,-1), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));
float lumaNE = dot(FxaaTexOff(SamplerColor, pos.xy, float2( 1,-1), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));
float lumaSW = dot(FxaaTexOff(SamplerColor, pos.xy, float2(-1, 1), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));
float lumaSE = dot(FxaaTexOff(SamplerColor, pos.xy, float2( 1, 1), rcpFrame.xy).xyz, float3(0.299, 0.587, 0.114));



float lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;
float rangeL = abs(lumaL - lumaM);
float blendL = saturate((rangeL / range) - FXAA_QUALITY__SUBPIX_TRIM) * FXAA_QUALITY__SUBPIX_TRIM_SCALE;
blendL = min(FXAA_QUALITY__SUBPIX_CAP, blendL);

float edgeVert = abs(lumaNW + (-2.0 * lumaN) + lumaNE) + 2.0 * abs(lumaW + (-2.0 * lumaM) + lumaE ) + abs(lumaSW + (-2.0 * lumaS) + lumaSE);
float edgeHorz = abs(lumaNW + (-2.0 * lumaW) + lumaSW) + 2.0 * abs(lumaN + (-2.0 * lumaM) + lumaS ) + abs(lumaNE + (-2.0 * lumaE) + lumaSE);
bool horzSpan = edgeHorz >= edgeVert;

float lengthSign = horzSpan ? -rcpFrame.y : -rcpFrame.x;
if(!horzSpan) lumaN = lumaW;
if(!horzSpan) lumaS = lumaE;
float gradientN = abs(lumaN - lumaM);
float gradientS = abs(lumaS - lumaM);
lumaN = (lumaN + lumaM) * 0.5;
lumaS = (lumaS + lumaM) * 0.5;

bool pairN = gradientN >= gradientS;
if(!pairN) lumaN = lumaS;
if(!pairN) gradientN = gradientS;
if(!pairN) lengthSign *= -1.0;
float2 posN;
posN.x = pos.x + (horzSpan ? 0.0 : lengthSign * 0.5);
posN.y = pos.y + (horzSpan ? lengthSign * 0.5 : 0.0);


gradientN *= FXAA_SEARCH_THRESHOLD;

float2 posP = posN;
float2 offNP = horzSpan ?
float2(rcpFrame.x, 0.0) :
float2(0.0f, rcpFrame.y);
float lumaEndN;
float lumaEndP;
bool doneN = false;
bool doneP = false;
posN += offNP * (-1.5);
posP += offNP * ( 1.5);
for(int i = 0; i < FXAA_SEARCH_STEPS; i++)
{
lumaEndN = dot(FxaaTexTop(SamplerColor, posN.xy).xyz, float3(0.299, 0.587, 0.114));
lumaEndP = dot(FxaaTexTop(SamplerColor, posP.xy).xyz, float3(0.299, 0.587, 0.114));
bool doneN2 = abs(lumaEndN - lumaN) >= gradientN;
bool doneP2 = abs(lumaEndP - lumaN) >= gradientN;
if(doneN2 && !doneN) posN += offNP;
if(doneP2 && !doneP) posP -= offNP;
if(doneN2 && doneP2) break;
doneN = doneN2;
doneP = doneP2;
if(!doneN) posN -= offNP * 2.0;
if(!doneP) posP += offNP * 2.0;
}

float dstN = horzSpan ? pos.x - posN.x : pos.y - posN.y;
float dstP = horzSpan ? posP.x - pos.x : posP.y - pos.y;

bool directionN = dstN < dstP;
lumaEndN = directionN ? lumaEndN : lumaEndP;

if(((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))
lengthSign = 0.0;

float spanLength = (dstP + dstN);
dstN = directionN ? dstN : dstP;
float subPixelOffset = 0.5 + (dstN * (-1.0/spanLength));
subPixelOffset += blendL * (1.0/8.0);
subPixelOffset *= lengthSign;
float3 rgbF = FxaaTexTop(SamplerColor, float2(pos.x + (horzSpan ? 0.0 : subPixelOffset), pos.y + (horzSpan ? subPixelOffset : 0.0))).xyz;

#if (FXAA_LINEAR == 1)
lumaL *= lumaL;
#endif
float lumaF = dot(rgbF, float3(0.299, 0.587, 0.114)) + (1.0/(65536.0*256.0));
float lumaB = lerp(lumaF, lumaL, blendL);
float scale = min(4.0, lumaB/lumaF);
rgbF *= scale;

return float4(rgbF, lumaM);
}


Greetings to CompuG##K at hardforum for the info :smile:

Ronny145
2011-08-04, 11:44:16
Yes I posted screenshots with this mod some days ago. However FXAA inject standalone has some issues with the lighting.

http://www.forum-3dcenter.org/vbulletin/showpost.php?p=8862382&postcount=144


Intel HD3000 Battlefield 2

NoAA
http://www.abload.de/img/bf2noaa5ru4.png

FXAA Beta5
http://www.abload.de/img/bf2fxaabeta55o01.png

klutob
2011-08-04, 13:16:02
Mit der 5. Version funktioniert FXAA nun auch in Battlefield Bad Company 2. :)

ohne FXAA
http://www.abload.de/thumb/ohnefxaa_ver5guf3.jpg (http://www.abload.de/image.php?img=ohnefxaa_ver5guf3.jpg)
mit FXAA
http://www.abload.de/thumb/mitfxaa_ver59u0l.jpg (http://www.abload.de/image.php?img=mitfxaa_ver59u0l.jpg)

Gast
2011-08-04, 13:27:43
[legacyy]
das neue fxaa ist seit gestern auch in einer modifizierten ICenhancer 1.25 d3d9.dll integriert:

http://www.abload.de/thumb/gtaiv2011-08-0318-13-4sqml.jpg (http://www.abload.de/image.php?img=gtaiv2011-08-0318-13-4sqml.jpg) http://www.abload.de/thumb/gtaiv2011-08-0317-55-3gukg.jpg (http://www.abload.de/image.php?img=gtaiv2011-08-0317-55-3gukg.jpg) http://www.abload.de/thumb/gtaiv2011-08-0321-14-4go7h.jpg (http://www.abload.de/image.php?img=gtaiv2011-08-0321-14-4go7h.jpg) http://www.abload.de/thumb/gtaiv2011-08-0322-50-2hu72.jpg (http://www.abload.de/image.php?img=gtaiv2011-08-0322-50-2hu72.jpg)

Gast
2011-08-04, 13:31:55
[legacyy]
[legacyy]
http://www.abload.de/thumb/gtaiv2011-08-0318-13-4sqml.jpg (http://www.abload.de/image.php?img=gtaiv2011-08-0318-13-4sqml.jpg)
vergleich screen vergessen^^
http://www.abload.de/thumb/gtaiv2011-08-0318-13-3hp3n.jpg (http://www.abload.de/image.php?img=gtaiv2011-08-0318-13-3hp3n.jpg)

Gast
2011-08-04, 14:23:17
[some dude]
Thank you for the info about "The Last Remnant". I fixed the incompatibility and maybe it fixes other games as well.
I also improved d3d10 compatibility a little.

http://hotfile.com/dl/125853856/6607130/injectFxaa_by_some_dude_6.7z.html

I have no DirectX 11 hardware, however I tried to just "blindly" write some code so you guys can test it. Try to use the files from the d3d10 folder with a d3d11 game and just tell me what happens.

Gast
2011-08-04, 15:01:05
Just tested beta 6 with Dragon Age 2 and Dirt 3 (both DX 11), but Dirt 3 doesnt function with it.

Dragon Age 2:

Without FXAA

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


With FXAA

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

Gast
2011-08-04, 15:02:28
Sry...first Picture is with FXAA, the second without...:D

Gast
2011-08-04, 15:18:40
[some dude]
Thank you for the info about "The Last Remnant". I fixed the incompatibility and maybe it fixes other games as well.
I also improved d3d10 compatibility a little.

http://hotfile.com/dl/125853856/6607130/injectFxaa_by_some_dude_6.7z.html

I have no DirectX 11 hardware, however I tried to just "blindly" write some code so you guys can test it. Try to use the files from the d3d10 folder with a d3d11 game and just tell me what happens.
Hey

Have you taken a look at Halo?

Here's the demo download
http://www.gamershell.com/download_3784.shtml

It's weird, the parts between the pixels get kind of smoothed once you activate FXAA but the overall pic is still jaggy.

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

Gast
2011-08-04, 15:25:28
hi i cant run crysis 2 without getting a screen freeze with the directx 10 fxaa

Gast
2011-08-04, 15:51:11
[some dude]
About Halo 1:
It is one of those older games (Like Portal 1) which don't like the alpha channel.
A general workaround (lower quality) for those is to add the line
#define FXAA_GREEN_AS_LUMA 1
at the beginning of shader.fx.

Halo 1 demo screenshots:
http://www.abload.de/thumb/screenshot1689noaaquwm.png (http://www.abload.de/image.php?img=screenshot1689noaaquwm.png) http://www.abload.de/thumb/screenshot1716fxaagu07.png (http://www.abload.de/image.php?img=screenshot1716fxaagu07.png)

Ronny145
2011-08-04, 15:57:53
Dirt 2 @DX11 works with Beta 6. Great. (GTA4 lighting issue remains)

NoAA DX11
http://www.abload.de/img/dirt2_gamedx11noaanqcs.png

Beta6 DX11
http://www.abload.de/img/dirt2_gamedx11fxaabetamrpa.png


With Beta 6 something changed in the shader file. While Dirt 2 (car) is better smoothed out, GTA4 isn't. Here some comparison shots.

Beta6
http://www.abload.de/img/gtaivbeta6mpmr.png
http://www.abload.de/img/dirt2_gamebeta6mpcd.png
http://www.abload.de/img/cojbibgame_x86beta66rvm.png
http://www.abload.de/img/arcaniabeta6kph7.png

Beta5
http://www.abload.de/img/gtaivbeta5upgz.png
http://www.abload.de/img/dirt2_gamebeta5wqvg.png
http://www.abload.de/img/cojbibgame_x86beta5spi4.png
http://www.abload.de/img/arcaniabeta5cpnw.png

Powerp1ay
2011-08-04, 16:36:58
Und wo bekommt man die Beta 6?? weil dann kann ich endlich BFBC2 @ DX11 glatt machen ohne downsampling@ AMD HD6970

p.s. kann man mit der Beta 6 auch DX10 64Bit nutzen weil Crysis 1 Und Warhead laufen ja nicht

Ronny145
2011-08-04, 16:39:28
Und wo bekommt man die Beta 6?? weil dann kann ich endlich BFBC2 @ DX11 glatt machen ohne downsampling@ AMD HD6970

http://hotfile.com/dl/125853856/6607130/injectFxaa_by_some_dude_6.7z.html


p.s. kann man mit der Beta 6 auch DX10 64Bit nutzen weil Crysis 1 Und Warhead laufen ja nicht

Ich glaube nur Spiele im 32 Bit Modus sind lauffähig.