I'm trying to tweak Particle Dreams demo by Nop Jiarathanakul and port it to newer THREE.JS version and glTF format.
While the code has complex structure, I couldn't publish as a snippet, however the current state is available here.
It works fine with horse model taken from THREE.JS examples while it's based on morph targets.
But, what if glTF doesn't have morph targets, since it's an old technology, and based on skeleton kinematics.
Pretty sure that I need to update shaders/UVMapShader.vs.glsl
varying vec3 vPos;
#ifdef USE_MORPHTARGETS
uniform float morphTargetInfluences[ 4 ];
#endif
void main() {
#ifdef USE_MORPHTARGETS
vec3 morphed = vec3( 0.0 );
morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
morphed += position;
vPos = (modelMatrix * vec4(morphed, 1.0)).xyz;
#else
vPos = (modelMatrix * vec4(position, 1.0)).xyz;
#endif
vec2 drawUV = uv * 2.0 - 1.0;
gl_Position = vec4(drawUV.x, drawUV.y, 0.0, 1.0);
}