In general, if you have code in language X that does a thing… and want to translate that to language Y… it pays to look for how to do that in language Y documentation.
In this case, you have code for extracting scale from a world rotation matrix… which is done in some other language but hopefully it is clear what it’s doing (accessing elements of a matrix and turning them into vectors). So step one would be to figure out how to “access matrix elements” in GLSL… best place to look at that is GLSL docs.
I simply searched for “GLSL matrix3” and found that doc… scrolled down and saw that it explains how to access matrix elements.
But you know, going one step further, I just googled “extract world scale from matrix3 in glsl”… which is exactly what you want.
I did look at that stack overflow post, as well as another that had a good visual representation of the math behind it
But the part I was lacking was the GLSL syntax with matrices. I did overlook the Khronos GLSL documentation however, but the Matrix section of the Khronos documentation you linked had a few good examples, and I was able to figure it out. Thanks
so, you could not say to us that its just picking values from mat3 matrix(taken from mat4)? instead of linking us document how to read matrix values that was not real answer?
For some reason I mistakenly thought a matrix4f was like working with a 4 dimensional array before I saw the example code in the Khronos doc. But now I see it is just a 4x4 size 2 dimensional array.
Her’e’s the GLSL code in JME context, hopefully this can help others learn how to use matrices if they find themself in a similar situation as myself
I was also able to check the result against the actual WorldScale to ensure that I figured out the math correctly, as I already had the code to pass the WorldScale in as a uniform prior to figuring out the math behind matrices.
And by the way, I didn’t mean this to sound as insulting as it might read. I was trying to highlight the fact that you guys hadn’t looked in the right place yet (the GLSL docs about matrix3).
It was clear you hadn’t because the translation was relatively straight-forward at that point (as already determined by now).
just wanted to say, that same as “Getting Answers” teach about that others dont read in mind.
same way “giving answers” here should also have in mind that “listeners dont read in mind”
main issue was we dont even knew that no need complex algebra matrix operations to solve it. If we would know, the document to find matrix simple operations would be next step for sure. (i had in mind complex algebra matrix operations going there)