I am trying to perform a 3D to 2D conversion of some coordinates from a Top View in parallel projection to its rendered image using VRay fro SketchUp 3.6. All images have been scaled.
First step is to convert each query coordinate from World to Camera domain, so I obtain the camera matrix (it’s a right-handed system):
R|T = Matrix[ [1.0, 0.0, 0.0, -120], [0.0, 1.0, 0.0, -60], [0.0, 0.0, -1.0, 709], [0.0, 0.0, 0.0, 1.0] ]
Applying the R|T matrix, the coordinates of the centroids of the four small squares in the model are:
top_left = [-62.63, 66.95, 642.93]
top_right = [53.99, 68.57, 642.93]
bottom_left = [-58.31, -117.70, 642.93]
bottom_right = [60.47, -90.71, 642.93]
I use the following parameters for the rendering:
Obtaining the following image:
Being the [0,0] pixel the top left corner of the image, the coordinates of the squares in the rendered image are:
top_left = [175, 174]
top_right = [315, 172]
bottom_left = [180, 396]
bottom_right = [323, 364]
I would like to know how to map between both set of coordinates. I know the height of the camera (+Z axis) must be used somehow, and so the size of the VRay viewport and the size and AR of the final image. If I set “Safe Frame” in VRay, it shows the area of the rendering viewport:
In perspective projection I am able to map between coordinates by knowing the camera intrinsics and applying the corresponding equations, but I can’t do the same in orthographic projection. Any hint?