Jump to content
  • Advertisement
Sign in to follow this  
bronxbomber92

Software Rasterisation with Fixed Point Math

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 :P), I may very well implement that instead. However, for my own curiosity, I'd like to still try to understand my original questions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!