Here is a method to get nice anti aliased contours (useful for displaying text for example) without the need for a big binary alpha map (like 4096×4096).
Stefan Gustavson has developed a distance transform method that takes an anti-aliased alpha map as input and computes a distance field with accurate sub-pixel resolution, without the need for a 4K+ binary alpha map—a modestly sized alpha map rendered with proper AA is enough.
A demo with full source code (OpenGL + GLSL) is available HERE.
And the method seems to work rather well:
well, I get some really weird artifacts when rotating the plane…
GeForce 8800 GTS, Windows 7
same here. RadeonHD4850 Cat9.9 Win7 small white dots on edges
Very cool!
I’m seeing nasty rotation artifacts on NVidia cards, but not ATI. Any idea what’s causing the NVidia problem and/or how to fix it?
It also doesn’t handle minimization well. I.e. some flickering and the white background becomes grey-background. With the dragon texture black becomes grey. Probably something related to mipmaping but i’m not sure as I haven’t read the paper or the source yet.
Color-mixing or flickering doesn’t happen with the dolphin texture.
I also get artifacts when rotating Geforce 8800 gtx-Win vista here.
If you could only post these questions to the forum on contourtextures.wikidot.com, I will be happy to answer them. The artefacts are not inherent to the method, they are a side effect of my pretty ugly demo which was thrown together too quickly. But as I said, please use the dedicated forum if you have specific support questions!
I have posted the questions and the answers to the wikidot forum, so you don’t have to go to the trouble of asking. Thanks for the comments, and the bug reports. I didn’t have easy access to Nvidia hardware to test this when I wrote it.