How can i morph objects with different number of vertices

So I followed an online tutorial of making a particle system and it’s all working fine but now I wanna morph these particles to other shapes, I tried to put all the 3 objects to the “fillPositions(texture) {}” and then have a uniform float of morphFactor with 1-3 values, where 1 is the first object and 3 is the third object. so that i can put the morph factor value on the controls and change the particles to map on vertices but the problem is that the mesh inside each GLB file doesn’t have the same number of vertices. The models are all rocks I made in blender. so I need some help getting these particles morphing with different number of vertices in models.

Here’s my sandbox code:

As far as I know, morphing is always done between sets of equal number of elements. You can, of course, try to circumvent this, but most likely you will not like the cost for doing this.

For example, morphing a 1000-vertex geometry into 800-vertex geometry could be made by converging some of the vertices into one vertex. To implement this, you might need to change the shader chunk that does the actual morphing, or to do the morphing on CPU, if the vertices are not too much.

Unfortunately, this will not work in the opposite direction. Going from 800-vertex geometry to 1000-vertex geometry is impossible, because the GPU will not cooperate in adding new vertices. Maybe in the future it will be possible, when mobile 3D becomes as powerful as desktop 3D.

Thus, my advice is to have the models with various vertices, as they are now, but when loading a model add new fake vertices (duplicates of existing vertices), so all models will have the same number of vertices. Then do morphing as usual.


That’s a good option, there’s also the option of using MeshSurfaceSampler which would return you an equal set of sampled “positions” on the surface of each mesh…


Oh ok, I’ll try duplicating the vertices. The difference between the number of vertices of each model is somewhere between 300-400, so I’ll try that. Thank you!

I think i saw a great example for mesh surface sampler on codedrops, Imma try this one too and see which ones goes well, Thank you!

Shapeshift (gltf + MeshSurfaceSampler): Instanced particle morph animation - #6 by prisoner849


I just checked the codepen you linked in their and ye that would do it but I’m gonna add some noise to the surface and see how it looks, Thanks mate!