PDA

View Full Version : question about 3d coordinates



radoslavkirilov
01-03-2007, 12:15 AM
very often there are coordinates with float point like 1.1234 but the screen can not make a dot with siza 1,1234 pixels. So what is the float point?

k_szczech
01-03-2007, 07:22 AM
Floating point doesn't mean that there is some miving pixel on the screen - it's a number representation:
http://en.wikipedia.org/wiki/Floating_point

dorbie
01-03-2007, 08:43 PM
Several answers,

1) for 2D pixels have subpixel precision so a number varying between 1.0 and 5.0 in floating point will hit the appropriate pixels at the right values.

2) with anti-aliasing fractional positioning between pixels matters both for geometry fill and texture sample calculation. More simply, pixels can render and represent the fractional values you claim they can't.

3) the 2D screen position is the result of a 3D transformation process where floating point values have large non-linear affects on the screen position and fractional values ae critical, sometimes required to high precision.

radoslavkirilov
01-08-2007, 01:13 AM
OK Thanks for th answer, but I am too new in the 3D programming :) what does it means subpixel precision and non- linear affect of the screen position?

arekkusu
01-08-2007, 01:49 AM
Imagine that you are drawing a one pixel wide line from pixel 0,0 to pixel 100,1.
That will be a diagonal line that moves one hundred pixels horizontally and one pixel vertically, right?

So if you plot that out, it should cross over vertically about halfway.

Now draw the same thing, but from 0,0 to 100,0.1 or to 100,1.9. Now where does it cross over?

During rasterization, pixels are typically filled if they would be more than "half" covered by a primitive (this is a simplification-- read the spec for the details.) So the fractional portions of the coordinates make a big difference.

OpenGL requires at least 4 subpixel bits to be maintained during rasterization. That means if you slowly move the endpoint of the line in the above example, you should see at least 16 distinct crossover points. Recent hardware supports 12 subpixel bits, which will make the crossover move very smoothly as you adjust the coordinates.