Open mrzzzrm opened 10 years ago
merged
hi,
this is johannes from team mammut :) i also used the horde3d shader but found it's artifacts not so cool. after digging through the internet i found the original code here.
took about an hour to integrate it, it should go even faster if you don't make the mistakes i did.
in my opinion it looks a lot better, there are fewer artifacts now and the remaining ones are harder to notice.
to use it,
glow::createNamedString("/Fxaa3_11.h", new glowutils::File("path/to/shader/Fxaa3_11.h"));
#version 410
#define FXAA_PC 1
#define FXAA_GLSL_130 1
#define FXAA_QUALITY__PRESET 13
#include </Fxaa3_11.h>
uniform sampler2D buf0;
smooth in vec2 v_uv;
layout (location = 0) out vec3 fragColor;
void main( void ) {
vec2 rcpFrame = 1.0 / textureSize(buf0, 0);
float fxaaQualitySubpix = 0.75;
float fxaaQualityEdgeThreshold = 0.166;
float fxaaQualityEdgeThresholdMin = 0.0625;
fragColor = FxaaPixelShader(v_uv, vec4(0.0), buf0, buf0, buf0, rcpFrame, vec4(0.0), vec4(0.0), vec4(0.0), fxaaQualitySubpix, fxaaQualityEdgeThreshold, fxaaQualityEdgeThresholdMin, 0.0, 0.0, 0.0, vec4(0.0)).xyz;
}
PS: it requires the w channel of buf0 to contain luma values. to avoid changing other shaders, you can #define FXAA_GREEN_AS_LUMA 1
, which works pretty good (but that depends on the colors you have on screen)
sounds interesting, thanks!
Performed on rendered fbs, should be simple and fast http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf http://www.codinghorror.com/blog/2011/12/fast-approximate-anti-aliasing-fxaa.html