glviz
glviz copied to clipboard
View matrix computation fixed
Translation part of constructed view matrix was missed, camera translation instead of inverse was used, also the missed inverse was wrongly computed.
I tested it on COLMAP-based real world data and other renderers, after this fix generated renders were aligned.
Based on ($A$ is a 4x4 affine transformation):
B = inv(A) \equiv B[:3, :3] = A[:3, :3]^T; B[3,:3] = - A[:3, :3]^T * A[3, :3]
Sorry, for the late reply. Also, thank you for your interest in glviz.
If I understand your change right you are essentially changing the model view matrix from $M = T * R$ to $M = R * T$ where $R$ denotes the rotation dir and $T$ denotes the translation m_position.
Applying the rotation after the translation unfortunately changes the trackball camera to an undesirable or counter-intuitive behavior in my opinion. This is because it can easily happen that the object ends up being outside of the view frustum of the camera, in which case it is not visible anymore.