Hello Guest

[SOLVED] Skeletal Animation Shader

  • 0 Replies
  • 5025 Views
[SOLVED] Skeletal Animation Shader
« on: June 21, 2012, 13:22:08 »
Hey guys,

I got a little problem with my vertex shader:

Code: [Select]
#version 150

uniform mat4 bones[128]; // inverse bone bind matrices multiplied with the interpolated bone matrices
uniform mat4 bsm; // bind shape matrix
attribute vec4 weights;
attribute vec4 indices;

void main()
{
vec4 v = gl_Vertex;
vec4 finalVertex = vec4(0.0);

int index1 = int(indices.x);
finalVertex = bones[index1] * v; // right here... if i use bones[1] instead of bones[index1] it works fine :o (i am 100% sure that index1 == 1)

gl_FrontColor = weights;
gl_Position = gl_ModelViewProjectionMatrix * finalVertex;
}

Someone knows why this happens?

EDIT:
 - I read about that dynamic indexing isn't working on lower GLSL versions. Any workarounds?
 - This error only exists on an ATI graphics card. On my NVIDIA GC everything works fine.

SOLVED:
 - I exceeded the maximum usable uniforms and thus had to reduce the mat4 bones[128] to mat4[50]. I think i'll use quaternions in the future :)
« Last Edit: June 22, 2012, 17:34:03 by haubna »