-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Questions regarding Mtx_Translate() #55
Comments
C3D_Mtx bRightSide=true is an OpenGL-style right-handed coordinate system where matrix multiplication is right-associative and has the "effects" from right-to-left. C3D_Mtx bRightSide=false is an DirectX-style left-handed coordinate system where matrix multiplication is left-associative and has the "effects" from left-to-right. |
Thanks, that helps. In light of that, I think I may have found something wrong in TinyGL test file results: Citro3D test file results (matrix printouts flipped horizontally for ease of comparison): While the other functions produce appropriate results in the Citro3D test, Am I correct in concluding that |
Have you had a look at https://github.com/devkitPro/citro3d/tree/master/test? |
I probably did something wrong like install the wrong version of GLM, so I included the whole shebang in the pastebin (GLM install, build process, and test). |
Sorry looks like glm changed the way default constructors work. They are now uninitialized (or zero-initialized; didn't check) instead of identity-constructed. I created a branch https://github.com/devkitPro/citro3d/tree/update-glm that restores that behavior for the test, and also prints out the actual/expected data on failures. |
On the off chance I didn't screw up on my end, I went through and figured out which of the asserts were failing. I did this by going through and commenting out each line the test program failed at. EDIT: Missed your reply, but this might be useful anyway. check_matrixcheck identity
check inverse (which you're aware of)
check perspective tilt
check perspective stereo tilt
check ortho tilt
check lookAt
check translate (reversed)
check rotate (reversed)
check rotate X (reversed)
check rotate Y (reversed)
check rotate Z (reversed)
check_quarternioncheck identity
check rotation
check rotate X
check rotate Y
check rotate Z
|
Just tried the updated test file and yeah, everything passes on that one. Guess I just need to look at all this more to familiarize myself with it. |
I would suggest inserting TinyGL into these tests and going from there |
That's a good idea, I'll try that. |
@mtheall I hope you don't mind me reusing this to avoid cluttering up the issues page. I noticed that the code in mtx_persp.c is different than that of the WolframAlpha equation it links to. Shouldn't line 16 read: |
3DS GPU clip space has z in [-1, 0] where e.g. OpenGL has it in [-1, 1] |
Please be patient with me as I am extremely new to graphics libraries and the math involved in 3D rendering, and frankly have very little idea of what I'm talking about in general.
Background: ScummVM uses a modified version of TinyGL (a stripped-down version of OpenGL) to run several 3D games such as Grim Fandango and Myst 3: Exile on lower-end systems (including the 3DS), provided their ScummVM engine has alternate, TinyGL-specific graphics code. The problem is that attempting to run said 3D games crashes the system. Interestingly, the one 3D game that will run on the 3DS (Westwood's Blade Runner), does not use OpenGL nor TinyGL.
Anyway, there was speculation that the issue might be solved by having the 3DS hardware take over some functions. Since the 3DS backend for ScummVM already uses citro3d for screen rendering, I thought it might be worthwhile to try and write a version of ScummVM's TinyGL implementation that utilizes citro3d. Needless to say, due to tinyGL being column-major and citro3d being row-major, I've been in a slog from the beginning.
What I think I know: Correct me if I'm wrong on any of this. To my understanding, converting between column-major and row-major layout simply requires transposing the matrix (and in citro3d's case, additionally flipping the matrix horizontally to account for PICA200's WZYX ordering). This seemed to work out fine for matrix rotation, as doing this then performing a left-handed
MTX_Rotate()
produced the same values as TinyGL'sglopRotate()
(with value positions changed appropriately).In TinyGL, the translation matrix in its
Matrix4::translate()
looks like this:Therefore, I expected that citro3d's translation matrix would be situated like this (but flipped horizontally, of course):
However, according to citro3d's code, a left-sided
MTX_Translate()
changes every cell's value EXCEPT those in the bottom-row. Additionally, right-handedMtx_Translate()
uses a translation matrix that is a horizontal mirror of TinyGL's translation matrix, changing only the W cells.Questions:
The text was updated successfully, but these errors were encountered: