From e5ac38aa87efd440b356cb8d8e2d424efac3d523 Mon Sep 17 00:00:00 2001 From: Nikhila Ravi Date: Wed, 23 Sep 2020 17:26:57 -0700 Subject: [PATCH] fix docs for FOVPerspectiveCamera Summary: Small documentation fix for FOVPerspectiveCamera. The error pointed out in the GitHub issue was due to the docs referring to the OpenGL z parameterization from [-1, 1] whereas we use the [0, 1] range. Reviewed By: gkioxari Differential Revision: D23857312 fbshipit-source-id: 2d20677ec614c935e76f67e100a41a23df708d59 --- pytorch3d/renderer/cameras.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pytorch3d/renderer/cameras.py b/pytorch3d/renderer/cameras.py index 4b10d110..e14c8be8 100644 --- a/pytorch3d/renderer/cameras.py +++ b/pytorch3d/renderer/cameras.py @@ -381,14 +381,17 @@ class FoVPerspectiveCameras(CamerasBase): .. code-block:: python - f1 = -(far + near)/(far−near) - f2 = -2*far*near/(far-near) h1 = (max_y + min_y)/(max_y - min_y) w1 = (max_x + min_x)/(max_x - min_x) tanhalffov = tan((fov/2)) s1 = 1/tanhalffov s2 = 1/(tanhalffov * (aspect_ratio)) + # To map z to the range [0, 1] use: + f1 = far / (far - near) + f2 = -(far * near) / (far - near) + + # Projection matrix P = [ [s1, 0, w1, 0], [0, s2, h1, 0],