I know, there were a few topics on FXAA, but it didn't help me with my problem, hence the new thread.
The problem is, I don't see any difference between the FXAA and Non-FXAA Render.
Then again I am not passing a non-linear color space texture to the FXAA shader. And not sure how to.
If my understanding is correct Linear color space is the one that is got when you sample a texture (0 to 1 range or 0 - 255 range) where the colors change in a linear fashion.
I am not sure what sRGB is about ?
Currently my texture is in RGBA8 dx format.
According to Fxaa3.11 release by Timothy.
"Applying FXAA to a framebuffer with linear RGB color will look worse.
This is very counter intuitive, but happens to be true in this case.
The reason is because dithering artifacts will be more visiable
in a linear colorspace."
.
The FXAA paper mentions something about using the following in DX9 (which is what i am working on)
// sRGB->linear conversion when fetching from TEX SetSamplerState(sampler, D3DSAMP_SRGBTEXTURE, 1);
// on SetSamplerState(sampler, D3DSAMP_SRGBTEXTURE, 0); // off
// linear->sRGB conversion when writing to ROP SetRenderState(D3DRS_SRGBWRITEENABLE, 1);
// on SetRenderState(D3DRS_SRGBWRITEENABLE, 0); // off
This is what I am doing.
1. Render to texture using D3DRS_SRGBWRITEENABLE = 1, and turn it off after I am done.
When I render this texture, it looks brighter than usual.
2. Render screen quad with this texture using D3DSAMP_SRGBTEXTURE = 1, and turn it off after I am done.
When this texture renders, it looks correct.
But the aliasing still remains. I figured I shouldn't be doing step two because that would turn the non-linear color to linear while sampling.
But doing that results in the texture/scene got from the first step.
I have attached my shaders here.
Any help is greatly appreciated.
P.S, Timothy also mentioned something about pixel offset being different on dx11 w.r.t dx9 by 0.5 of a pixel.
http://timothylottes.blogspot.com/2011/07/fxaa-311-released.html
Thanks a lot !
Jerry
FXAA.zip 15.36K
33 downloads






