last day (15 days later) » 

3:17 PM
1
Q: Matrix Rotation: Y and Z axes are flipped?

Karai17A friend and myself are working on a game and have been running into trouble for the last week or so with animating models. We've written a custom IQE model format loader and matrix library and are using a third party quaternion library (we had our own quaternion code but used a third party one i...

 
How can i read dll code? ^^ I think you have an general understanding problem: If you perform matrix rotation, you always rotate about an axis. Rotating about the Y axis means, you rotate all the vertices around the Y axis. For example if you move your mouse left and right in a first person game, you rotate the camera about its own Y axis. Rotating around the X axis would be moving the mouse forward and backward. Do you understand what i mean?
 
Yes, I am aware of how matrix rotation works. If you watch the video, you'll note that on the left size, the X cubes are all working on the X axis. Translate move right, scale expands left and right, and rotate spins toward the camera. This indicates that the X axis is horizontal. The problem here is that rotating on Y spins on the Z axis (depth), while moving and expanding on the Y axis (vertical), and vice versa.
Also, to read the code, you need to unzip game.exe (it is a fused zip file).
 
ah okay, now i understand. wait, i'll take a look on the code.
I dont have any idea of what lua is or how it works, but the code seems to be right actually. Maybe you could test if the model matrix is REALLY right? take an identity 4x4 matrix, translate to (2, 2, 2) and rotate about y about toRadians(45). The result should be [0.70710677, 0.0, 0.70710677, 2.0, 0.0, 1.0, 0.0, 2.0, -0.70710677, 0.0, 0.70710677, 2.0, 0.0, 0.0, 0.0, 1.0] is that the case?
 
Thanks for the test case. We are getting the following result: [ 0.70711, 0.00000, -0.70711, 0.00000, 0.00000, 1.00000, 0.00000, 0.00000, 0.70711, 0.00000, 0.70711, 0.00000, 2.82843, 2.00000, 0.00000, 1.00000 ]. Our matrix library is column-major, is that what your results should be? Regardless, something does look wrong here (we are getting a 2.8???)
 
3:45 PM
hey. hmmm the 2.8 looks weird.
Lwjgl (thats where ive done this) is also saving the matrices column-major. But what i send you was in rows, so every 4 values are one row
so this is what i get. First matrix: identity, second: translation to (2, 2, 2) third one rotating about Y axis about radians(45)
so your result seems to be right, but the x translation changed to 2.8.. why??
 
Looking into it now... Everything seems fine up until the final step. I'll post results in a few moments.
 
4:07 PM
Here is how LWJGL does rotation: Maybe that helpls you?
I didnt understand your rotation code very well...
im afk now. About 10pm i could be here again. bye
 
4:30 PM
Here is a step-by-step output of our multiplication:

identity: [ 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 1.00000 ]
translate: [ 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 1.00000, 0.00000, 2.00000, 2.00000, 2.00000, 1.00000 ]
beginning mult
input a: [ 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 1.00000, 0.00000, 0.00000, 0.00000, 0.00000, 1.00000, 0.00000, 2.00000, 2.00000, 2.00000, 1.00000 ]
aaaaaaand it turns out we're idiots, and had our multiplication backwards. Will update with progress...
 
5:11 PM
FINALLY! After fixing all of our multiplications, it all works PERFECTLY! Thank you very much for the lead! :)
 

last day (15 days later) »