glsl matrix palette

Member
Posts: 86
Joined: 2008.04
Post: #1
Thanks in advance for any help/advice

I am trying to move my skinning animation into the shader from the cpu.

I am passing the matrix palette as
Code:
const int BoneCount = 86;
uniform mat4 Matrix_Palette[BoneCount];

and I am passing the palette indices as a vec4 attribute
Code:
attribute vec4 indices;

My problem is that using the attribute instead of a constant index value drops the framerate in half...

e.g
Code:
vec4 skinned_position = Matrix_Palette[int(indices.x)] * position;  //30 fps
//VS
    vec4 skinned_position = Matrix_Palette[0] * position;  // 60 fps

Please help! This is driving me nuts
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
That's a lot of uniform data, and accessing it all is likely to produce a performance penalty. 60->30 means little if you're vsync'd; that could represent a very small increase in frame time.

If you put your shaders in OpenGL Shader Builder does it indicate a software fallback?

If you want much more help, please post whole shaders and GPU info.
Quote this message in a reply
Member
Posts: 86
Joined: 2008.04
Post: #3
Thanks OSC...

I can even do double the processing work (over 3k more matrix vector multiplies):
Code:
vec4 skinned_position = Matrix_Palette[0] * position * 0.5;
    vec4 skinned_position2 = Matrix_Palette[1] * position * 0.5;    
    vec4 outposition = skinned_position + skinned_position2;
at 60 fps.

while
Code:
int j=1;
    vec4 skinned_position2 = Matrix_Palette[j] * position * 0.5;
    gl_Position = Projection * Modelview * skinned_position2;
is still locked at 29.


The funny thing is that it only happens on a significantly faster ATI Radeon HD 5750 desktop.
My macbook pros Geforce NVIDIA 9600M GT stays pegged at 60 for all test cases.

I am using displaylink - is there an easy way to turn off vsync when using displaylink?

I am going to try it with less bones - the current md5 model I have is using 86, but I think I will probably target 32.
Quote this message in a reply
Member
Posts: 86
Joined: 2008.04
Post: #4
OSC - You were right - 50 bones still cranks at 60 fps....but 70 bones are still slow.

hmmmm GL_MAX_VERTEX_UNIFORM_COMPONENTS 4096

My shader has:
const int BoneCount = 50;
uniform mat4 Projection;
uniform mat4 Modelview;
uniform mat4 Matrix_Palette[BoneCount];

isn't that 16+16+16*50=832?
or is that in bytes e.g. 832x4=3328? I think a vertex_component is a float so that should only be 832.

I found a similar old post on opengl.org about an ati issue
http://www.opengl.org/discussion_boards/...ber=267068

I'll be ok if I target 50 bones or less - but it seems like a silly limitation - should I file a radar?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
You didn't answer the software fallback question.

If you want *that* many bones, you could try using bindable uniforms. But what on earth are you doing Rasp
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Palette animation unknown 10 4,287 Feb 13, 2006 02:41 PM
Last Post: akb825