Skip to content

View matrix computation fixed #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Auratons
Copy link

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]$$

Translation part of constructed view matrix was missed, camera
translation instead of inverse was used, also the missed inverse was
wrongly computed.
@sebastianlipponer
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants