i have a animated glb model that works great, i tried to swap in a shader for vertex normals and now my animations wont play
const vertexShader = `
varying vec3 vNormal;
void main() {
vNormal = normal;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`;
const fragmentShader = `
varying vec3 vNormal;
void main() {
gl_FragColor = vec4(abs(vNormal), 1.0);
}
`;
const normalMaterial = new THREE.ShaderMaterial({
vertexShader,
fragmentShader,
});
const loader = new GLTFLoader();
loader.load('myguy.glb', (gltf) => {
gltf.scene.scale.set(2, 2, 2);
gltf.scene.traverse((object) => {
if (object.isMesh) {
object.material = normalMaterial;
object.castShadow = true;
}
});
this._target = gltf.scene;
this._params.scene.add(this._target);
``` my old working code without custom shader below```javascript
const loader = new GLTFLoader();
loader.load('myguy.glb', (gltf) => {
gltf.scene.scale.set(2, 2, 2);
gltf.scene.traverse(object => {
if ( object.isMesh ) object.castShadow = true;
});
this._target = gltf.scene;
this._params.scene.add(this._target);