Original Post
Hi all,
The subject says it all. I'd like to know at what distance a sphere is roughly subpixel.
- First I calculate the screen size in world space:
screenSize = nearPlane * tangent( fieldOfView / 2 );
- Then I determine the size of a pixel in world space:
pixelWorldSize = screenWorld Size / ( screenResolution / 2.0f );
- Then I use the law of similar triangles to solve for distance:
worldDistance = radius * near / pixelSize
It seems to work well in my testing. I'm eyeballing it, plus multiplying transforming a sphere at this distance into screenSpace to check the extents are within a pixel.
Does this all sound reasonable? Also, any tips for testing?
Thanks,
unfadable
The subject says it all. I'd like to know at what distance a sphere is roughly subpixel.
- First I calculate the screen size in world space:
screenSize = nearPlane * tangent( fieldOfView / 2 );
- Then I determine the size of a pixel in world space:
pixelWorldSize = screenWorld Size / ( screenResolution / 2.0f );
- Then I use the law of similar triangles to solve for distance:
worldDistance = radius * near / pixelSize
It seems to work well in my testing. I'm eyeballing it, plus multiplying transforming a sphere at this distance into screenSpace to check the extents are within a pixel.
Does this all sound reasonable? Also, any tips for testing?
Thanks,
unfadable