• Create Account

# blowfish4

Member Since 03 Mar 2013
Offline Last Active Jun 14 2015 01:35 PM

### In Topic: HLSL mul() and row/column major matricies in directx

19 November 2014 - 06:43 PM

hodgeman, buckeye, vstrahk, thnks for your help. I'm pretty sure I get it now. i used row_major in front of my float4x4 WVP matrix. i was able to send in my WVP matrix and have the mul(vertex, WVP) work just fine. I was also able to do mul(PtVtWt, vertex) and that worked just fine. PtVtWt being the reversed order matrix if you multiply with a column vector which mul(matrix, vector) does.

### In Topic: HLSL mul() and row/column major matricies in directx

19 November 2014 - 05:04 PM

On the C++ side, the maths library that you're using will determine both the array storage convention and the mathematical convention.
What math library are you using?

I am using xnamath and it's matrices. I believe they are stored row-major because I must transpose them before sending them to the vertex shader. Now, in my vertex shader I have to use mul(vertex, matrix) because with mathematical "row-major" you go from left to right that is, vertex * world * view * projection. I know I must transpose the wvp because hlsl accepts matrices in its column-major storage.

### In Topic: HLSL mul() and row/column major matricies in directx

19 November 2014 - 04:01 PM

HLSL uses row-vector column-major math by default. I.e. it expects matrix to be column-major packed in order to do transform in most efficient way, with dot instructions.

How can I send in the WVP matrix, not having to transpose it?

### In Topic: HLSL mul() and row/column major matricies in directx

19 November 2014 - 01:04 PM

I am using xnamath, and I think this stores its matrices in row-major order. my view of w*v*p = (w*v*p)T is wrong when wondering if you could multiply pvw * vertex using column major. I am wondering now, why do I have to transpose the wvp matrix before sending to hlsl vertex shader? how does hlsl mul() function work, that is, how is mul(vertex, wvp) different from mul(wvp, vertex)? thanks

PARTNERS