how do I create a sprite with hard (aliased) edges, but still be antialiased inside? This question came up in the irc channel yesterday.  The fellow had a model he was turning into a sprite for a 2D game.  He wanted it to be aliased inside, but have a hard (aliased) edge.

Getting transparent images is easy.  Go to the Render Properties panel and set your Alpha to Transparent and make sure the file format is saving RGBA channels.



Getting a hard (aliased) edge is easy.  Turn off Anti-Aliasing in the Render Properties.  This gives your model hard edges, even in the internal pixels.



Now if turn on anti-aliasing you get soft edges, both inside, and outside.



How do you get hard edges on the outside, but soft edges inside?
This answer was composed based on help from several individuals in the #blender IRC channel (you know who you are).

The first step is to use blender's Compositor.  Start out by clicking the Use Nodes checkbox.  That should create the two-node pipeline that does nothing exciting.  Route the alpha channel through Math node (available through the Converter submenu of the shift-A menu) configured to do a Greater Than operation against 0.001.  This means that an alpha of 0 will remain zero, but an alpha of 0.001 or higher (and 0.001 &lt; 1/255)  will be converted to 1.



The problem that remains is that the edges that otherwise would have been translucent are now kind of dark.  That's because the Image channel coming out of the Render Layers node is premultiplied.  To correct for this, add an Alpha Convert node (available under the Converter submenu) and route the image channel through that on its way to the Composite node.



Now your edges are hard and they match the thresholded alpha channel.