I am trying to align a perspective camera and an orthogonal camera in the same position and orientation, with the zfar plane set to the same value. However, despite having the same near and far values, I am encountering discrepancies in the z values and incorrect occlusions. What could I be missing?
const perspective_camera = new PerspectiveCamera(55, canvas.width / canvas.height, near, far);
const half_width = perspective_camera.far * Math.tan(perspective_camera.fov * 0.5 * (Math.PI / 180));
const half_height = half_width / perspective_camera.aspect;
const ortho_camera = new OrthographicCamera(-half_width, half_width, half_height, -half_height, near, far);
// Here is an example of the issue in the Z axis
const aux1 = new Vector3(0, 0, 1);
const aux2 = new Vector3(0, 0, 1);
console.log(aux1.project(ortho_camera), aux2.project(half_height));
// Object { x: -0.00003130777409465268, y: -0.000001186705638256526, z: -0.999202652754963 }
// Object { x: -0.07660902355148393, y: -0.0029038270148180447, z: 0.9510807024824749 }