PDA

View Full Version : Would it be acceptable to use texture as a blob of data for armature transformation?



LapisSea
07-18-2017, 09:51 AM
This is my first post here so sorry if I missed something obvious. :p

So I am really not keen of the ivec3 / ivec4 attributes that serve as pointers to matrix array uniform. I did some brainstorming and I figured why not use a grayscale texture the same as I would when reading a binary format file?
By that I mean something in terms of
(every keyword is 1 pixel aka 8bit or 16 bit number)
weightCount1, matrixId1, weight1, matrixId2, weight2... weightCount2, matrixId1, weight1, matrixId2, weight2...

code in question:
https://github.com/LapisSea/OpenGL-Bullet-engine/blob/master/res/shaders/modules/Armature.vsmd
https://github.com/LapisSea/OpenGL-Bullet-engine/blob/master/res/shaders/modules/TextureBinary.smd


Notes:

I built a "shader loader" that finds #include "..." and replaces it with contents of a matching file that it is pointing to and I am using <NAME> as values that are replaced by values that are known only in java. (such as config values)
I am using LWJGL 2 (java api for cross platform bindings for OpenGL)
I am using opengl 3.2 profile




I never used textures as raw data so i am not really sure how this would impact performance.

Thank you for your time!