Adding Bones to Shader Material

Hiya, I’m trying to add bones support for a shader material and hitting a road block…

So I made a playground that sets up a very simple shader for an animated, rigged mesh. It works as expected until I add the bones shader includes (commented out on lines 41 and 47) and then I get error messages about undeclared uniforms (or globals maybe?).

I tried to add them but can’t seem to do it the right way…

So can someone please help to add bones support for the shader material on this playground or point to an example?

Thank you!:slightly_smiling_face: :beers:

A finalWorld variable must exist before adding the bonesVertex include for the code to work.

Also, you should pass the world and viewProjection matrices instead of worldViewProjection as you will need to compose viewProjection with the updated finalWorld matrix:

https://playground.babylonjs.com/#BCU1XR#3305

2 Likes

Wonderful, thank you so much, I just added your solution to my project and it’s working perfectly! :smiley: :+1: