0

I'm working on a subpixel rasterizer. The output is to be rendered on an opaque bitmap. I've come so far as to correctly render text white-on-black (because i can basically disregard the contents of the bitmap).

The problem is the blending. Each actually rendered pixel affects it's neighbours intensity levels as well, because of the lowpass filtering technique (I'm using the 5-tap fir - 1/9, 2/9, 3/9 etc.), and additionally alpha levels of the pixel to be rendered. This result then has to be alphablended onto the destination image, which is where the problem occurs...

The result of the pixels interactions has to be added together to achieve correct luminance - and the alphablended to the destination - but if I rasterize one pixel at a time, I 'loose' the information of the previous pixels, hence, further addition may lead to overflowing.

How is this supposed to be done? The only solution I can imagine would work is, to render to a separate image with alpha channels for each colour, then some complex blending algorithm, and lastly alphablend it to the destination.. Somehow.

However, I couldn't find any resources on how to actually do it - besides the basic concepts of lcd subpixel rendering and nice closeup images of monitor pixels. If anyone can help me along the way, I would be very grateful.

Shaggi
  • 1,121
  • 1
  • 9
  • 31

1 Answers1

0

Tonight I awoke and could not fall asleep again. I could not let all those brain energy get to waste and stumbled over exactly the same problem.

I came up with two different solutions, both unvalidated.

  • You have to use a 3 channel alpha mask, one for each subpixel, blend each color with its own alpha.
  • You can use the color channels each as alpha mask if you only render gray/BW font (1-color_value if you draw dark text on a light background color), again applying each color individualy. The color value itself should be considered 1 in this case.

Hope this helps a little, I filled ~2h of insomnia with it.

~ Jan

JanSordid
  • 59
  • 6
  • Thanks for your comment! I solved this utilizing the fact I'm always rendering left to right, line-for-line. Thus, I only needed to store the last and next N/2 subpixels (where N is the size of the filter kernel used for antialiasing) which map directly to the display. I called this alphaMap, in which in i blend the kernel, gamma and b/w intensity of the pixel. Whenever I move to the next pixel, I then rasterize the previous points, mapping the alphaMap to the current colour, and the alphablend it to the destination surface. Early version here can be seen here: http://pastebin.com/SP2PW6rr – Shaggi Feb 19 '15 at 17:20