Have a case where a point on the PerspectiveCamera’s LookDirection vector does not project to the center of the Viewport3D. Any thoughts as to why?
Here are details of the case (all the values are rounded for brevity): The Viewport3D is 778, 405. Any visible Point3D the camera is looking directly at would project to (389, 202.5). The PerspectiveCamera is located at (1379.4, -577.7, 0.7).
In the first case the center of the White sphere is (13,080.3,-6,491.9,-407.9) which is 13,117 units from the camera. Camera’s LookDirection is (0.89, -0.45, -0.03). The White sphere projects to the visual center of the Viewport3D. MathUtils.TryWorldToViewportTransform reports the sphere’s center point projects to (389, 202.5), as expected. The black lines are added to show the center of the Viewport3D.
In the second case the center of the Blue sphere is (1,383.0,-579.6, 0.3) which is 4.1 units from the camera. Camera’s LookDirection is (0.88,-0.46,-0.11). The Blue sphere does NOT render to the visual center of the Viewport3D. MathUtils.TryWorldToViewportTransform reports the center point being projected to (389, 202.5), as expected. Visually though the blue sphere is not drawing at center, it is at more like (295, 303).
Placing the camera at the 4.1 distance from the White sphere it projects correctly to the center of the Viewport3D. The difference is that the White sphere is further from the (0, 0, 0) origin than the Blue sphere.
The Blue sphere will project more correctly to the center of the Viewport3D if the camera is “far away” from it, like out near the White sphere.
The Blue sphere is mathematically positioned to be at the center of the Viewport3D. Any thoughts as to why the Blue sphere is not rendering at the center of the Viewport3D in the second case above?
Thank you!