# Glb vertex animation

**URL:** <https://forum.babylonjs.com/t/glb-vertex-animation/20406>\
**Category:** Questions\
**Created:** [April 28, 2021, 6:36pm UTC](https://forum.babylonjs.com/t/glb-vertex-animation/20406 "2021-04-28T18:36:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MOTYA](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/motya/32/37956_2.png) [@MOTYA](https://forum.babylonjs.com/u/MOTYA)\
**Post date:** [April 28, 2021, 6:36pm UTC](https://forum.babylonjs.com/t/glb-vertex-animation/20406/1 "2021-04-28T18:36:11Z")

</div>

Hi !, I tried to make a vertex animation, everything works with the babylon format, but the files are too large, I tried with the glb format and ran into a problem that can be seen from the link, I also attach the shader code ` BABYLON.Effect.ShadersStore.customVertexShader =`// Vertex shader  
precision highp float;  
// Attributes  
attribute vec2 uv;  
attribute vec2 uv2;  
attribute vec4 animation;  
attribute vec3 position;  
attribute vec3 color;  
attribute vec4 world0;  
attribute vec4 world1;  
attribute vec4 world2;  
attribute vec4 world3;  
// Uniforms  
uniform mat4 worldViewProjection;  
uniform float totalFrames;  
uniform highp sampler2D texAnim;  
uniform float T;  
uniform float a;  
// Varying  
varying vec2 vUV;  
varying vec3 vColor;  
void main(void) {  
vColor = color;  
vec2 uvp = uv;  
float fStart = animation.x;  
float fEnd = animation.y;  
float tot = totalFrames;  
float b = fStart/tot;  
float c = fEnd/tot;  
float d = fract(T/(c-b))_(c-b)+b;  
float f = T_30.0/(tot);  
float e = fract(f/((fEnd-fStart)/(tot)))\*((fEnd-fStart)/(tot)) + b;  
vec2 uvPos2 = vec2(uv.x,uv.y - e);  
vec4 pos1 = texture2D(texAnim ,uvPos2);  
pos1 -= vec4(0.5,.5,0.05,0);  
pos1 \*= 100.0;  
gl\_Position = worldViewProjection \* vec4(pos1.xyz,1.0);  
vUV = uv;  
}`; BABYLON.Effect.ShadersStore.customFragmentShader = `  
precision highp float;  
precision mediump float;  
varying vec2 vUV;  
varying vec3 vColor;  
uniform sampler2D texDiff;  
void main(void) {  
gl\_FragColor = vec4(vColor,1.0);  
}`; var shader = new BABYLON.ShaderMaterial("shaderGradient", scene, "custom",{ attributes: ["animation","uv2","uv","color","position"], defines: ["#define INSTANCES"], uniforms: ["texDiff","totalFrames","texAnim","worldViewProjection","T"] });`

and link))? sorry its not playgroundLink but CORS dont access load my files from server or dropbox(  
[https://motya.v3normalize.ru/shaderBallGLB/](https://motya.v3normalize.ru/shaderBallGLB/)

---

<div class="post-metadata">

**Author:** ![Drigax](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drigax/32/16585_2.png) [@Drigax](https://forum.babylonjs.com/u/Drigax)\
**Post date:** [April 28, 2021, 8:11pm UTC](https://forum.babylonjs.com/t/glb-vertex-animation/20406/2 "2021-04-28T20:11:49Z")

</div>

@MOTYA glTF doesn’t support vertex animation, only morph target animation.

---

<div class="post-metadata">

**Author:** ![MOTYA](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/motya/32/37956_2.png) [@MOTYA](https://forum.babylonjs.com/u/MOTYA)\
**Post date:** [April 29, 2021, 10:29am UTC](https://forum.babylonjs.com/t/glb-vertex-animation/20406/3 "2021-04-29T10:29:24Z")

</div>

you misunderstood), I put together static little men on the shader and with glb, but when I try to animate them, everything breaks

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [April 29, 2021, 9:18pm UTC](https://forum.babylonjs.com/t/glb-vertex-animation/20406/4 "2021-04-29T21:18:03Z")

</div>

A playground would be much easier. You should be able to access external files using one of the ways documented here: [Using External Assets In the Playground | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/toolsAndResources/tools/playground/externalPGAssets)
