1
$\begingroup$

I am trying to draw points of a 3D sphere onto my monitor as if I was looking out into space. Me, the viewer, is at (0, 0, 0). The plane of my monitor is at (x, y, 1) and I have a sphere out in space beyond the screen, off to the side not centered on the Z axis. For each point of the sphere I compute where the point of intersection is between the plane of the monitor and the line between me and the point. What I get is an ellipse. Not surprising since a plane intersecting a cone at an angle would form an ellipse. But if I look at a real sphere off to the side it looks like a sphere and not an ellipsoid. If you draw an ellipse on a roadway and you view it from the correct spot it looks like a circle. I presume you've seen stretched lettering on roads which are readable.

So why when I draw the points of a 3D object exactly at the point of intersection with the line between the point and my eyes doesn't it look right? Or more simply: Given P1 = (0, 0, 0), a plane 0X + 0Y + Z = 1, and P2 at (X2, Y2, Z2) assume Z2 > 1 so that P2 is on the far side of the plane; where do I draw the point on my monitor such that a collection of points forming a sphere actually look like a sphere instead of an ellipsoid? I've been using (X2/Z2, Y2/Z2) assuming the distance between me and the monitor is '1'. But this gives me an ellipse.

$\endgroup$
2
  • $\begingroup$ You're probably seeing perspective distortion from the screen being comparitively close. Try assuming the monitor is at something like x,y,10. $\endgroup$ Jun 23, 2022 at 0:03
  • $\begingroup$ In reality I was assuming x, y, 100 in the actual code. I was just simplifying here. At first I couldn't figure out what was happening. Now it is obvious the monitor plane intersecting with the cone from my eye to the sphere is an ellipse. It makes sense conic section wise but that doesn't help me first out how to achieve what I want, which is to see the properly scaled and translated sphere on the screen. Obviously projecting the rays from points on the sphere 'through' the monitor isn't going to work. $\endgroup$
    – Dan Wood
    Jun 23, 2022 at 1:00

1 Answer 1

1
$\begingroup$

Egads. I was trying to place points for my sphere on my 3440x1440 monitors 860 pixels from right of center. At 75% from left to right on the monitor. I just arbitrarily choose the "number" 100 for my eye distance from my monitor and then worked backward to find the right size sphere and distance for it to appear where I wanted on the screen. I got an exaggerated ellipse and had the hardest time figuring out why. Yes, if you look at an ellipse at an angle it will look like a circle but it was way way to elliptical.

I finally realize that my eyes are not at 100 pixels or about 3/4th of an inch from the screen. At that angle to the ellipse it'd probably look right. When I set the monitor as being 2200 pixels from my eyes and redid everything it looks fine. Now I have a beautiful globular cluster in a galaxy of stars. Looks quite realistic. Coming soon to a github near you(I hope).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.