# Software Rasterisation with Fixed Point Math

This topic is 2424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,

I'm trying my hand at writing a software renderer. I've read the Advance Rasterisation article by Nick Capens and it works wonderfully. However, in an attempt to learn the fixed-point representation of floating point numbers, I tried taking the algorithm he presents before he adds the fill convention and fixed point math and writing the fixed point code myself.

My understanding is that the fixed point representation simply gives more precision (and thus more accuracy) and that's why it's effective. However I am not seeing a difference (as a note -- I did implement the fill convention insight Nick outlines, so that is not lacking and thusn't be the reason why my code doesn't work properly).

I went back to the article and looked for differences between the implementations. I believe I'm missing an insight, because there are some parts of his code that don't make sense to me and I can only assume it is these concepts that are the reason my code doesn't work correctly.

The particular areas of his implementation that don't make sense to me are:

1. The necessity of the FDX and FDY variables. Supposedly they are the fixed point representations of the deltas (hence the 4 bit shift), but aren't the DX variables all ready in a 28.4 fixed point format since they are computed from the X and Y variables which are in a 28.4 fixed point format?

2. The addition of 0xf to the min and max variables on their conversion back from 28.4 fixed point format. This is essentially adding .9999 to the fixed point number, correct?

3. Why convert the min and max variables back to normal integers at all? Would it not be equally valid to leave them in the 28.4 format, not do the 4 bit shifts in computing the CY variables, and increment the x, y counters by (1 << 4) in the two for loops?

Thanks ahead of time for any light you can shed on my confusions!

##### Share on other sites
Have you taken a look at the larrabee rasterization algorithm? If you implement it using a quadtree it optimizes down to a few lines of code and is only a few additions and multiplications using only integers and supports aliasing. It can be specialized for any N-gons. So a quad looks like this and a 50-gon looks like this. Tons of optimizations available and it easy to run parallel. I believe it's the fastest rasterization algorithm, but I haven't seen many compared.

##### Share on other sites
I was not aware of that article. Thanks for pointing it out to me. If it's as good as you say (which I'm sure it is -- it's Abrash ), I may very well implement that instead. However, for my own curiosity, I'd like to still try to understand my original questions.

##### Share on other sites
I hope no one minds that I bump this. I still can't seem to grasp why the fixed point math in the article is correct.

Thanks!

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• ### Forum Statistics

• Total Topics
633386
• Total Posts
3011606
• ### Who's Online (See full list)

There are no registered users currently online

×