Subpixel Accurate!

Published May 12, 2007
Advertisement
Subpixel Accurate At Last!After quite a lot of work, I was able to get the subpixel accuracy into the rasterizer. I ended up not using Chris Hecker's articles after all, because he didn't use homogenous coordinates for his 3D data. Instead I used a variant of Dave Eberly's perspective interpolation function from his book 3D Game Engine Design, 2nd Ed. He uses only integer coordinates, but if you change the input arguments from integer to floating point, then you can use the interpolation function for perspective correct interpolations over arbitrary floating point ranges.

This worked out very well, and I am quite happy with the results. The basic idea is to use this function to figure out what attribute values should exist at the pixel centers instead of using the attribute values of the vertices, whose position can be pretty much anywhere inside the pixel.

When you really think about it, adding subpixel accuracy helps identify the fact that you are really just sampling the geometry that you are rendering and storing the samples in a frame buffer. The grid of pixels in the framebuffer is just a definition of how finely you are going to sample the geometry in your scene. It all makes sense now...

Anyways, here is a screenie of the new function's output:

Previous Entry Sub-Pixel Accuracy
0 likes 2 comments

Comments

Ravuya
Nice and clean. I guess next is antialiasing. [grin]
May 14, 2007 12:13 PM
Jason Z
I still have a few things to clean up in the rasterizer unfortunately. It has been a great learning experience, but I am ready to move beyond the rasterizer - there seems to be a constant stream of special cases that really are not fun to work on.

Anti-Aliasing should be a good diversion once I finish off the remainder of my rasterizer to-do list. I'll have to think about the different scenarios to try out...
May 14, 2007 09:40 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement