Skip to content

Commit

Permalink
use image tag
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Sep 17, 2024
1 parent 944d7db commit aa47520
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tutorials/point_cloud_to_mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ After installing, open CloudCompare and import your point cloud file by going to
Depending on the number of points in your point cloud, this could take several minutes.
Once loaded, you should see the following tunnel section:

![Opening the point cloud](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/cloudcompare2.png)
\image html files/point_cloud_to_mesh/cloudcompare2.png

Many 3D scans will be composed of millions, sometimes hundreds of millions of points.
Converting a scan to a 3D model with that many points would be very difficult due to the number of polygons that would be created and the long processing time necessary to compute the normals.
Expand All @@ -35,21 +35,21 @@ We'll still walk through reducing points, however, to make the process quicker.

To reduce the number of points in your cloud, click on the tunnel so a yellow cube outline appears around it, then go to `Edit` > `Subsample`.

![Min. space between points](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/min_space.jpg)
\image html files/point_cloud_to_mesh/min_space.jpg

The number you will need to enter in the `min. space between points` field will vary depending on your point cloud.
A value of .01 was sufficient to bring our point cloud to an easy-to-manage 1 million points.
Point count is visible in the `Properties` window on the lower left side of the screen.

![Point count of subsample](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/properties.png)
\image html files/point_cloud_to_mesh/properties.png

How many points you reduce down to will largely depend on how long you are willing to wait for the point cloud to be converted into a mesh.
The more points you start with, the longer it will take to compute the normals and create the mesh.

After the operation is complete you’ll have two clouds in your scene: the original point cloud and your subsampled point cloud.
Most operations in CloudCompare will create new point clouds and keep the original, so make sure that you have the new point cloud selected before running an operation.

![Selecting the new point cloud](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/secondcloud.png)
\image html files/point_cloud_to_mesh/secondcloud.png

### Create a Polygonal Mesh

Expand All @@ -60,7 +60,7 @@ A normal is essentially the direction a polygon is facing.
To do this, go to `Edit` > `Normals` > `Compute`.
You'll see this dialog box:

![Choose Triangulation surface model](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/compute_normals.png)
\image html files/point_cloud_to_mesh/compute_normals.png

You’ll see various options in the dialog box that appears.
The main thing you’ll want to consider is what `Local surface model` to use.
Expand All @@ -73,7 +73,7 @@ Now we get to actually convert our point cloud to a mesh.
To do this go to `Plugins` > `PoissonRecon`.
You'll see this dialog box:

![Octree depth and output density selection](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/outputdensity.png)
\image html files/point_cloud_to_mesh/outputdensity.png

The value you enter in the `Octree depth` field will determine the polygon count of the created model.
You may have to run the surface reconstruction a couple times with varying values before you land on a polygon count that is suitable for your needs.
Expand All @@ -94,18 +94,18 @@ Our tunnel has turned into a blob shape.
This is because the mesh that CloudCompare creates will always be water tight even if it has to add polygons where there are no points.
We just want our tunnels, though, so we need to remove those unnecessary polygons.

![The blob shape](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/blob2.jpg)
\image html files/point_cloud_to_mesh/blob2.jpg

This is where our scalar field comes in.
In the mesh's `Properties` window go to `SF display params` and take the left handle in the graph and drag it to the right until it hits the area where the bulk of the scalar field starts.

![Adjusting scalar filed params](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/sf_display.png)
\image html files/point_cloud_to_mesh/sf_display.png

This will display only the polygons that were created from the point cloud and hide the polygons used to make the model watertight.
The polygons are only hidden however.
We still need to actually remove them.

![Display original polygons](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/hidden_polygons2.jpg)
\image html files/point_cloud_to_mesh/hidden_polygons2.jpg

To remove the hidden polygons go to `Edit` > `Scalar fields` > `Filter By Value`.

Expand All @@ -114,11 +114,11 @@ Hitting export will simply export the mesh within that range.
Instead, we'll hit `Split` to create two meshes.
One with the polygons inside our specified range and one containing polygons outside that range.

![Splitting the mesh](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/split.png)
\image html files/point_cloud_to_mesh/split.png

It is possible that you will get error "Visibility table not instantiated". This error causes only the "wanted" part of the mesh to be created when splitting, while the other ("unwanted") part will not be generated. But that is not a problem for our use-case.

![Error: Visibility table not instantiated](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/error.jpg)
\image html files/point_cloud_to_mesh/error.jpg

### The Completed Model

Expand All @@ -128,6 +128,6 @@ Your file format will depend on the software you want to use but `.obj` is a wid

Before exporting, check your mesh for holes. If still checked, disable display of the pointcloud, so that only your output mesh is shown. Inspect ground parts of the mesh (or any other parts you are most interested in) and check if there aren't holes in it. If there are some, you can try to repeat the trimming step with more relaxed threshold.

![The completed mesh](https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/point_cloud_to_mesh/complete2.png)
\image html files/point_cloud_to_mesh/complete2.png

You can find more information on CloudCompare and a more in depth look at the tools we used in this tutorial on [the CloudCompare website](https://www.cloudcompare.org/) and the [CloudCompare wiki](https://www.cloudcompare.org/doc/wiki/index.php?title=Main_Page).

0 comments on commit aa47520

Please sign in to comment.