Making Permit Pending: Art and Graphics
I started working on a game recently (lively hacker news thread here), and wanted to share a little about what I learned in the process of working on the graphics and art. Here's finished a screenshot:

I'm pretty happy with how the art and graphics turned out, but it took a long time to get the exact look I was going for with acceptable performance.
The goal was an ink-and-watercolor painted look on the map. When omitting this post-processing step, the image looks much more flat, devoid of any hand-drawn ink lines or watercolor inspired shadows:

The pipeline for this look was working OK for a prototype, but it produced annoying artifacts.
First, there was significant noise and rough edges in the geometry and details, especially as the camera panned and orbited.

Notice the details - especially around the roof edges - are jagged, broken up, and fail to accurately represent the geometry and details. Graphical aliasing like this is common, because the final image needs to be projected onto screen pixels on a square grid, but many details are smaller than a screen pixel, or not aligned with the grid.
Anti-aliasing techniques attempt to address jagged edges by sampling more than one point per drawn pixel, and then averaging the colors a bit:

I didn’t understand why the existing anti-aliasing (FXAA, "Fast Approximate Anti-Aliasing") implementation in the game was leaving so many aliases, so I got to work experimenting with Claude.
One promising avenue turned out to be temporal anti aliasing, or TAA. Most anti-aliasing techniques work by sampling the image more, and averaging in details from those extra samples into the final output pixels. TAA also does this averaging, but instead of doing it every frame, it does it over successive frames.

The first implementation fixed some issues while introducing new ones: still views now had a very noticeable flicker, which is annoying and distracting:

Unfortunately, the problem was somewhat specific to my game's rendering pipeline. The way the game determines what edges need a black ink edge is based on (simplifying a little bit) depth from the camera. TAA - by design - samples from a slightly different part of the image every frame to make sure it doesn’t miss small details based on where it happened to sample, and then averages this together over multiple frames.

TAA is a very clever technique, because this means it operates a bit more like the higher quality, slower anti-aliasing techniques, but faster - by spreading the math out over multiple frames.
Unfortunately for me, the way the edge detection works to apply the ink detail, these very small perturbations in where we are sampling can cause some fine building details to take up either 1 or 2 pixels, just by random luck. And this 1 pixel difference is the exact cutoff for determining whether to apply ink effect. The result: fine details in buildings have ink lines that pop in and out, even when nothing is changing in the scene. It's the tiny changes in where we are sampling that cause the image to change:

But why does the image change so drastically when we are just averaging the frames together? Shouldn't this just blur the resulting part of the image a bit?
It turns out there was another problem TAA introduces: moving object ghosting. Look at the balloons in this video where I forgot to apply motion compensation:
Ghosting from balloons, 2X zoom
We can't naively apply TAA to moving scenes, because then we're averaging in frame data from where an object was, which will incorrectly leave a ghost trail.
One cheap and naive way to prevent this ghosting is to diff the pixels from one frame to the next: if the pixels in the new frame changed color or brightness more than some tolerance/cutoff, then discard the average and start over - because something moving probably covered or revealed some unrelated pixels.
Ghosting from moving vehicles with TAA (left) and after pixel clipping (right)
This works OK and is pretty cheap because you don't have to store information about every moving object and what direction it's moving in. It doesn't work well when ink edges can drop in and out every frame, because then the algorithm assumes its motion and stops averaging those pixels. That's the cause of the ink flickering in and out in a still view.
The solution was to explicitly mark the pixels in the image that should be considered "stationary," and to use this information to keep history data even if the ink lines blink in and out in any given frame.
This helps - the ink and no-ink parts of the frame now always keep history and average out over time into one blurrier (but completely stable) view:

With a frame diffing algorithm we can see the before/after to highlight where the image is changing:
Left: Change since last frame with TAA only. Right: TAA plus mark areas that are stationary.

Finally, flicker and aliasing was still very noticeable on small subpixel details when the camera rotates or orbits the scene. TAA doesn't help us much here because the camera motion means we can't accumulate enough useful frame history to help smooth the picture:

In this scene, the camera is slowly orbiting a fixed point. Notice the vertical shadow details in the building in the background are shimmering and flickering in and out as the camera slowly moves.
Here's another view where railings and other fine window details noticeably drop in and out as the camera slowly moves:

After a bunch of reading, the solution I arrived at is probably best described as "coverage-preserving geometric anti-aliasing." It operates at the vertex stage of the rendering pipeline, before we rasterize the geometry into pixels, widening details that are a bit too small (less than 1 pixel wide) to be at least one pixel wide:

To preserve the intended appearance and contrast, we have to blend a little of the background color into the pixel to make up for the fact that the geometry has been "artificially" enlarged to 1px.

This is not, physically speaking, completely accurate, because different materials should blend differently. But its close enough, and the gain is a big win: now we are almost guaranteed that the geometry is actually visible and contributes to the final picture, regardless of rounding math due to the camera position. This contributes greatly to image stability, and fine details are now - finally - consistently represented regardless of the angle of the camera. Unigine documents a similar technique they call geometry inflation.
Here's a side-by-side zoomed 3X, before and after:

Composing everything together - here is the resulting side by side comparison, zoomed in 4X with the camera still:
Left: obvious aliasing in roof details and contours. Right: fixed view.
With the camera moving the difference is also pretty dramatic (4X view here).
Left: obvious aliasing and artifacts during camera pan. Right: fixed view.
The orbiting camera view finally looks reasonably good to my eye, from a technical perspective (rendered at 1X):
You can play Permit Pending here.