# Thread: Definition of MAX_VERTEX_UNIFORM_VECTORS with respect to Mat4s?

1. ## Definition of MAX_VERTEX_UNIFORM_VECTORS with respect to Mat4s?

According to the OpenGLES spec all implementations are guaranteed to support at least 128 elements in a uniform vector array:
MAX VERTEX UNIFORM VECTORS  128 GetIntegerv
http://www.khronos.org/registry/gles...pec_2.0.24.pdf

How does that translate to Mat4's? Is a Mat4 considered a kind of vector (like a 16-dimensional vector) or should you divide 128 by four to get the max number of elements in a Mat4 uniform array?

2. You should divide the limit by four.

3. Originally Posted by aqnuep
You should divide the limit by four.
Okay, 32 is no good. You need 128 matrices to do GPU skinning.

4. Originally Posted by JoshKlint
Okay, 32 is no good. You need 128 matrices to do GPU skinning.
Can you explain why? I don't believe you need that many matrices for GPU skinning, but depends on how you plan to do it.
On the other hand, you can also use quaternions. That way you just don't reduce your uniform footprint by 50% but you also avoid interpolation issues otherwise present when using matrices.
Also, with matrices you don't need to have an actual 4x4 matrix for skinning, 3x4 is perfectly fine as you want only rotation and translation but no projection.
Finally, if vertex texture fetch is supported by your target hardware (I think most mobile GPUs do support it) then you can store your matrices in textures too.

5. Originally Posted by aqnuep
On the other hand, you can also use quaternions. That way you just don't reduce your uniform footprint by 50% but you also avoid interpolation issues otherwise present when using matrices.
Yep. This works well if you limit your joint influences to at most 2 per vertex, and insist that they be adjacent joints.

If you need 3+ joint influences/vertex and/or non-adjacent joint influences, use Dual Quaternions (DQ) -- only adds a single float over Quat/Trans. In these cases with Quat/Trans, you have to solve for a "compromise" rot center for each influence permutation and use more complex skinning. DQs avoid all that and look better.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•