Matrix formatting difference between VEX and OpenCL

   1187   4   1
User Avatar
Member
102 posts
Joined: 5月 2013
オフライン
I'm following Jeff Lait's OpenCL masterclass (https://vimeo.com/241568199) and trying to understand some matrix maths a bit better. I'm familiar with using them in VEX but without much of a grasp of the underlying theories.

In the example looking up a volume and setting point colour depending on the result (approx 1:04:50) he multiplies the x y and z components of the point position by separate rows of a transform matrix, specifically the x component by the bottom row, the y by the second from bottom row and the z by the second from top.

I tried replicating this is VEX just because easier to output debug attribs and to do the same thing I need to reverse the row order ie multiply P.x with the TOP row, P.y by the second from top etc.

Can someone tell me are matrices in OpenCL just upside down compared to VEX?
Image Not Found
Edited by j00ey - 2025年1月6日 07:48:46
User Avatar
Member
102 posts
Joined: 5月 2013
オフライン
OpenCL version :
Edited by j00ey - 2025年1月6日 07:47:11

Attachments:
Screenshot 2025-01-06 123556.png (39.0 KB)

User Avatar
Member
102 posts
Joined: 5月 2013
オフライン
VEX version :

Attachments:
Screenshot 2025-01-06 124430.png (88.0 KB)

User Avatar
スタッフ
6741 posts
Joined: 7月 2005
オフライン
A float4 in OpenCL is laid out in memory as xyzw.
.lo refers to the front half of the vector, so xy, and .hi to the back half, or zw.

The same is with float16, so .lo is the first 8 floats in memory, and .hi the next 8 floats.

The second .hi / .lo then further grabs the first 4 floats or last 4 floats of those setups.

Thus .lo.lo refers to the FIRST four floats in memory. This is what would normally be called the "top row", row zero and columns zero through three. So I think OpenCL is already doing what you expected in VEX.
User Avatar
Member
102 posts
Joined: 5月 2013
オフライン
Thanks for clarifying Jeff. I was imagining it laid out as a 4x4 grid with the lo referring to literally the lower half. Makes sense now.
  • Quick Links