What I’m trying to do is calibrate a camera in Unreal so it can mimic the exact properties of another perspective camera from another engine.
This should be do-able by copying the original camera’s extrinsic matrix/properties (location and rotation) and intrinsic matrix/properties (the focal length, skew and x&y offsets).
I’ve created my own GameViewportClient, overridden the Draw method and set it as the default Game Viewport Client class in the project/engine settings.
I have set the camera’s location and rotation so it copies the original exactly. That works.
I have also set the Focal Lengths fx & fy (at locations [0,0] and [1,1] respectively in the ProjMatrix) and this also mimics the original camera’s view exactly - so far so good.
But when I try to set the projection matrix properties at locations [0,2] and [1,2], which should relate to the ‘principal point offset’ x0 and y0 (in other words just translating that view in 2d space by an x and a y value) it doesn’t do what I would expect - it starts clipping the view by that amount rather than transforming it along those axes.
I’m thinking there must be another way of doing it but have been searching for quite a while now and can’t figure how to set these ‘principal point offset’ values in UE.
Does anyone know any more about the view matrices and how they work? Or how to offset these x,y values so the rendered view is simply translated in x & y positions (in 2d space)?
I’m learning how to do all this through this series of articles: Dissecting the Camera Matrix, Part 3: The Intrinsic Matrix ← and have tried in Unity on the Camera.projectionMatrix and it works exactly how it should, however in UE it does up until trying to change the [0,2] and [1,2] values on the ViewMatrices.ProjMatrix and that’s where it falls apart.
I can provide more info if needed but am stumped on this and would really appreciate a pointer if anyone knows.