I have been wrestling with FXAA for a few days now, and after getting updated to the latest version (3.11) I have finally gotten my FXAA shader to return usable values. I am using deferred rendering for the engine, and am running the FXAA shader immediately after combining my lightMap and Diffuse GBuffer, and outputting to a different renderTarget. The problem is, I am getting the below results; worse (and different) aliasing than before using it:


Do note, that if I comment out the "return FxaaPixelShader(...)" line for a standard texture sampler, the render looks like its normal aliased self (aka much better than the above). My code below comprises the area where I think there would have to be an issue. Any idea where it might be?
Note: I am using the Fxaa3_11.h file as is from Timothy Lottes, so the issue is definitely on my end.
Renderer Call:
[source lang="csharp"]void MakeFinal(GraphicsDevice GraphicsDevice, RenderTarget2D Output) { //Set Composition Target GraphicsDevice.SetRenderTarget(finalRender); //Clear GraphicsDevice.Clear(Color.Transparent); //Set Textures GraphicsDevice.Textures[0] = GBufferTargets[0].RenderTarget; GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; GraphicsDevice.Textures[1] = lightRT; GraphicsDevice.SamplerStates[1] = SamplerState.PointClamp; //Set Effect Parameters finalCombinedEffect.Parameters["GBufferTextureSize"].SetValue(GBufferTextureSize); //Apply finalCombinedEffect.CurrentTechnique.Passes[0].Apply(); //Draw //game.GraphicsDevice.DepthStencilState = DepthStencilState.None; quadRenderer.Draw(game.GraphicsDevice); //Set Composition Target GraphicsDevice.SetRenderTarget(Output); //Clear GraphicsDevice.Clear(Color.Transparent); FXAA.Parameters["SCREEN_WIDTH"].SetValue(finalRender.Width); FXAA.Parameters["SCREEN_HEIGHT"].SetValue(finalRender.Height); FXAA.Parameters["gScreenTexture"].SetValue(finalRender as Texture2D); //FXAA.Parameters["_rcpFrame"].SetValue(new Vector2(.4f, .4f)); FXAA.CurrentTechnique.Passes[0].Apply(); quadRenderer.Draw(game.GraphicsDevice); }[/source]
"finalCombinedEffect" Pixel Shader (where Luma is encoded):
[source lang="HLSL"]float4 PS(VSO input) : COLOR0{ //Sample Albedo float3 Color = tex2D(Albedo, input.UV).xyz; //Sample Light Map float4 Lighting = tex2D(LightMap, input.UV); //Accumulate to Final Color float4 output = float4(Color.xyz * Lighting.xyz + Lighting.w, 1); output.a = sqrt(dot(output.rgb, float3(0.299, 0.587, 0.114))); //Return return output; //return FxaaPixelShader(input.pos, posPos, tex, rcpFrame, rcpFrameOpt);}[/source]
FXAAShader:
[source lang="HLSL"]uniform extern float SCREEN_WIDTH;uniform extern float SCREEN_HEIGHT;uniform extern texture gScreenTexture;sampler screenSampler = sampler_state{ Texture = <gScreenTexture>; MinFilter = POINT; MagFilter = POINT; MipFilter = POINT; AddressU = Clamp; AddressV = Clamp;};#define FXAA_PC 1//#define FXAA_GREEN_AS_LUMA 1#if SHADER_MODEL >= 0x400 #if SHADER_MODEL >= 0x500 #define FXAA_HLSL_5 1 #else #define FXAA_HLSL_4 1 #endif#elif SHADER_MODEL <= 0x300 #define FXAA_HLSL_3 1#endif#include "Fxaa3_11.h"float4 PS(float2 tc : TEXCOORD0) : COLOR0{ float pixelWidth = (1 / SCREEN_WIDTH); float pixelHeight = (1 / SCREEN_HEIGHT); float2 pixelCenter = float2(tc.x, tc.y); float4 fxaaConsolePosPos = float4(tc.x - .5f, tc.y - .5f, tc.x + .5f, tc.y + .5f); //return tex2D(screenSampler, tc); return FxaaPixelShader( tc, fxaaConsolePosPos, screenSampler, screenSampler, screenSampler, float2(1.0f/SCREEN_WIDTH, 1.0f/SCREEN_HEIGHT), float4(2.0 / SCREEN_WIDTH, 2.0 / SCREEN_HEIGHT, .5 / SCREEN_WIDTH, .5 / SCREEN_HEIGHT), float4(0,0,0,0), float4(0,0,0,0), .75f, .166f, .08f, 8.0f, .125f, .05f, float4(0,0,0,0));}//Techniquetechnique Default{ pass p0 { PixelShader = compile ps_3_0 PS(); }}[/source]








