Khronos Public Bugzilla
Bug 49 - Clarify matrix storage format description
Clarify matrix storage format description
Status: ASSIGNED
Product: COLLADA
Classification: Unclassified
Component: Specification
1.4.1
All All
: P3 enhancement
: Release 1.5.0
Assigned To: Daniel Horowitz
COLLADA Work Group email alias
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-18 05:04 PDT by Heinrich Fink
Modified: 2008-03-10 17:52 PDT (History)
2 users (show)

See Also:
elf: relnotes_141b-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heinrich Fink 2007-07-18 05:04:03 PDT
On page 93, in the description of the <matrix> element, the specification might be confusing about
the actual memory-layout of matrices. While the specification does not have any wrong statement as it
clearly defines that matrices are in column-order but written in row-major memory layout, some people
might be confused about the notion of a vector-convention (which is column-order) and the storage format (which is row-major, as the example on pg. 93 shows).

As a suggestion, the Remarks section might emphasize the memory layout again to clarify this issue.

regards, 

Heinrich
Comment 1 Mark Barnes 2007-07-19 13:20:41 PDT
This bug is in reference to https://collada.org/public_forum/viewtopic.php?t=677 .

COLLADA is an intermediate format and so there is no mention of memory storage layout on page 93 or anywhere else in the specification. The specification says:

Matrices in COLLADA are column matrices in the mathematical sense. These matrices are written in row major order to aid the human reader. See the example below.

<matrix>
 1.0 0.0 0.0 2.0
 0.0 1.0 0.0 3.0
 0.0 0.0 1.0 4.0
 0.0 0.0 0.0 1.0
</matrix>

ie as text in a document without newlines it is written like this:

<matrix> 1.0 0.0 0.0 2.0 0.0 1.0 0.0 3.0 0.0 0.0 1.0 4.0 0.0 0.0 0.0 1.0 </matrix>

... so that people reading it can see the columns as they are accustomed. This statement has nothing to do with the order that binary values are stored in a computer's memory. The word "memory" appears exactly once in the specification, unrelated to this discussion.

At best I can see that some polite form of this disclaimer would be useful to add somewhere in the specification. Suggestions?

PS: From the forum thread it appears there might be an implementation issue with the COLLADA DOM. If so a bug should be filed at sourceforge for that.
Comment 2 Ellen Finch 2007-07-19 13:36:37 PDT
(Internal note: Related to <a href="https://cvs.khronos.org/bugzilla/show_bug.cgi?id=569">khronos bug 569</a>)
Comment 3 Heinrich Fink 2007-07-20 03:35:02 PDT
(In reply to comment #1)
> This bug is in reference to
> https://collada.org/public_forum/viewtopic.php?t=677 .
> 
> COLLADA is an intermediate format and so there is no mention of memory storage
> layout on page 93 or anywhere else in the specification. The specification
> says:
> 
> Matrices in COLLADA are column matrices in the mathematical sense. These
> matrices are written in row major order to aid the human reader. See the
> example below.
> 
> <matrix>
>  1.0 0.0 0.0 2.0
>  0.0 1.0 0.0 3.0
>  0.0 0.0 1.0 4.0
>  0.0 0.0 0.0 1.0
> </matrix>
> 
> ie as text in a document without newlines it is written like this:
> 
> <matrix> 1.0 0.0 0.0 2.0 0.0 1.0 0.0 3.0 0.0 0.0 1.0 4.0 0.0 0.0 0.0 1.0
> </matrix>
> 
> ... so that people reading it can see the columns as they are accustomed. This
> statement has nothing to do with the order that binary values are stored in a
> computer's memory. The word "memory" appears exactly once in the specification,
> unrelated to this discussion.

"memory layout" was definitely the wrong term here. I was rather talking about the layout of matrix elements in the floating point array of <matrix> with 16 elements and how to correctly interpret them. E.g. from the example it is clear you will find the translation-vector of the transformation in the 4th, 8th and 12th element. 

But actually the original issue that started the thread in the forum ( https://collada.org/public_forum/viewtopic.php?t=677 ) was about how to interpret the float4x4 value types of COLLADA Scope Core Value Type (pg. 288 in the spec) in COLLADAFX. In the forum it was then assumed they would have the same layout like the <matrix> floating-point arrays. But there is no actual note of that in the spec.  On the other hand it was assumed that float4x4 types in CG and GLSL Scope are written like in its Shader language (row-major for CG, col-major for GLSL). So if you compare a transformation matrix between GLSL Scope and either COLLADA Scope Core Value Types or CG Scope Value Types you would then have to take the different layout into account.

Maybe I'm completely wrong with this approach, if so please correct me.

- h
Comment 4 Mark Barnes 2007-07-24 12:33:44 PDT
Daniel please clarify this assumption for the specificaiton.

(In reply to comment #3)
> But actually the original issue that started the thread in the forum (
> https://collada.org/public_forum/viewtopic.php?t=677 ) was about how to
> interpret the float4x4 value types of COLLADA Scope Core Value Type (pg. 288 in
> the spec) in COLLADAFX. In the forum it was then assumed they would have the
> same layout like the <matrix> floating-point arrays. But there is no actual
> note of that in the spec.  On the other hand it was assumed that float4x4 types
> in CG and GLSL Scope are written like in its Shader language (row-major for CG,
> col-major for GLSL).
Comment 5 Ellen Finch 2007-07-30 14:57:32 PDT
Haven't been able to clarify/confirm with Members before 1.4.2 Rev B release notes, so won't be included there.
Comment 6 Mark Barnes 2008-03-10 17:52:39 PDT
Daniel can you answer resolve this issue by tomorrow? Thanks.