Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Definition of MAX_VERTEX_UNIFORM_VECTORS with respect to Mat4s?

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Location
    California
    Posts
    145

    Question 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. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    You should divide the limit by four.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Location
    California
    Posts
    145
    Quote Originally Posted by aqnuep View Post
    You should divide the limit by four.
    Okay, 32 is no good. You need 128 matrices to do GPU skinning.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Quote Originally Posted by JoshKlint View Post
    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.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882
    Quote Originally Posted by aqnuep View Post
    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.
    Last edited by Dark Photon; 08-03-2012 at 02:24 PM.

Posting Permissions

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