Sunday, February 26, 2023

3D-printing 3D-scans of caves


Can we copy a cave, by scanning it with an iPhone lidar, then printing a model of the cave using a 3D printer? The short answers is yes, but there's a lot of complexities, and it is not as easy as one might initially think.

I visited Tero yesterday and we got into trying to use his 3D printer to print 3D cave models. Tero has a lot of experience with modeling and printing, but there was one difference to what he's usually printed: the models.

To begin with, one normally prints solid objects, let's say a toy that is an object that can be lifted and held. There's a surface and inside the surface is some material (plastic) that's inside the object. 3D models fed to 3D printers need to have manifold geometry. As one source puts it, "non-manifold objects have geometry that cannot exist in the real world". For instance, shapes that have no volume, objects that have only one side, etc. Read the article in the link for more details.

The problem is that cave scans -- at least the ones that I've created using the Polycam app -- really are not about objects, they are about space. More specifically, they are about surface forms, without real knowledge of what's on the other side of the surface. As a result, they are objects that have no volume. One way to think about this is that they represent a shape and texture of an infinitely thin film around the cave.

Trying to feed such models to a slicing application or a 3D printer results in an error: the geometry is not closed.

Intuitively, one may think of caves as objects if one perceives the space in the cave as the object. But this intuitive thinking also leads us to some problems. For instance, if the space in the cave is the object, would the object distinguish between the border between the cave and its wall, vs. the border and outside world at the entrance of the cave in some different way? In speleology, a "drip line" is defined as a line on the ground at a cave entrance formed by drips from the rock above (Jennings). One could of course take this definition as the surface between the cave's outside and inside. Still, it feels at least to me intuitively odd to represent a hole, an entrance, as solid material.

Anyway, from a practical purpose, what can we do to print these weird models as objects? Or manipulate them with traditional CAD and 3D modeling tools that are often based on operations such as join or intersection?

Tero came up with the idea that in Blender one can "extrude" faces. A "face" is a triangle shaped fragment of a model with a "normal" that points to the outer side of the face. In a traditional model of an object, the normal would be pointing away from the insides of the object. E.g., a face on the surface of a ball would point away from ball's center. In my cave models, the normals are pointing from the cave wall faces inwards to the cave.

Tero put the Blender in editing mode for the cave object, selected all faces, and then extruded towards the outer direction (against the normal), so that the model would grow from an infinitely thin surface to something that has some substance. For our first iteration of this the grown cover turned to be too thin, less than the width of the printer's smallest print detail. More seriously, the slicing software left gaps between individual strands of printed plastic, making the cave have holes. The structure was neither pretty or able to hold itself properly.

Our next iteration increased the amount of extrusion. But it too failed, as the cave was now built upwards, and it fell down in the middle of the printing.

The third iteration added a bottom that would glue the object to the platform while being printed.

This worked well from the point of view of the printing. Here's the first (left) and third (right) iteration.

You can tell that in this small model, there are some imperfections in the surfaces. And the model itself is missing a part of the roof above the entrance -- a problem caused by iPhone's limited lidar range (5 meters).

To some extent we should be able to deal with this with better input models, by printing larger objects, and using Blender's tools to match the granularity of the model to the capabilities of the printer. And the right choice of support materials under the model being printed, right 

But is this great and all is fine? It is great in that for the first time I've managed to print something that I scanned, a real-life cave. But if we look more closely, there are issues.

To begin with, there's a serious issue with extrusion as provided by Blender's tools. They extrude every face, along (or against) the normal of each face. Here's a picture of the normals, as shown in the Blender's manuals:

In a complex shape like a cave there are places where extrusion against the normal will hit something else. Imagine a extruding the faces making up a stalactite hanging from the roof of a cave, as in here:

A straightforward extrusion hits multiple issues. First and most serious, in places where the form of the cave is very near the backside of a face -- as in the tip of a stalactite -- the extrusion will actually come out of the other face and show up as an error in the inside surface of the cave. Even if we never wanted to change anything in the inside.

So this is where we are now. Stay tuned, we're thinking about possible ways or algorithms to resolve this in a better way.

Another problem that we'd like to address is for a different kind of a print. So far, we've printed cave models where we'd like to peek inside. This is only practical for smaller caves that we can easily see inside from the entrance. For a large and more complex cave another type of a model might be preferable, such as a solid representation of the cave space as plastic. You could then see the branching cave passages and the overall makeup of the cave easily, but not see inside. For instance, I'd love to be able to some day print a model of the Lummelunda cave in Sweden:

This could potentially be done in a same extrusion fashion but choosing to extrude along the normal towards the insides of the cave. But it too would hit similar issues in complex cave geometry. Another alternative is perhaps enclosing the entrance(s) with a drip line cover in the model, and then considering the cave model as a 3D closed object.

A third problem is that in addition to the main, legitimate holes such as an entrance, scanned models tend to have smaller holes or missing parts of the model, e.g., behind rocks or small turning passages that one can't easily reach to scan them fully. These need to be blocked for any these approaches to work well.

Oh, and where can you get some 3D cave models, if you want to test? I have some on my web page, here. They are freely downloadable.

This article has also appeared at TGR. Read more urban exploration stories from, and other underground stories from Read the full Planetskier series at, or all blog articles from Blogspot or TGR. Photos and text (c) 2023 by Jari Arkko. All rights reserved. The normals in a donut picture is from the Blender manual, copyright Blender project.

No comments:

Post a Comment