0
\$\begingroup\$

I have a perspective "lookAt-type" camera. I'm trying to compute specific focus point of the camera, which should be placed in the middle of the screen: I also have a custom 3d point in world space, margin values in screen space and camera's tilt as inputs. I want to compute lookAt point, & camera distance with restriction, that input world space point has to be visible in the middle of the free screen space area (not affected by margin values) and it has to have a given tilt.

I'm able to compute this in 2D, but I'm lost in 3D. Any idea how to achieve this? Here's a sketch of the problem, red and blue area's are margin values of 0.5f in both x and y direction.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ I'm afraid I don't understand the meaning of all of the constraints you've described. You have a point c in world space that needs to be in the middle of the screen, is that right? And then you have a point p that needs to be...where? And how do we measure/interpret your "tilt" parameter in 3D? What are the distance restrictions you mention? What on-screen points are affected by your margin values, if point c is specifically in the middle? \$\endgroup\$ – DMGregory Feb 8 at 0:16
  • \$\begingroup\$ No, point C is just middle of the screen or "lookAt" point. I have point P as input, which is in world space coordinates, and that point has to be placed as shown in picture. Tilt is obviously another term for camera's pitch. Margin values just limit the "effective" area that is visible after something renders over the area given by margins. Basically, in other words, the problem is: "How do I position camera if I know it's pitch,yaw,roll, so given point in world space P is seen on the screen on given position in screen space \$\endgroup\$ – mezox Feb 12 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.