A Script to Skin a Point Cloud (for Blender 2.6x or Later)

@RickyBlender

can this be run in text editor or only as an addon?

This works from Text Editor and from addon system.
In the last line of the code, you will see main() called, which means its entry point is main() function. So if you want to run it by your own, you can get the idea to how to run the script by reading the code in main() function.
Also you can set your own parameters manually in #41 to #44 in the code where you will find the code like ui[“DistForSearch”] = 1.0.

As long as the addon tells where its GUI will be seen, it does not matter (IMHO).
If someone wants it at an other place, in most of the time an easy change in the source, isn’t it?

==>Some wikiplace, where a GENERAL instruction is described which places one could use and how a class could be adjusted …?!

@PKHG

I also want to know the general rule or instruction anout addon development.

@RickyBlender

after 30 seconds i got the skinned version

Oh, I forgot to mention that it takes a lot of time, maybe more than you expect. If you want to skin 1M vertices, then you have to wait 10mins or more.

there was some faces that were not done may be because of some bugs still presents

I’m sorry. Often several errors occur while running the script, and it stops skinning process around the vertices where errors have occurred. Those vertices are selected, so after skinning, you can find out where the errors occurred in EditMode.

@bleber

With some smooth and remesh it shows more clear.

Thank you for trying to make it better. It looks much better. However, because of the bugs that the script has, there are some holes on the surface where the script didn’t make faces. I’m sure it’s definitely because of the bugs.
When a point cloud is noisy, the bugs increase the number of errors occurring, and it causes those holes.

you should add notes to first post

1- Time for execution can be very long
may be add a sample file with time to process it

2 - Change the panel to too pro may be

3- a to do list
some bugs to be removed / faces not done at 100 %

4 - clean up mesh with remesh may be

happy 2.6

there must be a way to make it run faster

may be try to make a copy of the Verts list to another python vars unlinked!
then do all calculations
it should be faster then using internal API commands !

or may be using numpy algos instead !

happy 2.6

@RickyBlender

Thank you for your advise. Good idea. I’ll do tomorrow :slight_smile:
I’m also going to add the explanation on “Dist for Skin:” parameter.

@RickyBlender

Oh, I didn’t know that using internal API commands makes it slow. How slow is it to access via Blender Python API? Is there any information on performance or benchmark?

well it’s been done on some other scripts
usually if you use the internal values form Verts edge faces it’s running slow cause it has to go though the API interface to get the data form internal blender

now if possible you can copy your data to python vars then do the calculations without using API commands then it should run faster
mind you i did not analyse your algo to do it so not certain if possible in this specific case!

but it gives an idea how to improve speed in some cases which can use this advantages of external python vars!

happy 2.6

Wow this is really shaping up.

@Ricky, Blebber and Hans
Thanks for all your responses. School has had me tied up the past week so I’ve been off line quite a bit

@Hans PG
Is this equivalent to a Ball Pivoting type meshing? The “Searching within a sphere” sounds a lot like “roll a ball around each point.” I read your algorithm and notes on parameters. Now I understand how you can really get a LOT of calculations when you increase the dist to skin variable.

@Ricky
That cloud is a lot of vertices I think for that particular mesh, a prudent vertex based normal calculation with some “intelligent” decimation would go a long way to making the actual meshing step much more efficient.

@Bleber
Wanna post that .blend so I can compare with results I get from Meshlab using a Poisson filter

@RickyBlender

I’m sorry. I haven’t added notes to the first post yet… Changed notes can be seen in the next weekend.

@patmo141

Thank you for reading my homepage.
Yeah, we can use Meshlab instead. I haven’t tried it yet, so I don’t know the details on how it works. It seems to be efficient. I’m curious about how long Meshlab takes time to mesh.

Is this equivalent to a Ball Pivoting type meshing? The “Searching within a sphere” sounds a lot like “roll a ball around each point.”

As result, it would be almost the same as what this script does. But I don’t have enough knowledge about Ball Pivoting type meshing. You know well about meshing. Do you have any webpages that gives a good explanation on Ball Pivoting type meshing? And also any suggesions to this script are welcomed.

Hey Hans,

I’m actually not terribly proficient with the actual algorithms beyond a basic understanding. Usually if you click the “help” button in a lot of the meshlab functions, it will actually give you a citation or literature reference. That’s how I gained most of my understanding was by reading the abstract or browsing quickly through the papers

Here is the Ball Pivoting paper. Check out section 3 for a good description.

Re: Speed
Meshlab is going to have us beat on speed since it uses C++ I’ll post some comparison results when I get a chance

@patmo141

Thanks a lot for your information. I took a brief look at the paper. It says that Ball Pivoting algorithm takes around 10mins for 2M vertices to be meshed when using a PC with 450MHz CPU (it was written in 1999. now we can use 5 to 10 times faster PC at least, I guess). So I thought it means skinning is a difficult problem and it takes a lot of time to process.

Usually if you click the “help” button in a lot of the meshlab functions, it will actually give you a citation or literature reference.

When I saw Meshlab the last time some years ago, I could only find its source code. I didn’t know that now they have Meshlab application (.exe). I should definitely try to use it. Thanks for letting me know about that :slight_smile:

but meshlab is not a free app if i remember well ?

hope it is easy to port this code to python !

but doing it with only python should be almost as fast as C or at least faster then passing through API commands in blender!

happy 2.6

Ok, Here are the results from my not too fast laptop.
CPU 2.4ghz Core 2 Duo p8600 w/ 6gb RAM on win7 pro 64bit

I’ve attached a blend with the following models. There is a text file in a separate window as well.
http://dl.dropbox.com/u/2586482/point_cloud_results.blend

##Objects##
Point Cloud
    The original point cloud

ML Ball Pivoting
    Mesh Lab Ball Pivoting approach.  
        -Ball radius .247
        -Angle: 90
        -Clustering %: 20
        -completed in 19.776 seconds
    
ML Poisson
   Mesh Lab "Calculate Normals for Point Set"
       -number of vers 12
       -Time: 3.062 sec
   Mesh Lab "Poisson Surface reconstrction"
       -Octree Depth: 6
       -Solver Divide: 6
       -Samples per node: 1
       -suface offset: 1
       -Time: 4.405 sec
       
   Total Time:  7.767 sec

ML Poisson 2
   Mesh Lab "Calculate Normals for Point Set"
       -number of vers 11
       -Time: 3.070 sec
   Mesh Lab "Poisson Surface reconstrction"
       -Octree Depth 7
       -Solver Divide: 7
       -Samples per node: 1
       -suface offset: 1
       -Time: 20.677
       
   Total Time:  23.747
   
ML Poisson 3
   Mesh Lab "Calculate Normals for Point Set"
       -number of verts 12
       -Time: 3.096 sec
   Mesh Lab "Poisson Surface reconstrction"
       -Octree Depth 7
       -Solver Divide: 7
       -Samples per node: 1
       -suface offset: 1
       -Time: 20.724
       
   Total Time:  23.820
              
Point Cloud Skinner
    -dist for skin: 0.25
    -ignore error = True
    -rest defaults
    -Time:  Don't know,left after 10 minutes and went to gym.

@Ricky
Meshlab is free and open source :slight_smile:

@Hans
Skinning can be difficult. There is definitely no perfect method and it is 1/2 art 1/2 science.

I think what I would like to see is a modifier in the actual Blender source with simple mesh processing tools. Perhaps a ball pivot, a poisson reconstruction and maybe an iterative closest point mesh registration where you can even define vertex groups to limit which parts are used to register meshes together. Point cloud data gets more available every day and some basic tools in Blender would be awesome especially if they were compiled in source…ahh dreams.

ok misread meshlab and not mathlab !

i read the paper on ball pivoting and don’t see how you get the normal for each point !

and as indicated you need data with minimum amount of noise to get good results so need some preprocessing here to clean the data!

is there any description for this poisson algo ?

but your right this sknning algo is not simple !

happy 2.6

well, now we are bordering on “thread hijacking” but here is a nice paper on poisson reconstruction. Its at Johns Hopkins. The cool thing is that there is a MSVC solution with source.

@patmo141

The skined mesh, refined with only modifiers, you can play with it.

http://www.pasteall.org/blend/11032

http://www.pasteall.org/pic/show.php?id=24670