Tuesday 15 June 2010

glsl - How to Make Large Matrix Multiply -


I am trying to create a GLSL shader which increases the 90x10 matrix with a 10x1 one. The 90x1 result corresponds to xyz values ​​of 30 seconds. The first big matrix is ​​loaded only at startup. The second matrix, on the other hand, can change in each render.

How can this be done? I am finding that the matrix can be stored in the form of textures, but I do not know what to do with the other.

Pass the second matrix just as a single array of floats.

  Uniform float vec10 [10];   

and display the multiplication element by element.

Note that if this is very slow, then you can try packing your large texture in such a way that you can read 4 elements with the same texflash.

If you want to see the syntax, to force uniform arrays, consult.

Note, it is also completely legal to store these other matrix in the texture; I have the conclusion that it is not certain about the effect of the performance that unlike sending it as a uniform. But first make it work, create profiles and optimize later.

No comments:

Post a Comment