iDevGames Forums
glsl matrix palette - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: glsl matrix palette (/thread-8971.html)

glsl matrix palette - OptimisticMonkey - May 17, 2011 02:32 PM

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
const int BoneCount = 86;
uniform mat4 Matrix_Palette[BoneCount];

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

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

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

Please help! This is driving me nuts

RE: glsl matrix palette - OneSadCookie - May 17, 2011 05:17 PM

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.

RE: glsl matrix palette - OptimisticMonkey - May 17, 2011 09:02 PM

Thanks OSC...

I can even do double the processing work (over 3k more matrix vector multiplies):
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.

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.

RE: glsl matrix palette - OptimisticMonkey - May 17, 2011 09:29 PM

OSC - You were right - 50 bones still cranks at 60 fps....but 70 bones are still slow.


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 about an ati issue

I'll be ok if I target 50 bones or less - but it seems like a silly limitation - should I file a radar?

RE: glsl matrix palette - OneSadCookie - May 17, 2011 10:23 PM

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