From points to Mesh in Maya



Hello guys, I’m a beginner in Python programming for Maya and I was trying to understand how to set up a project I’m working on.
I have a point cloud whose informations are stored in a a text file that I’ll call A. In this file I have the coordinates of all the vertices of the point cloud. Then I have a second text file, that I’ll call B, in which I have different coordinates of the same vertices.
I have to import the point cloud in Maya, generate a mesh from it and create an animation that will move the vertices from the position A to the position B (all through Python).
How would you approach this problem?


I don’t believe that maya has any kind of built in tools for coping with point clouds.
I know that MeshLab has some tools to deal with point clouds, as does Houdini.

But there might be some plugins for remeshing a point cloud, I just don’t happen to know about any of them.


Sounds like an ideal case for a custom node that loads these point cloud data files. Using the API would also be the only way to get that kind of process to be performant at all . . .

There are lots of unknowns based on what you’ve described. Generating a mesh from an array of points is not trivial, especially if the array is not already ordered in a way that will create a valid mesh as you iterate over it and create triangles.


The point is that if I create the mesh with meshlab, then I don’t know how to map the vertices so that they go from position A to position B


What have you tried so far?

Do you have any idea what the final item is supposed to look like? For example, is it something that you can just generate a convex hull from?

Is the data sorted in some way that might make generating a mesh easier or harder? Are all the vertices already in some kind of order that just going three by three and building triangles from them actually workable?


No, the vertices are not ordered. I have another file that says how to put them together to generate tetrahedrons. Every line of this file is made like this:
3 4 2 5
to indicate that the first tetrahedron is made from the third, fourth, second and fifth verteces.

A friend of mine has suggested to me to create, out of Maya, a Python Program to create an obj file from these informations and then to simply import the obj into Maya, I think I’ll try even this solution.


Nice. Sounds like a good plan.


Looking at that file format snippet, you can probably reformat the data into OBJ without even processing it very much. OBJ files look like this:

  # List of geometric vertices, with (x,y,z[,w]) coordinates, w is optional and defaults to 1.0.
  v 0.123 0.234 0.345 
  v 1.0, 2.0, 3.0
  ... etc

  # Polygonal face element (see below)
  f 1 2 3
  f  2 3 3

  ... etc

You should be able to create tetras using those two elements. The subset of the format you need is documented here:


Yeah, I’ve resolved this a week ago creating a file .obj from the text files and removing the duplicate triangles to clean the mesh!