Hi all, I have an asset pipeline from Blender -> GLTF2.0 -> BablyonJS that seems to me like it should work but I’m running into an issue with morph target animations combined with a ShaderMaterial. The animation works fine with a StandardMaterial but fails with ShaderMaterial. I assume there’s something I need to do in my custom material to properly support the animation.
I have…
A mesh I created in Blender and added a Shape Key.
Animated that shape key in blender.
Exported the mesh and the animation as a .glb (GLTF2.0)
Imported that mesh and animation via BABYLON.SceneLoader.LoadAssetContainer()
Added the AbstractMesh to the scene via scene.addMesh(mesh, true);
Added the AnimationGroup to the scene via scene.addAnimationGroup(animationGroup);
Play the animation via animGroup.play(true);
When I put a StandardMaterial on the mesh, the animation plays. When I put my ShaderMaterial on the mesh, it doesn’t. I’m assuming I’m missing something in the vertex shader. Mine is pretty straight forward, all the exciting bits are the in fragment shader.
@Deltakosh Cool! The NodeMaterial looks like it could be a great solution. I’ll have to dig into those and see what I can do. My Fragment shader isn’t too complex, I’m just fading out half the mesh that’s facing a direction in world space and doing different effects on the front and back faces of the model.
Is there a reference implementation of a shader that supports Morph Target animations I could look at, or some documentation on the requirements for such a shader?
I was digging through the StandardMaterial and default.vertex.fx but with everything going on in there it is rough trying to find and extract the bits I need.