Hi everyone,
I’m excited to post again in the JMonkey Hub!
I’m working on creating a mesh surface around a complex object (composed of a group of geometries). Using a complex algorithm, I’ve managed to generate a set of points that surround the object. Now, I need to triangulate these points to form a 3D mesh. I started searching for a way to triangulate the points to create a 3D mesh. There where many libraries for 2D triangulation but less for 3D. I found some good options such as TetGen Library, JTriangle and most of them support Delaunay and ear clipping triangulation. However, all of them can handle concave shape efficiently, but can’t handle concave shapes. Some of them need constraints that describe the general layout of the mesh to generate correct triangles like general boundaries of the mesh like the following image.
It can have random shape and can have holes. How can I triangulate my concave shaped mesh without having explicit constraints?
Also, I suggest including the triangulation functionality in JME. This can be very useful for games were meshes can be modified in real time such as the ability to cut objects with a sword or puncturing a wall with a bullet.
Arguably an object with holes can’t be uniquely defined by points. You could always string a hole inbetween the points; how is the triangulaiser to know.
Can you produce voxels for your shape? I wonder if that would allow you to find the contraints the later library wants
Thanks @richtea and @pspeed. I assumed this is possible as Delaunay algorithm can triangulate any set of points into convex shape.
My object is composed of collection of small balls connected to each other. I want to create a surface for this object that is slightly larger than it so the surface covers all the balls but don’t touch any of them (the distance between the surface and each exterior ball is 1.4m). I iterated over all balls and tested on each ball 12 vectors with 1.4m length for all directions if its distance with all other ball is more than 1.4m I will count this point. The collected points now can cover all the object with no points in the object core.
Wouldnt it be easier to create a larger ball for each prime ball, then merge all those large balls together. You’d get some redundant internal geometry but it might be easier to eliminate redundant internal triangles than to calculate your outer shape (assuming it matters, if you dont have that many balls it might not)
I thought about it. However, I couldn’t figure out how to merge the balls into one mesh and to smothen out the resulting mesh.
Simply I just want to create surface to a slightly complex object so I can color certain regions on that surface. It is just for visualizing the surface and maybe used for calculations based on this surface. This is for a chemistry and physics project I am currently working on.
If you treat each point like a ‘signal’ where you want to draw a surface at a certain signal level… then “Iso-surfaces” (also called meta-balls Metaballs - Wikipedia ) are what you are maybe looking for. Marching cubes is the approach to rendering smooth isosurface meshes.
I created a marching cubes implementation a long time ago. It can be found here:
…old-style build, though. Essentially, create a density field that adds up the inverse square distances from your points and then generates a mesh for it at a certain value.
This is the result of merging spheres from the dots I have. It is somewhat similar to what I want. However, merging function in the Heart library doesn’t exactly merge the meshes to create a unified surface. Maybe the marching cubes algorithm would be suitable for a smooth surface.