vsg::LookAt appears to always result in a y-up view #1424
-
Hello! I'm baffled as to what I'm missing here, but if I specify: eye{-10,0,0} center{0,0,0} up{0,0,1}; I expect the cameras forward axis to be +x, the up axis to be +z and left to be +y. But the result always seems to be +y up. Am I missing some critical context or is it actually the case that vsg::LookAt only supports +y up views? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
LookAt sets whatever you pass in, following the right hand rule convention for layout of x, y and z. With the settings you give the look direction is down the world coords +ve X axis, the up direction will be up the +ve Z axis and +y will be to the left. However, one need to understand that the input parameters of a view matrix will be in world coordinates, but the transform that it generates will convert world cooridnates into eye coordinates. Eye coordinates are +ve Z out of the screen, +ve X to the right and +ve Y up. The vsg::LookAt is written to mirror OpenGL's glLookAt so the parameters and conventions are all consistent. You can also write your own vsg::ViewMatrix implementations if the LookAt (it's a subclass from vsg::ViewMatrix) doesn't suit your application. |
Beta Was this translation helpful? Give feedback.
LookAt sets whatever you pass in, following the right hand rule convention for layout of x, y and z.
With the settings you give the look direction is down the world coords +ve X axis, the up direction will be up the +ve Z axis and +y will be to the left.
However, one need to understand that the input parameters of a view matrix will be in world coordinates, but the transform that it generates will convert world cooridnates into eye coordinates. Eye coordinates are +ve Z out of the screen, +ve X to the right and +ve Y up.
The vsg::LookAt is written to mirror OpenGL's glLookAt so the parameters and conventions are all consistent.
You can also write your own vsg::ViewMatrix implementations i…