Hi,

Does anyone have any example custom shaders that work on skinned characters?

I’m trying to write the skinned vertex part myself, but I’m getting stuck trying to access the skinned bone matrix data to send through to the vertex shader.

Here’s my vertex shader so far:

```
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform mat4 boneMatrices[ MAX_BONES ];
mat4 getBoneMatrix( const in float i ) {
mat4 bone = boneMatrices[ int(i) ];
return bone;
}
void main() {
vUv0 = aUv0;
vCol = aCol;
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
vec4 skinVertex = bindMatrix * vec4( aPosition, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
skinned = bindMatrixInverse * skinned;
vec4 mvPosition = matrix_model * skinned;
gl_Position = matrix_viewProjection * matrix_model * vec4(aPosition*100.0, 1.0);
}
```

I need to pass in the bindMatrix, bindMatrixInverse, and boneMatrices. But I don’t know how to get them from my fbx animated character.

(I’ve worked out how to get the Indexes and weights with this

```
skinIndex: pc.SEMANTIC_BLENDINDICES,
skinWeight: pc.SEMANTIC_BLENDWEIGHT
```

)