mmatl / pyrender

Easy-to-use glTF 2.0-compliant OpenGL renderer for visualization of 3D scenes.
http://pyrender.readthedocs.io/
MIT License
1.31k stars 225 forks source link

PerspectiveCamera: some yfov values causes image to flip #255

Closed tonyf closed 1 year ago

tonyf commented 1 year ago

When rendering a scene with PerspectiveCamera, some values for yfov will cause the image to flip.

This is due to how the projection matrix is constructed in PerspectiveCamera.get_projection_matrix. On line 190 for some values of yfov, t = np.tan(self.yfov / 2.0) will be negative causing the image to be flipped

tonyf commented 1 year ago

I believe it should be (though untested)

t = 1 / np.tan(self.yfov / 2.0 * np.pi / 180)