# Morphing between meshes with unequal amount of vertices

## Recommended Posts

Hi there,

I do have a bunch of data measurements loaded as mesh. The following example represents one measurement:
https://www.babylonjs-playground.com/#XG8RH3#7

What I wanna do now is perform a kind of morphing between one measurement mesh and its consecutive measurement mesh.
I wanna create a kind of timeline from the first to the last measurement with morphing transitions.

I found: https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh
Do you guys think it is possible to apply it to my meshes?

I think I face a few issues here:
- The amount of vertices is not exactly the same in every measurement.
- Is there a maximum amount of vertices (e.g. 60.000) morphing can deal with?

Do you think morphing is still possible or do you have any other ideas how I could smoothly create a transition between the meshes?

##### Share on other sites

Hi Ziguri !

I don't think you will face any "maximum amount of vertices". Only computation issues. As Deltakosh said in this topic http://www.html5gamedevs.com/topic/31426-how-do-i-enable-32-bit-indices/ 32 bits indices are automatic when your mesh has more than 65k vertices  !

However, because morphing is "interpolation between static positions (given by static mesh),  for each vertex", I don't think you will be able to do a morphing between 2 meshes with different number of vertices.
Additionnaly, in morphing, indices of vertices must be given in the same order for the n meshes you want to morph from (to know which positions interpolate). That's why I am not sure you can reach a morph effect with raw measurement data without additionnal work on your meshes .

##### Share on other sites

Had a play with equalising vertices and triangular facets in 2 meshes.  Very very basic and sledge hammer to nut way of doing it and because the mapping of added vertices and facets is very primitive you get some poor results. The closer the two meshes are together the less weird the morph. So perhaps with more thought and finesse something might be workable.

Note that in the following PGs I have changed the type of mesh without changing name from ground

Morph ground to sphere  vertices very different   https://www.babylonjs-playground.com/#E6R01P

Morph cylinder to sphere vertices less different  https://www.babylonjs-playground.com/#E6R01P#1

Morph between two spheres, first sphere has less segments than target but closes to each other in number of vertices https://www.babylonjs-playground.com/#E6R01P#2

May be of no use at all but perhaps could lead to something.

•
##### Share on other sites

https://www.babylonjs-playground.com/#ZFUV4U#25

If you don't need them to be polygonal objects then rayMarching can be an option, but if they have to be a specific mesh then I am not sure.

I bet you could project to the nearest points between two meshes and then translate from that, but that process could make a myriad of problems as well.  The best way to do this is make sure your two meshes have the same poly-count and indexing.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.