Generating a mesh from reference

Hello everyone!
I am trying to create an effect that creates geometry from script.
While generally, this seems to work, I am facing a problem:
As a reference mesh, I want to use geometry that I modeled in Blender.
Then, the mesh is supposed to be generated face by face.

This is how I get the triangles:

referenceMeshFX01.GetComponent<MeshFilter>().sharedMesh.triangles[i];

The problem is that the order is messed up. It will generate the mesh, but not in the right order.
Is there a way to change the order in Unity or Blender?
Or do I seriously have to check the order and type in values according to that manually?
This would be quite some work.

Many thanks for any ideas,
Greetings,
Shu

Blender and Unity use different internal representation for storing meshes. If you want to have the faces sorted in a specific order, you could specify the order by other means. For instance using an extra UV layer or some vertex weighting, then use these data to sort the faces at runtime.

1 Like

@ericbegue
Thanks a lot for your ideas!
I just used another workaround on one of the effects:

  • Splitting the mesh into several submeshes (1 submesh for each frame step)
  • Assigning a new submesh each frame

But I sure can’t proceed like this for every effect.
So I will probably try to do this using multiple UV layers as you suggested.
This seems to be the most convenient way of doing this.