Hardware Skinning

Yes, that’s tricky. If you know you have only a uniform scale on the bones, you can do this:

normal = (mat3)matrix * normal;

If there are joints that are stretched (ie. have a scale that is not the same in x, y, z) then that won’t work and it’ll have to be something like:

normal = transpose(inverse((mat3)matrix)) * normal;

…however, that would be quite slow. We could alternatively pass two matrix tables to the shader, one with the inverse transpose 3x3 matrices for the normals, but that also sounds like trouble.

One “solution” is just to assert that you shouldn’t have non-uniform scales applied to bones, although it does sound useful to be able to do this for bone stretching and character customisation.

(This does not apply to binormals and tangents, of course.)