We continue with the entries aimed at becoming 3D experts within the 3D printing section. In the previous entry, we saw the different types of 3D object representations. In this post, we will see the processes of conversion between them.
Like the previous entry, we warn that if what you are looking for is to print as soon as possible, this post may provide little or almost no value. But we had already agreed that you are not just looking to print, but to become true “masters” of 3D who get the most out of their 3D printer.
Understanding conversions is especially important in 3D printing (and even more in 3D scanning) because, as we saw in the overview of the 3D printing process, we are going to work with solids (CAD files) and meshes (STL files).
This is even more true as the trend in 3D programs, such as Fusion360, allows working simultaneously with solids, surfaces, and meshes.
So we will avoid hearing “can you tell me the diameter of that 3D scanned piece,” be surprised that we cannot easily edit an STL file with our CAD software, or that our perfectly round hole is a polygon with straight edges when we print it in 3D.
But before we start looking at the transformation processes, let’s put everything into perspective by looking at a little bit (just a little, I promise) of theory.
Discrete and continuous models
In summary, we have two ways of representing geometry on a computer, continuous and discrete representations. The continuous form uses equations and mathematical models, while the discretized form contains information only at certain points in space.
In reality, these two modes, continuous and discrete, accompany us in many more situations than representing geometry.
Classifying the ways of representing 3D objects that we saw in the previous entry, in summary, we have:
- Discrete: Point clouds and meshes (including triangulated, quads, and subdivision).
- Continuous: Surfaces and solids.
In principle, changing from a continuous model to a discrete model is relatively simple by applying one of the several possible algorithms. This sampling process will basically take the values of the continuous model at certain points, discarding the rest of the information.
The narrower the sampling interval, the closer the discrete model will be to the continuous one. But, in return, we will have a greater number of points, which will mean a larger file size and greater processing load.
On the other hand, the process of changing from a discrete model to a continuous one is not trivial, being an exercise in interpolation. We are trying to “fit” a mathematical model to a discrete model, in which we have lost data in the sampling.
If you have ever fitted a curve to a series of points, you will know that, in general, it is not easy and usually involves the minimization of “some type of error.” But if we try to minimize too much, we arrive at a “continuous” solution identical to the discrete one.
Analogy in 2D
Everything mentioned above is probably better understood if we give an example in 2D. As we know, we have two ways of working with graphics and images in 2D.
On one hand, we have vector formats that we create with design programs (AutoCAD, Illustrator, etc), in which entities are treated as continuous mathematical objects (lines, circles, splines, etc).
On the other hand, we have the bitmap (or raster) format, which stores information in a discrete grid in which each point has a color (RGB, CMYK, transparency, etc).
Changing from a vector format to a raster one is always possible using one of the available algorithms. Basically, we ask at each point of the grid what color it would be according to the vector model.
The difference between algorithms is the criterion for determining the color of each pixel, and its neighbors, based on the distance to the model, which leads to more or less smoothed or focused models.
But it is always possible to convert to an image that “from a distance” looks like the original object. If we zoom in, we will see the pixels. That is, it is a process with losses. If we want more detail, we must increase the resolution (that is, reduce the sampling interval), which will imply a larger file size.
However, you will also know that the opposite process, vectorizing a raster image, is not so simple. There are programs that incorporate automatic processes, but in general, the result is usually not good and requires user intervention.
In fact, if we try to vectorize a captured image, for example, with a camera, the vectorization will have to perform color segmentation (“grouping” areas of similar colors) or we will end up with a vector image that is a rectangle for each pixel.
I think it illustrates quite well what was mentioned earlier about continuous, discrete, sampling, and interpolation. So get ready because in 3D it is the same (in fact, it is even worse).
Conversion processes between 3D representations
We will look at the different conversion processes, grouping them by the model (discrete or continuous) of the origin and the destination.
Discrete to Discrete
Meshes to points
We start with the simplest and probably least interesting option. Converting from a mesh to a point object is simple. We simply have to create a point at each of the mesh vertices. And, except in very strange cases, it will not be useful for us.
Points to meshes
The opposite case is much more frequent and interesting. We have it every time we have to obtain a 3D model from a 3D scan (which always returns a point cloud).
It is a process with high mathematical complexity and many studies have been carried out on this (it is still being studied today). There are several algorithms to carry out this process, such as the well-known Delaunay, or the most used, the Pivot-Ball along with variants.
But, in general, we can say that it is a process that is currently quite well resolved and implemented in many 3D software.
Meshes to meshes
Converting meshes to meshes is a much more common process than it might seem. Why would we want to convert one mesh into another? Well, to have a more convenient mesh, according to some criteria. This process is generally called retopology.
Examples are converting a mesh to one with a greater number of points, which includes subdivision or tessellation, at the cost of having a larger file.
We also have the opposite process, mesh simplification, which reduces the number of points while trying to preserve the detail. Generally, algorithms are used that try to replace polygons or eliminate them in areas of lower curvature.
But there are also other processes such as smoothing, erosion, relaxation, and “focusing” (increasing details). Finally, in the field of video games, films, etc., retopology often aims to obtain a more appropriate mesh for animation or texturing.
Continuous to continuous
Solid to surfaces
We already saw that, basically, a solid is formed by surfaces to which the concept of “inside and outside” has been added. Therefore, the conversion of solids to surfaces is practically immediate. This process can be called “decompose” or “explode,” depending on the 3D software.
Surfaces to solids
The opposite case is not so simple, because not all surfaces generate a solid. In general, if we have a closed surface and no singular points (closed loops on themselves, and other anomalies), the process is possible.
If instead of a single surface, we have several, we must join them and treat them with the available surface tools until we have a valid model to convert it into a solid.
There is no standard name for this conversion, but sometimes we will see the operation referred to as “solidify” or simply “convert to solid” in 3D software.
Continuous to discrete
Surfaces/Solids to meshes
We enter the most interesting processes. The conversion of surfaces/solids is a very frequent and normal process, more than you might think. Your computer does it every time it displays a CAD model on your screen, as the GPU is designed to work with meshes.
In our case, our 3D printer is not capable of working with solids or surfaces (you may be surprised, but most industrial manufacturing processes neither). So to print our CAD files, we have to convert them into triangulated files (usually to STL).
Fortunately, as we already mentioned, in general, this triangulation process is relatively simple. There are different algorithms (uniform, spatial, curvature) to obtain a mesh from a solid or surface.
Like any sampling process, triangulation is a process with losses. We are representing objects, with theoretically infinitely detailed curves, with a series of triangles with straight edges. If the triangles are small enough, we will not notice the difference at a certain distance.
If we want to increase the quality, we will have to reduce the size of the triangles. Most CAD software allows configuring the level of detail when exporting to meshes. But, as we mentioned, this implies a larger file size and processing time. As always, the important thing is to reach a compromise in accuracy and quality.
Discrete to continuous
Meshes to surfaces/solids
We reach the most difficult case, converting a meshed surface into a surface/solid. This process is called reverse engineering and, in general, it is not a simple process and requires human intervention to obtain good results.
It must be taken into account that a triangulated mesh, and especially those that come from capturing/scanning reality, the curves are polygonal approximations. But it is even worse, the planes are not planes either. We need to interpolate and adjust surfaces to the points.
There are dedicated programs that provide assistance in the process, and most CAD software are starting to incorporate functions to work with meshed models, and providing tools that help to carry out this process.
There are also “automatic” processes that convert the mesh into a series of surfaces that approximate the original object. It may be sufficient to work with them in CAD software, but it is not (by any means) a perfect solid like the one we would have if we had drawn it.
On the other hand, even in the case of using the tools to adjust surfaces (planes, cylindrical, conical) of the reverse engineering tools, in most cases the result is still not perfect. The radius that (logically) was 50mm in the original design is adjusted and measured to be 50.13mm. Two cylinders that were concentric are no longer. The same with parallels, perpendiculars, symmetries, patterns, etc.
In principle, the complete engineering process requires “almost” completely redrawing the piece based on the model. Sometimes it takes even more time than drawing it from scratch because when you draw it from scratch, you do it “as you want” and in reverse engineering, you have to adapt to a model.
So far, these two entries are intended to introduce the basis of 3D object representation and its conversion processes, as a prelude to delving into the world of 3D design and printing.
In the next entries in the section, we will delve into 3D design by presenting the different types of 3D design software and the main CAD design software. See you soon!