Closed wpalfi closed 3 years ago
Thanks for pointing this out - the documentation is indeed confusing view space, clip space and NDC.
Conventional OpenGL perspective projection matrix, as implemented in glFrustum()
, expects that view-space z increases towards the viewer, which is what the documentation is trying to say. But after multiplication by projection matrix, z/w increases away from the viewer, and thus NDC z points into the screen, as you say. I'll have to update the documentation to fix this. The implementation follows OpenGL conventions, though, so that part is correct.
Regarding the y axis flip in the examples' projection matrices, I guess the goal was to make it so that when writing the rendered images on disk we don't have to flip them vertically. I'll go ahead and tidy that up too in the next release, as there's no reason for the examples to take ugly shortcuts like that.
Both issues are addressed in v0.2.7, closing.
In https://nvlabs.github.io/nvdiffrast/#coordinate-systems, you say that you follow OpenGL conventions.
n/x
). But it is negative (n/-x
) in https://github.com/NVlabs/nvdiffrast/blob/v0.2.6/samples/torch/util.py#L16, which flips the y-axis from view space to clip space.I am confused.