cancel
Showing results for 
Search instead for 
Did you mean: 

Orientation matrix causing skew in world geometry?!

blitter
Honored Guest
Hey folks, some of you might know me as the guy who did the port of GLTron to the DK1 and DK2. Well I want to release that ASAP but when I showed it off at Connect I got multiple folks telling me that head rotations made them sick. I took a look for myself and sure enough, when you rotate your head, the world gets skewed very unnaturally, especially when rolling your head back and forth. Obviously I can't release the game this way if it makes people sick, but I'm at my wits' end trying to figure out what could be causing this.

VRTron has the ability to toggle whether or not to enable VR mode, and I can confirm that when rolling back and forth automatically, everything appears to render correctly, both in regular and in VR mode. (Drop a glRotatef() call around the Z axis right before glMultMatrixf() inside of doLookAt() to see for yourself). But when I'm using vrLookAt() and narrowing it down to only use the orientation quaternion and translating to the camera position, then you see the problem as shown in these two pictures:

Correct (facing forward):
http://imagebin.ca/v/1eKiJUky6vMi

Incorrect (head rolled to the right):
http://imagebin.ca/v/1eKiaM3wQp1x

As shown in the second screenshot, the wall appears shorter and, at least to my eyes, skewed slightly in the opposite direction of the head rotation. I have no idea why. I assume that the SDK is providing me with a valid orientation quaternion and that its quaternion->matrix maths are correct, but given that a simple glRotatef() call can do a successful roll in regular mode but rotating about the SDK's orientation does not seem to, there must be something involving the SDK that I am just blind to.

I am grabbing the perspective transform directly from the SDK also, but even using the perspective matrix from regular mode in VR mode exhibits this problem also. One thing I do notice is that it does not appear to affect orthographic projection, at least to my eyes.

If somebody would like to extend a hand to help me out, I would be very grateful. The code is up on Bitbucket, however you'll need mingw-w64 and a number of dependencies to get it to build. (SDL 1.2, SDL_sound, freetype, GLEW, jpeg, mikmod, ogg, png, theora, vorbis, and zlib) https://bitbucket.org/blitter/vrtron

Thanks in advance 🙂
2 REPLIES 2

jherico
Adventurer
It looks very much like your aspect ratio is incorrect.


glMultMatrixf((GLfloat*)&perspectiveMat);


When you're setting the projection matrix, why are you using 'multMatrix' instead of 'loadMatrix'. multMatrix will probably work the same if you're absolutely certain that the existing matrix is identity, but why take the chance?
Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action

shinyquagsire23
Explorer
I've been getting the same thing in some of my apps. Looking up and down will cause the world to skew slightly, and it's especially noticable when tilting your head on the Z axis (Roll). I might have a look at jherico's fix though.
Still need help?

Did this answer your question? If it didn’t, use our search to find other topics or create your own and other members of the community will help out.

If you need an agent to help with your Meta device, please contact our store support team here.

Having trouble with a Facebook or Instagram account? The best place to go for help with those accounts is the Facebook Help Center or the Instagram Help Center. This community can't help with those accounts.

Check out some popular posts here:

Getting Help from the Meta Quest Community

Tips and Tricks: Charging your Meta Quest Headset

Tips and Tricks: Help with Pairing your Meta Quest

Trouble With Facebook/Instagram Accounts?