Closed CodeSmith32 closed 2 weeks ago
FWIW, with some experimentation (but not with certainty), constructor ordering seems to be column-major.
i.e., mat3(vec3, vec3, vec3)
seems to be vectors of columns, not rows.
It describes that they are column major, but it's contradictory in the second clause:
For matrices, use the
m[column][row]
indexing syntax to access each scalar
And
or
m[idx]
to access a vector by row index.
So generally it's stated to be column major, which is to match GDScript I assume
But some more clarification would be good
Duplicate of #5805
Your Godot version:
Godot v4.2.2
Issue description:
The Godot shader language documentation for matrix column- vs. row-major ordering is very unclear:
matx( vecx, vecx... )
constructor form is column- or row- major.matrix[2]
is a row not a column) which completely diverts from GLSL, and also seems like a terrible decision since two-dimensional array access is column-major (matrix[2][1]
is the 2nd column, then the 1st row). Is this true? Or is it a documentation discrepancy?URL to the documentation page:
Live documentation: https://docs.godotengine.org/en/stable/tutorials/shaders/shader_reference/shading_language.html#members
GitHub file: https://github.com/godotengine/godot-docs/blob/4.2/tutorials/shaders/shader_reference/shading_language.rst?plain=1#L112