What is the best post processing anti aliasing shader that isn't blurry?

More
4 months 2 weeks ago #1 by Toadfield
Msaa and Ssaa need to much performance,that's why I wanna use post processing.
So I tried fxaa and smaa.
I hate fxaa,it looks worse than no aa.
smaa looks kinda ok for the edges,but it is very blurry,even for 2d text and things like that.
So is there anything better?

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago - 3 months 2 weeks ago #2 by Daemonjax
You can run a sharpening filter either after or before smaa if it's too blurry for you. Or have it use the depth buffer to detect edges and only antialias on those edges -- that could be suitable in some games depending on what the depthbuffer image actually looks like (the gui might get in the way though).

I recommend just sharpening before smaa.  The best sharpener (imo) is qUINT's: github.com/martymcmodding/qUINT
If you sharpen after smaa, it'll be sharper, but you'll lose some AA and you can get artifacts.  But whatever looks better to you is best.
Last edit: 3 months 2 weeks ago by Daemonjax.

Please Log in or Create an account to join the conversation.

More
3 months 15 hours ago #3 by lordbean
SMAA can do a pretty decent job without blurring details too badly if you focus on tuning it with the corner rounding bar set to zero. Letting it do corner rounding is what really fuzzes up text and other fine-grain stuff like small UI elements.

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago - 2 months 3 weeks ago #4 by Daemonjax
I've found that with a half-decent depth buffer to work with and smaa's predication turned on (where it uses regular detection in addition to the depth buffer), I can go as high as .142 on smaa's (color or luma) edge detection threshold setting and still get effective edge detection. Predication settings: 0.96 threshold, 1.186 scale, 1.0 strength.  But not all games give you even a half-decent depth buffer to work with. 

Some games (like Dawn of War 1) have most text completely black in the depth buffer -- this would make any depth approach for smaa make text look even worse, unless you modify the smaa code to mask out pure black from the depth buffer (not hard):
float2 SMAAEdgeDetectionWrapPS(float4 position : SV_Position, float2 texcoord : TEXCOORD0, float4 offset[3] : TEXCOORD1) : SV_Target
{    
    #if (SMAA_DEPTH_MASK_TEXT != 0) 
        const float mask = trunc(tex2D(depthLinearSampler, texcoord).x + 0.9999999f);                
    #else
        const float mask = 1.0f;
    #endif
    
    if (EdgeDetectionType == 0 && SMAA_PREDICATION == true) return SMAALumaEdgePredicationDetectionPS(texcoord, offset, colorGammaSampler, depthLinearSampler) * mask;
    else if (EdgeDetectionType == 0)                         return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler) * mask;
    if (EdgeDetectionType == 2)                             return SMAADepthEdgeDetectionPS(texcoord, offset, depthLinearSampler) * mask;
    if (SMAA_PREDICATION)                                     return SMAAColorEdgePredicationDetectionPS(texcoord, offset, colorGammaSampler, depthLinearSampler) * mask;
    else                                                    return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler) * mask;
}

Yeah, rounding makes text look even worse, but it really depends on the font.  Some games already have a comic sans looking font so smaa has little effect on it.  Some other fonts simply resist smaa antialiasing very well, like magic cards font.  Some fonts look get destroyed no matter what the rounding setting is set to.  I always try to turn rounding up as high as I can stand it in any particular game.
Last edit: 2 months 3 weeks ago by Daemonjax.

Please Log in or Create an account to join the conversation.