• Advertisement
Sign in to follow this  

Antialiased Nearest Mag Filter

This topic is 1776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

 

I have a small 2D texture. The texture is intentionally very highly magnified with a nearest filter so as to preserve sharp edges.

 

However, these edges are not antialiased. I would like them to be.

 

Note that multisampling is unhelpful since the "edges" are in the texture itself at the same depth values on the same polygon.

 

I can obviously think of a few shader hacks that would emulate it, but is there a built-in easier way?

 

-G

Share this post


Link to post
Share on other sites
Advertisement

Two ideas:

1. Use a AA based on color (e.g. FXAA).

2. Use multisampling of the texture (not framebuffer).

Share this post


Link to post
Share on other sites
You could use linear filtering, but adjust the UV's in the shader so that it mostly behaves like point filtering. Transform your UV into an integer 2d pixel coord, and a fractional offset within that pixel. Then run the offset through some function that skews most values towards the centre / away from edges. Then reconstruct a UV from the pixel coord and new sub-pixel offset.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement