Is it possible to construct a 4x4 NDC-to-view matrix for both perspective and orthographic cameras? And how do these matrices look like (instead of blindly relying on some arbitrary matrix inverse method). I currently use a float4 to reconstruct my view space coordinates from NDC space coordinates. This reconstruction is, unfortunately, different for perspective and orthographic cameras, so I rather use a full matrix multiplication (assuming that such a matrix always exist for perspective and orthographic cameras).
Perspective projection:
view space coordinates := [Vx, Vy, Vz, 1]
projection space coordinates := [Px, Py, Pz, Pw] = [Px, Py, Pz, Vz]
NDC space coordinates := [Nx, Ny, Nz, 1] = [Px/Vz, Py/Vz, Pz/Vz, 1]
I guess not since we lost a degree of freedom after the homogeneous divide?
↧