How to generate mesh from vertices?


#1

Hi everyone!

I’m looking for an algorithm in Maxscript that generates a mesh from a set of vertices.

I have attached:

  • an example picture of how the meshing would work
  • a 3DS Max 2018 scene with a $vertices object that contains only vertices
  • a screenshot from the $vertices object

I hope anyone can help, meshing seems to be very complicated.

In 3DS Max there is the Pointcloud Object for meshing a point cloud, but it can only read RCS files and I cannot find a reference for that file format, otherwise I would generate such a file and import it.

Thanks!

meshing

vertices.max (604 KB)


#2

I can’t open your file so I’ll have to ask questions does it have a known order for the vertices ? left to right bottom to top for example or do they come completely random ?


#3

Hi Klvnk, the vertices have indeed a random order.

By the way, the file is for Max 2018, maybe that is an issue?

But the screenshot gives a good idea: randomly ordered points in 3D space that visually follow a surface.

Thanks


#4

theres a few algorithm for this sort of thing Delaunay triangulation and sweepline triangulation are a couple of examples… though i don’t know if anyone has implemented mxs versions of these. This kind of thing is not ideal in maxscript though it is possible.


#5

Thanks, unfortunately I’m not qualified to program such an algorithm…

It’s always just a small set of vertices so I was guessing Maxscript was up to the task.


#6

for each point create a spline with both knots in same position
then use this shape in terrain compound object


#7

Hi Serejah, I gave it a try because that is a brilliant misuse of the terrain compound object haha.

Unfortunately it only works for groups of vertices that are ‘horizontally organised’.

The vertically organised vertices are looked at ‘from above’ by the terrain object, which is not a surprise since it’s a terrain.

But still thanks for your input! I’m going to remember this for future solutions, it’s awesome :+1:


#8

yes, it won’t work if any point is exactly above of some other point
ZCKVDr2Jhf
Perhaps it can be fixed if we randomly move points a little before applying terrain. But then we’ll have to move them back to closest initial position.


#9

Ah yes, that is a good idea.

But unfortunately the terrain object creates a closed area from all the points.

The meshing should only occur where points are close enough together.


#10

if any triangle side of terrain mesh is longer than you would expect - delete this triangle


#11

yeah these tend to be 2d solutions, random moving of points will cause other issues (what is the correct direction to get the correct result)


#12

Good idea, I’m going to try that!


#13

If the points cloud is like the terrain (first image) and the vertices are somehow equidistant in two axis (x and y for example), you can rebuild a grid (plane) and assign just the z position to each vertex. You could also “fix” any minor offset in x or y axis if you need to.

For the second example, the one in the Max file, it is literally impossible to rebuild a geometry using just that information.


#14

Why don’t you use free and light MeshLab for that?
I remeber using screened poisson surface reconstruction filter for point clouds from photogrammetry, but there are others, simpler and faster (not that it would matter on such simple cloud)

Pointcloud Object shipped in Max 2015 wasn’t for meshing, just for rendering.


#15

Thanks domos, but it needs to automated in Maxscript…


#16

Thank you Polytools3D, I’ll have to divert to another starting point then…