How to generate manifold printable .stl's from .ply

A forum dedicated to the development of Free Software, Libre Innovation, and Open Source Hardware (FLO) 3D Scanners
Post Reply
rufu5
Aleph Objects | LulzBot
Posts: 249
Joined: Wed Apr 10, 2013 12:25 am

How to generate manifold printable .stl's from .ply

Post by rufu5 » Wed Jun 10, 2015 1:49 pm

I've recently had the opportunity to try the Ciclop, an open source hardware desktop laser scanner. The recommended software is Horus, which will export a colored point cloud in .ply file format. You can't print a .ply directly, because the slicing engines available are designed to work with manifold surfaces, like those found in good .stl's, .obj's, and .amf's. As Horus is developed, I think we will see more file processing options, like trimming, alignment, "fusing", "flattening", hole filling, and other various file-prepping tools. In the mean time, Meshlab and Blender offer these tools, and can be used to make printable files from point cloud data.

Nothin' to it but to do it!

First: let's just open the file in blender and isolate some patches to see what we are working with. tab gets you into edit mode for the selected object. a deselects everything. c or b can be used to do a circle select or border select. Scroll the wheel to change the size of the circle and hit esc when you are finished selecting. shift+h hides all but the selection. alt+h shows everything.
Attachments
screen1.png
Raw data
screen2.png
So many points.... 1046606 to be specific.
screen3.png
using the border select tool to take a cross-section of the data. Use shift+h to hide everything that's not selected
screen4.png
Face and nose. Can you see the two layers stacked on top of each other?
screen5.png
Isolated section of the nose. There are two surfaces there. Not good!
screen6.png
Top of the head. There is missing data there, but it's not easy to see. It's super easy to get disoriented when working with point clouds, because the backside and the front side look the same and you can see both.

rufu5
Aleph Objects | LulzBot
Posts: 249
Joined: Wed Apr 10, 2013 12:25 am

Re: How to generate manifold printable .stl's from .ply

Post by rufu5 » Wed Jun 10, 2015 2:14 pm

Now that we have an idea of what the mesh looks like, let's open it in meshlab and start applying some filters.

Note: filters are applied to the selected mesh only. Make sure you have the right mesh by selecting it from the layer dialogue. If you don't see the layer dialogue, then show it using the "view" menu.
Attachments
screen7.png
File right after import. There is missing data on the top of the head, as you can see.
screen8.png
A view of the lady's face. The different tones are due to the stacked layers and (I think) the different normal directions. That's how it is in blender anyway.
screen9.png
Here is where you find the poisson disk subsampling filter.
screen10.png
This is how I configured the poisson disk subsampling algorithm. Make sure to check the "base mesh subsampling" option since it's not a mesh, it's just a point cloud (obvious, right?).
screen11.png
Original mesh before subsampling
screen12.png
Subsampled mesh. Notice how many fewer points there are when compared to the original.
Last edited by rufu5 on Wed Jun 10, 2015 2:55 pm, edited 1 time in total.

rufu5
Aleph Objects | LulzBot
Posts: 249
Joined: Wed Apr 10, 2013 12:25 am

Re: How to generate manifold printable .stl's from .ply

Post by rufu5 » Wed Jun 10, 2015 2:27 pm

So, this reconstruction failed, but I'm going to post it anyway and then try it again. I think that by trying to orient things better for screenshots I may have scaled and translated the model in ways that altered the outcome, or I used too high a octree depth
Attachments
screen13.png
Where to find the computing normals filter
screen14.png
Settings for computing the normals
screen15.png
Where to find the Poisson surface reconstruction.
screen16.png
Poisson reconstruction with the settings I used.
screen17.png
The result of the reconstruction. Extra data that's a bit weird.
screen18.png
This is what I ended up with using these settings. I think it's usable with a trim and a boolean'd on base. Success?!!?

rufu5
Aleph Objects | LulzBot
Posts: 249
Joined: Wed Apr 10, 2013 12:25 am

Re: How to generate manifold printable .stl's from .ply

Post by rufu5 » Wed Jun 10, 2015 2:51 pm

This is how you trim and Boolean on a base.

Supplementary info on the Boolean modifier: viewtopic.php?f=8&t=595&hilit=blender+basics
Attachments
screen19.png
shortcut to selecting the stuff we want to trim
screen20.png
into the trash it goes
screen21.png
Booleans only work very well if the two meshes are manifold, so go ahead and check to see that they are with the "select non-manifold" tool. This is one of the strengths of the poisson surface reconstruction approach -- it usually gives manifold results.
screen22.png
overlay of the original ply and the reconstructed .stl from the previous step
screen23.png
Using the original .ply as a reference to line up a cube to union on.
screen24.png
Union'd base

rufu5
Aleph Objects | LulzBot
Posts: 249
Joined: Wed Apr 10, 2013 12:25 am

Re: How to generate manifold printable .stl's from .ply

Post by rufu5 » Wed Jun 10, 2015 3:19 pm

So I ran through the same process with the octree depth set to 8 instead of 10 in the poisson surface reconstruction, and got results that didn't need to be trimmed, just needed the normals flipped and the base trimmed off a bit to give it a nice flat footprint for printing.

So that's all folks, if anyone posts some files they are trying to print, I'll try to help out. Part of what makes this process tricky is that the optimal parameters for these filters are completely application and geometry dependent. I personally prefer doing it manually this way (rather than having a all-in-one package that does it for you) because I have *complete control over what the final geometry looks like, rather than having to just go with whatever the native software spits out (if it spits out anything at all). That being said, many users *will probably want that for ease of use purposes. I think the best case would be to have both options.
Attachments
screen25.png
Result of the reconstruction with the octree depth set to 8 instead of 10. The darker color means we are looking at the back of the faces -- the normals are inverted.
screen26.png
normals flipped the right way and the bulge left over from the surface reconstruction that we want to get rid of.
screen27.png
Adding in the cube to boolean difference off the bulge on the base

User avatar
do-it-for-science-
Posts: 74
Joined: Sat Jan 17, 2015 8:02 pm
Location: Wilsonville, Oregon

Re: How to generate manifold printable .stl's from .ply

Post by do-it-for-science- » Wed Oct 07, 2015 8:53 pm

this is some really good info thank you for the post! I am printing out the parts to make a piclops and this is exactly the sort of thing I was looking for on how to deal with the point clouds!
open source, open heart,

Jeff Hunt,
Renewable Energy Engineering student OIT

Post Reply