1
$\begingroup$

Hello any advice would really be appreciated. I know there are lots of threads on this already but I have read many of them and I am still having trouble. I want to export a simple skeletal animation to a JSON file and play it in opengl. I am having trouble finding or calculating the correct matrix for each bone to send into the vertex shader.

I know this has been asked before but I have read a lot of threads and I am still having trouble with this. How do I get the final matrix for every bone to send to the vertex shader? What data do I need from blender for this?

I have tried using just the pose bone's matrix world, its parent's matrix_local times the pose bone's matrix_basis, many things but I always get a distorted model.

I'm pretty sure my vertices' bone weights and ids are working properly. This is my vertex shader (which is working) I think I'm just sending the wrong bone transforms

This is my vertex shader (it won't let me paste code) https://github.com/charmanderstrom/SkinnedVertexShader/blob/master/vertex_shader.glsl

$\endgroup$
  • $\begingroup$ As far as I know, vertex shaders require the matrix that transform the bone from rest pose to the animated pose, in model space coordinate system. Now, how to get that, no idea... $\endgroup$ – eric.m Aug 19 '19 at 6:53
  • $\begingroup$ My take is pose_bone.matrix @ pose_bone.bone.matrix_local.inverted(), but I can't test it. $\endgroup$ – eric.m Aug 19 '19 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.