Skip to content
sopyer edited this page Sep 13, 2010 · 1 revision

Introduction

Most of approaches to vector graphics are based on the tessellation of incoming primitives. Recent advances in hardware can accelerate such algorithms, but there is also another approach – rasterization. First useful approach was suggested by Loop and Blinn. MDK thought about simplified approach. And the last attempt, I am aware of, was maid by MacSlow. My approach is similar to previous two.

Implementation notes

As basis I took math done by Loop and Blinn. Also I am following in direction similar to that of MDK. Main idea lies in drawing shape using just lines, and then refine it with “features”(they can add or remove some areas from shape):cubic, quadratic curves and arcs. First we rasterize shape into stencil buffer, and then fill it with selected paint. Approach is just a bit similar to deffered rendering in 3D.

The cubic “features” is especially hard – but I found simple approach to handle them. If we subdivide cubics at their special points(cusp, loop, inflection) – resulting subcurves has static topology – similar to rectangle(we do not need triangulation at all). This also gives us a simple heuristic to handle orientation – we just need to control signs of 2 non end points and flip them as needed(the sighs is same or 0).

Problems to solve

  • Antialiazing(I am thinking about using dest blend during fill stage; alpha values are written during rasterizing stage, but this will disable double z-speed)
  • Strokes – maybe use scale bias to create 2 contours and fill area between them.

Clone this wiki locally