skeletal animation on GPU

Yes finally got the shader that handle bones transformations 😉 I’m happy  the fps increase 50% yes im’ happy.


Run Demo



attribute vec3 inVertexPosition;
attribute vec2 inTexCoord0;
attribute vec4 BoneIDs;
attribute vec4 Weights;

uniform mat4 WorldMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 gBones[40];

varying vec2 varTexCoord0;
void main(void)
int index0 = int(BoneIDs[0]);
int index1 = int(BoneIDs[1]);
int index2 = int(BoneIDs[2]);
int index3 = int(BoneIDs[3]);

mat4 BoneTransform = gBones[index0] * Weights.x;
BoneTransform += gBones[index1] * Weights.y;
BoneTransform += gBones[index2] * Weights.z;
BoneTransform += gBones[index3] * Weights.w;
vec4 PosL = BoneTransform * vec4(inVertexPosition, 1.0);

varTexCoord0 = inTexCoord0;
gl_Position = ProjectionMatrix * ViewMatrix * WorldMatrix * PosL;



One response

  1. Pingback: Haxe Vertex Interpolated In Shader | Djoker Games Programming Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s