rand wrote:
I tried a few things, but in the end nothing worked out. I think it is my setup is still broken somehow. The problem is illustrated here:
......
Again you can see, the NorthSouth line is antialiased perfectly, but the EastWest line has weird pixel artifacts at the aliasing steps.
That's what FXAAv2 looks like...
It's a magic anti-aliasing filter that functions with only 5 texture lookups inside the 4x4 area around the current pixel (
5 samples from a 16 pixel area!) -- with that amount of knowledge, it can't possibly do a good job on long almost-straight lines and you should expect artefacts!
Also, I'm not sure where your FXAA2 code came from, but mine doesn't match up with this Horde3D port. IIRC the texture filtering mode should be linear.
Instead of something like:
Code:
//vs
texCoords = vertPos.xy;
...
//fs
vec3 rgbNW=texture2D(buf0,texCoords+(vec2(-1.0,-1.0)/frameBufSize)).xyz;
vec3 rgbNE=texture2D(buf0,texCoords+(vec2(1.0,-1.0)/frameBufSize)).xyz;
vec3 rgbSW=texture2D(buf0,texCoords+(vec2(-1.0,1.0)/frameBufSize)).xyz;
vec3 rgbSE=texture2D(buf0,texCoords+(vec2(1.0,1.0)/frameBufSize)).xyz;
vec3 rgbM=texture2D(buf0,texCoords).xyz;
Mine looks something more like:
Code:
//vs
texCoords.xy = vertPos.xy;
texCoords.zw = vertPos.xy - ((0.5 + FXAA_SUBPIX_SHIFT) / frameBufSize);
...
//fs
vec3 rgbNW=texture2D(buf0,texCoords.zw).xyz;
vec3 rgbNE=texture2D(buf0,texCoords.zw+(vec2(1.0,0.0)/frameBufSize)).xyz;
vec3 rgbSW=texture2D(buf0,texCoords.zw+(vec2(0.0,1.0)/frameBufSize)).xyz;
vec3 rgbSE=texture2D(buf0,texCoords.zw+(vec2(1.0,1.0)/frameBufSize)).xyz;
vec3 rgbM=texture2D(buf0,texCoords.xy).xyz;
Also, if you do want better quality, FXAA2 has been replaced with FXAA3.x and FXAA4 by now