dipityPix app

Saturday, February 17, 2007

Left and right-handed coordinate systems

We have hit that time in my class again where we set up viewing frames. I continue to shun left-handed from my software, but do see why they are popular.

Let's suppose when looking "into" the screen, you want the y axis to point up and the x axis to point to the right. If you have a right-handed system, then the z axis will come out from the screen. Negative z will go into the screen. If you implement a z-buffer system you will initialize it with z = -infinity. In a ray tracer, the viewing rays will have a negative z component. It does seem "nicer" to have positive z go into the screen. But at what cost?

We can have the y axis point down as is done in many device coordinate systems. That seems worse to me than having z point out from the screen.

We can have a left-handed system. This is equivalent to adding one reflection matrix to your system. Whether that is worth it is a matter of taste. To me it is not, as it confuses me more than the negative-z problem. My brain-washing from many courses 20 years ago and geometric software in the intervening years is all in favor of right-handed systems, while the "which way is z" issue has a lot less congitive cement for me, so I choose to live with negative z going into the screen. Interestingly, the perspective matrix doesn't change either way!

No comments: