mathr / blog / #

Anti-Aliasing with Gridflow

The blobs I was making looked rather grainy, due to being aliased to bleepery. So I decided I wanted to anti-alias them. Now they look all shiny and new, and much much better. Here's a quick step-by-step, assuming we want PAL DVD resolution image (720x576 pixels):

  1. Decide on an oversampling/supersampling factor F, which must be a positive integer.
  2. Replace [#for ( 0 0 0 ) ( 576 720 1 ) ( 1 1 1 )] with [#for ( 0 0 0 ) ( {F*576} {F*720} 1 ) ( 1 1 1 )], replacing {...} by the value of the expression.
  3. Do your calculation on the new large image. Note, it will probably look different due to the increased range of the [#for], so adjust your parameters!
  4. Before the final output, insert a [#downscale_by {F} smoothly]
  5. Be prepared for a longer wait while it renders, at least F^2 times as long, using F^2 times the memory...

Simple as! With F=4 it will take my program about 18 hours to generate the video I intend to, so to make life easier on myself, I created another data flow in my program, which generates a small, quick-to-render preview. I did this by switching in a [#downscale_by {F*4} smoothly] after the [#for] before the calculation, and switching out the [#downscale_by] after the calculation. This preview renders at a full 25fps, while being similar enough to the final version to be useful.

People Like Us - Gongexeva - 04 - Gongexeva

bouncy